Inside a neural network / 4 of 7
Backpropagation and the chain rule
What you’ll learn
- Explain the main idea of “Backpropagation and the chain rule” in your own words.
- Trace a concrete example and identify the assumptions behind it.
- Apply the principle in a practice problem and recognize a common failure.
The idea, intuitively
Backpropagation efficiently computes how each parameter contributes to loss. It moves backward through the computation graph using the chain rule. It calculates gradients; the optimizer decides how to use them.
Treat a neural network as a computation graph, not a mysterious black box. Follow a tiny input through each operation and keep track of tensor shapes. Distinguish the forward pass, gradient computation, and optimizer update. These three stages are connected but solve different parts of the learning problem.
Under the hood
If y=f(g(x)), the derivative multiplies the outer derivative by the inner derivative. Reverse-mode automatic differentiation reuses intermediate values rather than independently perturbing every parameter.
A gradient is a sensitivity signal, not an explanation of causality in the real world.
A worked example
For prediction wx and loss (wx−y)², the derivative with respect to w is 2(wx−y)x.
How to use this way of thinking
Build intuition with a small calculation before scaling dimensions. Check whether the architecture can represent the desired relationship, then whether optimization can learn it, then whether the learned solution generalizes. A failure in any one of these stages needs a different response.
Try it yourself
For w=2, x=3, y=4, calculate dL/dw.
Key takeaways
- The chain rule
- A gradient is a sensitivity signal, not an explanation of causality in the real world.
- Check the assumptions with a small example before applying this idea to a larger system.
Check your understanding
Use feedback to learn. Quiz scores and lesson completion are tracked separately.
Go to lesson completionFurther reading
Original papers and reference material for this school. External resources may be in English and require internet access.
Dive into Deep Learning (opens a new tab)PyTorch: automatic differentiation (opens a new tab)Finish this lesson
Mark this lesson complete when you’re ready to continue.