All labs

Backpropagation, One Edge at a Time

A tiny network with every forward value and every gradient shown on the graph.

Ch 14 14.2
Animator
Deep Learning
25 mindifficulty 4/5

Controls

Hidden activation
2
3
Training example (x1, x2 → y)
0.800
20

Computational graph

Stage 1 / 7: forward through layer 1

w=-1.04w=0.42w=-0.07w=-0.93w=0.05w=-0.55w=0.40w=0.03w=0.06w=-0.42w=-0.52w=-0.35w=-0.60w=-0.23w=0.83w=0.65w=-0.54w=-0.62010.32z=-0.740.50z=0.010.37z=-0.53????
forward pass (active)backward pass (active)selected edge

Loss for this example: not yet computed — step forward to the output. Click any edge to inspect its weight and gradient below.

Training loss

0 gradient-descent steps taken so far (full-batch).

00.050.100.150.200.250.300246810stepmean loss

Gradient magnitude by layer

Mean |∂L/∂w| per weight matrix, this example — watch it shrink toward the input with sigmoid and depth.

00.010.020.030.040.050.060.0700.5011.5022.503[0, 1) n=0.001669179761092169[1, 2) n=0.008439954929943864[2, 3) n=0.06477898661805064layer (input → output)mean |∂L/∂w|

Finite-difference check

Central-difference numerical gradient versus the analytic backprop gradient for every edge in one layer.

edgeanalytic ∂L/∂wfinite-difference|difference|
unit 0 → unit 0000
unit 1 → unit 0-0.00160-0.001601.27e-12
unit 0 → unit 1000
unit 1 → unit 1-0.00192-0.001921.45e-12
unit 0 → unit 2000
unit 1 → unit 20.006500.006504.73e-12
Output activation ŷ
0.4082
target y = 1
Loss, this example
0.1751
Mean training loss
0 steps
Weight matrices
3
2 → 3 → 3 → 1
Backpropagation is not the learner

Backpropagation is only the chain rule applied edge by edge through the graph: it produces every ∂L/∂w number shown above. It never decides how far to move a weight. That decision — subtract η times the gradient — is gradient descent, a separate step applied after backpropagation finishes. Swap gradient descent for Adam or RMSProp and every gradient computed here is unchanged; only the update rule differs.