Skip to content
Lambdian

Backpropagation

The algorithm that computes every weight's gradient in a neural network with the chain rule.

After a forward pass, the error at the output is sent backwards through the network layer by layer. Each layer's error is the next layer's error multiplied by the transposed weights and the slope of the activation:

δ(l)=(W(l+1)⊤δ(l+1))⊙g′(z(l))\boldsymbol\delta^{(l)} = \big(W^{(l+1)\top}\boldsymbol\delta^{(l+1)}\big)\odot g'(\mathbf{z}^{(l)})

A weight's gradient is "error at its output times activation at its input". The backward pass costs about the same as the forward pass, which is what makes training networks with millions of weights practical.

See it in action