Interactive Lab · How networks learn
Training works by blame. The network makes a prediction, sees how wrong it is, and then has to figure out exactly which weight caused the mistake, and by how much. Backpropagation is that reckoning: one forward pass computes the prediction left→right, then one backward pass flows the error right→left, and out falls a gradient for every weight. The trick is the chain rule, each gradient is just a running product of local slopes along its path. Run it and watch the blame flow.
🎬 Watch the 45-second explainer, then turn the knobs yourself below ↓
▶ The playground, set the weights, run forward, then flow gradients back
The graph: x → ·w1 → h → ·w2 → ŷ → loss. Forward lights VALUES (orange, left→right); backward flows GRADIENTS (blue, right→left).
Backpropagation is the single algorithm that trains every neural network in production, GPT, Stable Diffusion, your phone's face unlock. When practitioners debug “my model isn't learning,” they're usually staring at exactly what you just saw: gradients vanishing through deep chains, the reason residual connections and careful initialization exist.
The code that's actually running, live numbers
Drag w2 down toward 0 and run Backward. Predict first: what happens to w1's gradient? Notice that w1 sits behind w2 in the graph, so its blame must pass through w2, and w1's gradient is multiplied by w2. As w2 → 0, w1's gradient → 0 too: the earlier weight stops receiving any learning signal even though it's just as "wrong." Now imagine not two but fifty layers, each multiplying by a small number… That collapse is vanishing gradients, the reason deep networks are hard to train. Set w2 ≈ 0 and confirm w1's gradient nearly disappears.
The takeaway
dL/dw1 = 2(ŷ−y) · w2 · x, the loss's slope, times w2, times x. The sign tells you which way to nudge the weight; the size tells you how much to blame it.