Training a neural network by gradient descent requires the gradient of the loss with respect to every weight and bias, often millions of them. Computing each partial derivative separately would be hopeless. Backpropagation computes all of them at once, in a single sweep backward through the layers, at a cost comparable to one evaluation of the network. It is the chain rule organized to reuse work, and it is what makes training deep networks feasible.
Fix an input x and its target y. The forward pass runs the network recurrence and records every intermediate quantity:
a0=x,zk=Wkak−1+bk,ak=σ(zk),L=ℓ(aL,y).
The loss L is a single scalar. We want the partial derivatives ∂Wk∂L and ∂bk∂L for every layer k, which together form the gradient that gradient descent steps along.
The quantity to propagate is the sensitivity of the loss to each layer’s pre-activation.
Once the adjoints are known, the weight gradients follow immediately; and the adjoints themselves satisfy a recurrence that runs from the output back toward the input.
The two passes mirror each other. The forward pass sends activations ak forward through the weight matrices Wk; the backward pass sends adjoints δk backward through their transposes Wk+1T, scaling by the local slope σ′(zk) at each layer. Each weight gradient is then the outer product of the adjoint arriving from the right with the activation arriving from the left.
Backpropagation is the special case of reverse-mode automatic differentiation applied to the network’s computation graph. The forward pass evaluates the graph and stores the intermediate values; the backward pass traverses the graph in reverse, accumulating the derivative of the single scalar output with respect to every node.
The widget below runs the forward and backward passes on a tiny network with one hidden unit. Black shows the forward pass: the values above each node and the weights on the edges. Accent shows the backward pass: the adjoints δ below each node and the weight gradients below each edge. Adjust a weight and watch both passes update, then take a gradient step and watch the loss fall as each weight moves opposite its gradient.
Black: the forward pass values carried left to right. Accent: the adjoints δ and the weight gradients carried right to left. Each weight gradient is the adjoint to its right times the activation to its left. Gradient step moves every weight by −0.25·∂L/∂w, and the loss L = 0.437 drops toward zero.
Every quantity the step uses is read off the graph: the gradient on each weight is the product of the adjoint at the node to its right and the activation at the node to its left, exactly the outer-product rule. Backpropagation is this bookkeeping carried out over the whole network at once.