Backpropagation
Backpropagation — Propagate error gradients backward to update every weight.
Backpropagation is how networks learn. It sends the output error backward through the layers using the chain rule, computing how much each weight contributed to the mistake, then nudges every weight to do better.
Forward pass — activations light up
- Class 0
- Class 1
- Traced example
- Gradient edge
Backprop controls
The idea in plain words
Backpropagation is how networks learn. It sends the output error backward through the layers using the chain rule, computing how much each weight contributed to the mistake, then nudges every weight to do better — the same gradient descent, wired through the net.
Watch the error flow back edge by edge. Make the network deep with sigmoids and the early-layer gradients dim to almost nothing — the vanishing-gradient problem, visible in the shrinking bars. Switch to ReLU to revive them.
Now, the math
The gradient for each weight is a local product, assembled by the chain rule:
- the error signal at neuron j in layer l, propagated from the output.
- the activation that fed into that weight on the forward pass.
▸ Show the derivation
Each δ is the next layer’s δ times the local weight times the activation derivative. Because those derivatives (≤ 0.25 for sigmoid) multiply at every layer, the error signal shrinks exponentially as it travels back, so early layers of deep sigmoid networks barely update. ReLU’s derivative of 1 keeps the signal alive.
Trace it by hand
The smallest network that can show the chain rule: input x → weight w₁ → sigmoid → weight w₂ → output ŷ, with squared loss L = ½(ŷ − y)². Concrete numbers: x = 1, w₁ = 0.5, w₂ = 0.8, target y = 1, learning rate 0.5. Values rounded to 4 decimal places.
Step 1 — forward pass: run the numbers left to right
This is exactly one run of forward propagation; every intermediate value (z₁, h, ŷ) gets cached for the backward pass.
Step 2 — backward to w₂: two local derivatives
Step 3 — backward to w₁: the chain grows one link per layer
σ′(z₁) = h(1 − h) = 0.6225 · 0.3775 = 0.2350. That factor can never exceed 0.25 — stack ten sigmoid layers and the gradient shrinks by up to 0.25¹⁰, the vanishing-gradient problem.
Step 4 — update both weights with gradient descent
Rerun the forward pass with the new weights and the loss drops from 0.1260 to 0.0777 — one step of gradient descent, routed through the network by the chain rule.
What just happened: backpropagation never differentiated the whole network at once — it multiplied cheap local derivatives (ŷ − y, then w₂, then σ′, then x) backward along the wire, reusing the values cached on the forward pass. Both gradients came out negative, so both weights rose, and one update cut the loss by almost 40%.
Now Break It
Try this: In a deep sigmoid net the backward gradients shrink toward zero — early layers barely update.
Control: Depth slider with sigmoid activations
What happens: Vanishing gradients! In a deep sigmoid net the backward signal shrinks to nothing — early layers stop learning.
Where backpropagation is used
Backpropagation is the algorithm that makes training deep networks feasible: it efficiently computes how every weight in the network contributed to the final error, so gradient descent knows which direction to nudge each parameter. Popularized for neural networks by Rumelhart, Hinton, and Williams in 1986, it turned multilayer networks from theoretical objects into trainable systems and underlies essentially all modern deep learning, from image classifiers to large language models. Its key trick is reusing computation: rather than recalculating gradients independently for millions of parameters, it propagates error signals backward one layer at a time, so the cost of computing all gradients is comparable to a single forward pass. This efficiency is what makes training networks with billions of parameters practical.
The biggest misconception is that backpropagation is some mysterious learning force; it is simply the chain rule from calculus applied systematically across a network's layers, computing derivatives of the loss with respect to each weight. Another misconception is that backprop trains the network by itself, but it only computes gradients; a separate optimizer such as stochastic gradient descent or Adam uses those gradients to actually update the weights. A practical pitfall is that backpropagation inherits the vanishing and exploding gradient problems, since repeatedly multiplying many small or large derivatives through deep networks can shrink or blow up the signal, which motivates careful initialization, normalization, and architectures like residual connections.
Frequently asked questions
What is backpropagation?
Is backpropagation just the chain rule?
Does backpropagation update the weights?
Why does backpropagation need the forward pass first?
What are exploding and vanishing gradients in backpropagation?
Who invented backpropagation?
Written & reviewed by the ML Visualization team · Last updated .