17/42
Part 3 of 6 · The worked exampleLearn and do

Then the mask guards the wrong rows, and the future leaks in

Mixed rows aren't just untidy. They break the mask.

Which inputs each output depends on
view + transpose (3, 3)
in 0in 1in 2output 0xoutput 1xxoutput 2xxx
bare reshape (3, 3)
in 0in 1in 2output 0xxoutput 1xxxoutput 2xxx

x means the output depends on that input. Red is the future leaking in.

The causal mask trusts that row tt is position tt. After a bare reshape it guards the wrong rows.

The future leaks in, every shape is right, and nothing raises.

In the editor, write split_heads(x, n_head). It prints the split of the labeled tensor from the last few steps, so you can check that every row keeps one tens digit.