How a neural network sends its errors home — and makes everything along the way a little better.
Fundamentals 12 min Expert June 1, 2026
You know about neurons, activation functions, layers, loss functions, and gradient descent. You know the network needs gradients to improve. But how does it compute the gradient for a weight buried 20 layers deep? The answer connects everything you've learned into one elegant mechanism — and it's built entirely on the chain rule from Path I.C.
Backpropagation is not a new invention. It is the systematic application of the chain rule to a neural network's computational graph — a bookkeeping method that makes gradient descent practical for deep networks.
1986 Papers
Backpropagation Algorithm
The birth of modern machine learning through an elegant training algorithm. In October 1986, David Rumelhart, Geoffrey Hinton, and Ronald Williams published the paper 'Learning representations by back-propagating errors' in Nature. This algorithm considerably changed the training of neural networks by providing an efficient method for adjusting weights in multi-layer networks. The procedure repeatedly adjusts the connection weights to minimize the difference between actual and desired output. The decisive innovation lay in the ability to train hidden layers that automatically recognize important features of the task. The mathematical foundations had already been derived earlier — by Paul Werbos (1974) and Seppo Linnainmaa (1970), among others — but it was this paper that made backpropagation widely known and convincingly demonstrated its effectiveness. Backpropagation became the workhorse of machine learning and today enables all modern deep learning applications.
The Complete Training Step
1
Forward Pass Input flows forward through all layers, producing a prediction and a loss value
2
Backward Pass The error signal flows backwards, the chain rule yields the gradient for every weight
3
Update Gradient descent adjusts each weight: w = w − lr · gradient
Backpropagation
AnalogyDefinition
Imagine a relay race in reverse. The forward pass is like runners carrying the baton from start to finish. The backward pass is like a coach walking backwards along the course, telling each runner exactly how to adjust their stride — each runner only needs the feedback from the next runner and their own local performance. The update is each runner actually making the adjustment.
Example
In a relay race, each runner physically adjusts their stride. In mathematics, the backward pass doesn't directly change the weights — it only computes gradients. The actual adjustment happens in the separate update step via gradient descent.
Analogy:
Imagine a relay race in reverse. The forward pass is like runners carrying the baton from start to finish. The backward pass is like a coach walking backwards along the course, telling each runner exactly how to adjust their stride — each runner only needs the feedback from the next runner and their own local performance. The update is each runner actually making the adjustment.
Example
In a relay race, each runner physically adjusts their stride. In mathematics, the backward pass doesn't directly change the weights — it only computes gradients. The actual adjustment happens in the separate update step via gradient descent.
Definition:
Backpropagation is the systematic, efficient application of the chain rule to a computational graph. It propagates the error signal backwards through the network layer by layer, computing every gradient exactly once by reusing intermediate results. It is not a separate learning algorithm — it is the bookkeeping method that makes gradient descent practical for deep networks.
A training step consists of three inseparable phases: forward pass (compute prediction), backward pass (compute gradients), and update (adjust weights). Backpropagation is the backward pass — nothing more, nothing less.
Worked Example: A 2-Weight Mini-Network
Input x = 2, weights w₁ = 0.5 and w₂ = 3.0, target y_true = 5. The network computes: h = x · w₁, then y = h · w₂. Loss: L = (y − y_true)².
Forward Pass
h = x · w₁ = 2 · 0.5 = 1 | y = h · w₂ = 1 · 3.0 = 3 | L = (y − yₜ)² = (3 − 5)² = 4
The network has learned: both weights were adjusted so the prediction will be closer to the target next time. The gradient for w₁ is six times larger than for w₂ — because the chain rule multiplies in the additional factors w₂ and x.
Misconception: Backpropagation Is a Separate Learning Algorithm
No! Backpropagation only computes gradients — by systematically applying the chain rule to the computational graph. The actual learning algorithm is gradient descent (or a variant like Adam), which uses these gradients to update the weights. Backpropagation without gradient descent learns nothing; gradient descent without backpropagation cannot efficiently compute the gradients.
The forward pass computes the prediction, the backward pass computes the gradients, the update step computes the new weights. This trio repeats thousands of times per training epoch — and that is exactly how a neural network learns.
Interactive: Forward & Backward Pass
You've worked through the training step on the mini-network. Now you can walk through it step by step: watch how values flow forward through the network, how gradients are computed backwards, and how the weights change at the end.
Step 1 / 8Setup
The mini-network has input x, two weights w₁ and w₂, and a target value. No computations have been performed yet.
x=2, w₁=0.5, w₂=3, target=5
The Chain Rule in Action — Layer by Layer Backwards
From 2 weights to N layers: the principle stays identical, only the chain gets longer. For a weight in the first layer of a deep network, the chain rule must be applied through ALL layers.
Backpropagation's efficiency comes from reuse: once the error signal for layer 2 is computed, it's stored. Layer 1 simply multiplies by its local derivative — no recomputation from the loss. Every partial derivative is computed exactly once and cached.
Sigmoid
Maximum derivative ≈0.25. With 10 layers: 0.25¹⁰ ≈ 0.00000095. The gradient vanishes — early layers stop learning entirely.
ReLU
Derivative is 0 or 1. For positive inputs, the gradient flows through unattenuated — no exponential decay.
Dead Neuron: When the Gradient Vanishes Forever
Concrete example: x = 1, w₁ = −2. Forward pass: z₁ = 1 · (−2) = −2. ReLU(−2) = 0. The local derivative of ReLU at −2 is exactly 0. No matter how large the error at the end of the network — as soon as the error signal flows through this ReLU node, it is multiplied by 0. The gradient for w₁ becomes 0, the weight is never updated. The neuron is permanently dead.
Misconception: Vanishing Gradients Mean the Network Has a Bug
No! Vanishing gradients are a mathematical inevitability when multiplying many small numbers. With 10 sigmoid layers, the gradient is reduced to less than one millionth — that's not a code error, it's mathematics. The solution is architectural (ReLU instead of sigmoid, residual connections, gradient clipping), not debugging.
Deep Dive: Modern Solutions for Gradient Flow
ReLU Family: ReLU passes gradients of 1 for positive values through unfiltered. Leaky ReLU and ELU also prevent dead neurons by allowing small gradients for negative inputs. Residual Connections: ResNet skip connections add a layer's input directly to its output, creating shortcut paths for gradient flow — even through hundreds of layers. Batch Normalization: Normalizes each layer's activations, stabilizing gradient distributions and accelerating training. Gradient Clipping: Caps gradients exceeding a threshold, preventing numerical instability from exploding gradients.
Interactive: Clickable Chain Rule
The chain rule decomposes the gradient into local derivatives. Click on the individual terms to see what each factor in the chain means — and how they combine to produce the gradient for w₁.
Chain rule for w₁
∂L∂w₁=∂L∂ŷ·∂ŷ∂h·∂h∂w₁
∂L/∂w₁
The total gradient: How much does the loss change when w₁ changes? This is the product of all local derivatives along the path.
Enough theory — get hands-on. Drag the weights, send the loss backward through the network one step at a time, and watch gradient descent shrink the error. This network has a ReLU activation: push it below zero and you will see a dead neuron in action.
Loading the Backprop Bench …
Autograd — Why You'll Never Do It by Hand
In practice, you never write backpropagation manually. Modern frameworks like PyTorch and TensorFlow include autograd — an automatic differentiation system that handles the entire backward pass for you.
PyTorch: A Complete Training Step
for epoch in range(100):
prediction = net(X_train)
loss = criterion(prediction, y_train)
optimizer.zero_grad() # Clear old gradients
loss.backward() # Backpropagation in ONE line
optimizer.step() # Gradient descent update
How does it work? While you code the forward pass, the framework silently builds a dynamic computational graph in the background. Every mathematical operation is recorded. When you call .backward(), the framework automatically traverses this graph in reverse, applying the chain rule at every node. This works for any differentiable computation — not just neural networks.
Yet autograd doesn't mean you can ignore the math. Three concrete scenarios where manual understanding is indispensable: (1) Debugging: When your loss plateaus, you need to diagnose vanishing gradients. (2) Architecture design: Choosing activation functions and skip connections depends on understanding gradient flow. (3) Custom layers: Writing custom autograd functions requires correct derivatives.
Misconception: Autograd Makes Math Understanding Obsolete
No! Autograd is the calculator, but you need to understand arithmetic to know when the calculator gives a wrong answer. Those who don't understand backpropagation are flying blind — they won't notice why their model isn't learning.
Deep Dive: Autograd Under the Hood
Dynamic vs. static graphs: PyTorch builds the computational graph fresh on every forward pass (dynamic). This allows Python control flow (if/else, loops) directly in the model. Old TensorFlow (v1) built the graph once before execution (static). Tape-based recording: Autograd "records" operations onto a tape. .backward() replays the tape in reverse. The .grad attribute: After .backward(), tensor.grad contains the computed gradient. requires_grad=True activates recording for a tensor. optimizer.zero_grad(): Gradients accumulate by default — without explicit clearing, gradients add up across iterations.
Key Takeaways
A training step is always Forward Pass → Backward Pass → Update. Backpropagation is the backward pass.
Backpropagation = chain rule on the computational graph. Each node computes one local derivative; the product of all local derivatives along a path gives the gradient for a weight.
Efficiency through reuse: every partial derivative is computed exactly once and cached.
Deep networks risk vanishing or exploding gradients. Modern solutions: ReLU, residual connections, gradient clipping.
Autograd automates gradient computation, but understanding the math remains essential for debugging and architecture design.
Learning Goals
Why is backpropagation described as an efficient application of the chain rule to a graph rather than a completely new mathematical approach?
How does repeated multiplication of local derivatives in very deep networks lead to vanishing gradients — and how does ReLU help?
Why is mathematical understanding of backpropagation still essential when frameworks like PyTorch fully automate gradient computation via .backward()?
Quiz: Backpropagation
Question 1 / 6
Not completed
What are the three phases of a complete training step in the correct order?
1. What are the three phases of a complete training step in the correct order?
☐ A) Update → Forward Pass → Backward Pass
☐ B) Forward Pass → Backward Pass → Update
☐ C) Backward Pass → Forward Pass → Update
☐ D) Forward Pass → Update → Backward Pass
2. In the mini-network example (x=2, w₁=0.5, w₂=3.0, y_true=5), the gradient for w₁ is −24. Why is this gradient much larger than the gradient for w₂ (−4)?
☐ A) w₁ is initialized smaller, so it needs a bigger push
☐ B) The chain rule multiplies additional factors (w₂=3 and x=2) when backpropagating to w₁, amplifying the gradient
☐ C) The loss function penalizes w₁ more than w₂
☐ D) w₁ is in an earlier layer, and earlier layers always have larger gradients
3. A neural network with 10 layers uses the sigmoid activation function (max derivative ≈0.25). Approximately how large is the gradient signal that reaches layer 1 from layer 10, relative to the signal at layer 10?
☐ A) About 0.25 (reduced by one factor)
☐ B) About 0.25¹⁰ ≈ 0.00000095 (nearly zero)
☐ C) About 10 × 0.25 = 2.5 (multiplied by depth)
☐ D) It stays the same because backpropagation preserves gradient magnitude
4. A colleague claims: "Since PyTorch computes all gradients automatically with loss.backward(), understanding the chain rule is no longer necessary for deep learning practitioners." Which scenario directly disproves this claim?
☐ A) When the loss function needs to be defined as a Python function
☐ B) When the learning rate needs to be tuned
☐ C) When the loss stops decreasing and the practitioner needs to diagnose whether vanishing gradients are the cause
☐ D) When the training data needs to be split into batches
5. A ReLU neuron receives input z = −3 during the forward pass. During the backward pass, the error signal arriving from the next layer is δ = 5.0. What gradient does this neuron pass backwards to its input weights?
☐ A) 5.0 (ReLU passes the signal through)
☐ B) −3 × 5.0 = −15.0 (input times error)
☐ C) 0 (ReLU derivative at negative input is 0)
☐ D) max(−3, 0) × 5.0 = 0 (same as forward pass)
6. A colleague proposes expanding a sigmoid-based network that already suffers from slow training to over a hundred layers. Evaluate whether this would improve or worsen the situation, and choose the best architectural alternative for such a deep network.
☐ A) It improves the situation because more layers give the network more capacity
☐ B) It worsens the situation. ReLU instead of sigmoid helps at moderate depth but alone is insufficient for hundreds of layers.
☐ C) It worsens the situation because more sigmoid layers amplify the vanishing gradient problem. Better: Add residual connections (skip connections) that create direct paths for gradient flow.
☐ D) It has no effect because batch normalization already solves the problem
Answer Key: 1) B · 2) B · 3) B · 4) C · 5) C · 6) C