Backpropagation Visualizer

Watch gradients flow backward through a small neural network using the chain rule — every calculation shown live.

Advertisement
ℹ️This shows a full forward pass followed by backpropagation of the error for a simple 2→2→1 network with a target output value.
Predicted Output
Loss (MSE)
0Updates Applied
Chain Rule Trace
Advertisement

What Backpropagation Actually Computes

Backpropagation is the algorithm that tells a neural network how to adjust each individual weight to reduce the overall loss. It works backward from the output layer to the input layer, using the chain rule from calculus to compute exactly how much each weight contributed to the final error. Click "Apply One Update Step" above and watch both the network's edge colors change (reflecting updated weights) and the trace panel show the exact chain rule calculation happening at each layer.

Why the Chain Rule Is the Whole Trick

The loss depends on the output, the output depends on the second-layer weights and the hidden activations, and the hidden activations depend on the first-layer weights. The chain rule lets you compute how a change in any early weight ripples all the way through to affect the final loss, by multiplying together the local derivatives at each step along that path, exactly what the trace panel shows: δ_output gets computed first, then used to compute δ_hidden, then used to compute the actual weight gradients. This backward chaining of local derivatives is the entire mechanical essence of backpropagation, nothing more mysterious than repeated application of a calculus rule you likely learned in a first calculus course, applied systematically across every connection in the network.

Why It's Called "Backward" Propagation

Notice the calculation order in the trace: it computes the output layer's error first, then works backward to the hidden layer, this is the opposite direction from the forward pass, which flows input → hidden → output. This backward flow is necessary because computing the gradient for an early weight requires knowing how much the loss changed due to everything downstream of it, information that's only available once you've already computed the error at the output and propagated it backward layer by layer.

Why This Scales to Networks With Billions of Parameters

This visualization backpropagates through just 2 layers with a handful of weights, but the identical algorithm, computing local gradients and chaining them backward via the chain rule, is exactly what trains every modern deep learning model, including large language models with billions of parameters across dozens of layers. Modern frameworks like PyTorch and TensorFlow implement this automatically through "automatic differentiation," but the underlying math is precisely what you're watching computed by hand in the trace panel above, just applied at a scale that would be impossible to trace manually.

Why Learning Rate Still Matters Here

Try setting a very high learning rate and applying several update steps, you may see the loss oscillate or even increase rather than steadily decrease, the same overshooting behavior covered in our Gradient Descent Visualizer. Backpropagation computes the gradient correctly, but it's gradient descent, using that gradient to actually update the weights, that determines whether training converges smoothly or destabilizes, backpropagation and gradient descent are two distinct, complementary pieces of the training process, not the same algorithm.