8/32
Part 2 of 6 · Shapes place the transposesLearn and do

The backward pass is the forward pass read bottom to top

Here is every gradient in the practice problem, from the loss down, with the rule that makes it. Step through it:

The backward passInteractive
dlogits (N, K) = softmax minus one-hot, over N. The next part derives it. Here it's given.

Every gradient comes from a rule you already have: the shape rule places a matmul's transpose, the bias rule sums over the batch, and the ReLU gate multiplies by the mask from the table of six rules. Only dlogits is new, and it gets the next part.

In the editor, write backward(params, x, pre, h, dlogits): every gradient in the flow, from dlogits down to dW1 and db1.