Module 03 Summary
The idea this module was built around
Backpropagation is the chain rule applied backwards through a graph you already built. Work it once by hand and it stops being mysterious.
What you can now do
- Explain why the loss must be a single scalar with a
grad_fn - Verify a gradient by hand and confirm it with autograd
- Order the three steps correctly: zero, backward, step
- Checkpoint on validation and reload a run
The trap this module removed
Gradients accumulate. Two backward passes without clearing give the sum of both. And since PyTorch 2.0, zero_grad() releases the tensors entirely — .grad becomes None, so code reaching for .grad.abs() immediately after raises AttributeError.
Figures worth remembering
The worked chain rule: a.grad 150.0, b.grad 90.0. Training on a known rule recovers [2.0, -3.0] and bias 1.0.
Before you move on
Run your loop on data with a known answer. If it does not recover the rule, the loop is wrong, however nicely the loss curve falls.
