bugger.
All challenges/Pythonhardllm-looped-depth-v1
THE INVESTIGATION

Loop a shared depth block

Apply a shared residual block repeatedly and return each hidden state.

LLM ArchitectureArchitecture builds

What’s going wrong

Implement solve(data). Given a vector state, square matrix weight, bias vector, and nonnegative integer steps, repeatedly compute next[i] = state[i] + bias[i] + sum(weight[i][j] * state[j] for j). Each step reads the entire previous state. Return {"states": [...]} containing the initial state followed by every updated state. All inputs are small, well-formed integers. This affine block is a teaching stand-in for a transformer block.

Expected behavior

Apply a shared residual block repeatedly and return each hidden state.

Reproduction

01 Two shared updates
{"state": [1, 2], "weight": [[0, 1], [1, 0]], "bias": [0, 0], "steps": 2}
{"states": [[1, 2], [3, 3], [6, 6]]}
02 Zero steps
{"state": [3], "weight": [[4]], "bias": [1], "steps": 0}
{"states": [[3]]}
03 One update
{"state": [2], "weight": [[2]], "bias": [1], "steps": 1}
{"states": [[2], [7]]}

Before you begin

  • Python lists and matrix multiplication

Need a nudge?

Reveal one investigation hint at a time. Try each clue before opening the next.

    The bug is intentional. Run the starter code to see it fail, then work toward a fix. Difficulty is provisional.
    Read-only preview
    Ready when you are
    Every fix starts with a failing test.

    Read the report, then sign in to start your investigation.