Backpropagation, made visual
Backpropagation is how a neural network figures out which weights to change and by how much. First, input values flow forward through the layers to produce an output and an error. Then the error's gradient flows backward through the network, layer by layer, using the chain rule from calculus.
That backward pass tells every single weight how much it contributed to the mistake — which is exactly what gradient descent needs to improve them. Without backprop, training deep networks would be impossibly slow.
Forward computes the loss — then backprop the gradients
Loss (target = 8)
1
Prediction z should hit the target. Now press Run backward to see how to fix it.
Free · runs entirely in your browser · nothing to install
How to use it
- Watch the forward pass carry values left to right to an output.
- Trigger the backward pass and follow the gradients flowing right to left.
- Notice how each node's gradient depends on the ones after it — that's the chain rule.
What you'll take away
- Why the forward pass and backward pass are two halves of one loop.
- How the chain rule assigns 'blame' for the error to each weight.
- The link between backprop and the gradient descent step that follows it.
Want to actually build this?
This demo is one moment inside a full Math to Machine lesson — predict, build, and explain the concept, with an AI tutor that gives hints, not answers. The first five lessons are free.
FAQ
- What is backpropagation used for?
- It efficiently computes the gradient of the loss with respect to every weight in a neural network. Those gradients are then used by gradient descent to update the weights so the network makes fewer mistakes.
- Is backpropagation just the chain rule?
- Essentially, yes. Backprop is a clever, reusable way of applying the calculus chain rule across all the layers of a network so that each weight's gradient is computed exactly once.