Module 5 — Backpropagation Intuition
Module 4 left one step as a black box: "compute, for every weight, which way to nudge it." That step is backpropagation, and despite the intimidating name it is just one idea you already know from Course 2 — the chain rule — run backward through the network. This module opens the box so you can watch the blame flow back, weight by weight.
The idea: share out the blame
After a forward pass you have a prediction and a loss. Backprop answers: how much did each weight contribute to that error? It starts at the output, where the error is obvious (prediction minus target), and works backward. A weight near the output gets blamed directly; a weight deep inside gets blamed through everything it fed into — and the chain rule is exactly the bookkeeping that multiplies those influences together.
- Output error — start with \( \hat{y} - y \), how wrong the final answer was.
- Backward step — pass that error to the previous layer, scaled by the weights it flowed through and by each neuron’s activation slope (the chain rule).
- Gradient — for each weight, blame = (error arriving at its neuron) × (the input that weight carried). That is \( \partial\text{loss}/\partial w \).
Press Train one step below. The network does a forward pass, measures the loss, then backprop lights up each connection by how much it’s to blame — thicker means a bigger gradient. Watch the weights with the most blame move the most, and the loss fall step after step.
This activity needs JavaScript. The lesson below still covers everything.
pred = model(X) # forward pass loss = loss_fn(pred, y) # one number loss.backward() # BACKPROP — fills every weight's .grad via the chain rule optimizer.step() # update: w ← w − η · w.grad optimizer.zero_grad() # clear grads for the next step
That single loss.backward() call is the backward flow on the canvas — it computes \( \partial\text{loss}/\partial w \) for every weight automatically. You never write the chain rule by hand; the framework does it for you.
Check your understanding
A few questions about backpropagation. You will get a score.
This activity needs JavaScript.