Backpropagation
Computing the gradient of the loss with respect to every weight by applying the chain rule backwards through the network, layer by layer.
Needs a step first: 35
A network is a long composition of simple functions, so the derivative of the loss with respect to any weight is a product of local derivatives along the path from that weight to the loss. Backpropagation computes them efficiently: a forward pass stores each intermediate value, then a backward pass starts from and multiplies by one local derivative at each step, reusing the shared parts. The cost is only a small multiple of the forward pass, however many weights there are. This is what makes training networks with millions of parameters possible; software that does it automatically is called automatic differentiation.
Where it shows up: Every deep model on this map, from convolutional networks to transformers and diffusion models, is trained with gradients from backpropagation.
How to hold it: In your head
See backpropagation as the chain rule run backwards, reusing the shared products, which is why one backward pass costs about as much as one forward pass however many weights there are.
What knowing it looks like
- Draw the computation graph of a small network and carry gradients backwards through it by hand.
- Check a backpropagated gradient against a finite difference.
- Explain why the backward pass costs about as much as the forward pass, not once per weight.
Test yourself
A tiny network computes , , , with loss . With , , and target , do the forward pass and find and by backpropagation.
Show the worked answer
Needs a step first: 35
Learn it with an AI
Copy this prompt into any AI assistant. It will take you through step by step at your level and finish with the test above.
Be my maths tutor. I'm learning "Backpropagation" (Frontier tier): Computing the gradient of the loss with respect to every weight by applying the chain rule backwards through the network, layer by layer.
I already know: Neural Networks, The Multivariable Chain Rule and Jacobians.
Teach it Socratically: first ask what I already know; then explain the core idea with one concrete example and why it's true; then give me three problems, one at a time, easy to hard. Wait for my answer, check every step, and point out mistakes without giving the answer away.
Finish by testing me with this: A tiny network computes $z = w_1x$, $h = \mathrm{ReLU}(z)$, $\hat y = w_2h$, with loss $L = \tfrac12(\hat y - y)^2$. With $x = 3$, $w_1 = 0.5$, $w_2 = 2$ and target $y = 1$, do the forward pass and find $\partial L/\partial w_2$ and $\partial L/\partial w_1$ by backpropagation.
Use LaTeX for formulas. When you say where it's used later (machine learning, quantum mechanics), be specific.Needs first
- Neural NetworksLayers of simple units, each a weighted sum passed through a nonlinear function, composed into a function that can fit almost anything.Frontier · Machine Learning
- The Multivariable Chain Rule and JacobiansHow rates of change pass through functions of several variables, organised as a product of Jacobian matrices.Undergraduate I · Multivariable & Vector Calculus
Leads to
On the way to
Recommended
- Neural Networks: Zero to HeroAndrej Karpathy · VideosFree lectures that build backpropagation, a language model and a small GPT from scratch in Python, explaining every line.
- Understanding Deep LearningSimon J. D. Prince (MIT Press) · BookA clear, well-illustrated 2023 textbook covering networks, training, transformers, diffusion models and reinforcement learning, free as a PDF with Python notebooks.
- 动手学深度学习阿斯顿·张、李沐等 · Book · 中文The Chinese edition of Dive into Deep Learning: a free textbook in which every model, from linear regression to transformers, runs as code beside the maths.
- 跟李沐学AI李沐 · Videos · 中文Mu Li's own Bilibili channel: the video course for Dive into Deep Learning and paragraph-by-paragraph readings of key papers, including the Transformer paper.