Understanding Backpropagation
Step through a neural network or CNN, inspect the chain rule and apply a weight update. Includes a worked backpropagation example you can follow without code.
By ThinkIdiot · Published · Updated
This demo works best on a larger screen. The Explain tab has a text walkthrough.
Follow the signal
Use Step to follow the forward pass from the inputs to the loss.
Take the model apart.
Click a piece. See its job in slow motion.
Loading the model and its controls…
How Backpropagation Works
Backpropagation is how neural networks learn. It's the algorithm that figures out which weights to adjust and by how much after every prediction.
The Core Idea
- Forward pass, data flows through the network, producing a prediction
- Loss calculation, we measure how wrong the prediction was
- Backward pass, we trace back through the network, computing how much each weight contributed to the error
- Weight update, each weight gets nudged in the direction that reduces the error
What to Try in the Demo
- Choose Neural Network or CNN, then press Step to move through the forward pass, loss, backward pass and weight update in order.
- Use Back to revisit a step, or click a step in the timeline. Going back in the timeline is different from computing the backward pass.
- Compare the highlighted values with the Formula, Computation and Result panels. Auto-Play advances the same sequence for you.
- At the last step, choose Apply update & run again to update the weights and compare the new loss. Reset restores the starting state.
The demo uses a fixed learning rate of 0.5. To change that value yourself, open the gradient descent playground. This small teaching network exposes the arithmetic; it is not a benchmark of training speed or a demonstration that every update improves every network.
The Chain Rule
The math behind backprop is just the chain rule from calculus, applied repeatedly. For each weight, we compute:
Each term in this chain tells us how sensitive the output is to a small change at that point in the network.
One Weight, One Check You Can Do Yourself
Strip the network down to one weight. Let the input be 2, the target be 1, and the prediction be input times weight. Start with a weight of 1 and use half the squared prediction error as the loss.
- Forward: prediction = 2 × 1 = 2. Loss = 0.5 × (2 − 1)² = 0.5.
- Backward: the loss gradient with respect to the weight is (prediction − target) × input = (2 − 1) × 2 = 2.
- Update: with a learning rate of 0.1, the new weight is 1 − 0.1 × 2 = 0.8.
- Check: the new prediction is 1.6 and the new loss is 0.5 × (1.6 − 1)² = 0.18.
That smaller example uses a different learning rate from the full demo. The point is the chain: backpropagation computes the gradient, then gradient descent uses it. No tiny person inside the computer is guessing which knob to turn.
To implement the graph and backward pass yourself, follow autograd from scratch in Python. For the intuition behind the update, read the blind hiker explanation of gradient descent.
Why This Matters
Every modern AI model, GPT, DALL-E, self-driving cars, learns through backpropagation. Understanding it gives you intuition for why models fail, why training is unstable, and how to fix it.