Index Ai Academy

Backpropagation, step by step

Run a tiny network forward, then watch blame flow backward through it, one multiplication at a time.

A network can have billions of weights, and training needs to know how each one affects the loss. Backpropagation gets all of those answers in one backward pass. It's the chain rule from calculus, applied from the output back to the start, and it's small enough to follow by hand.

Press Next through the forward pass and then the backward pass. Then update the weights and go again: the loss really falls.

What you just saw

The forward pass computes each value and remembers it. The backward pass starts with the loss and works toward the inputs. At each step it multiplies by the local slope, the amount that step's output changes when its input does. By the end, each weight has a number saying how much the loss would change if that weight moved. Training then nudges each weight the other way.

Why deep networks were hard to train

Those multiplications add up. If each layer's slope is below 1, the blame shrinks at every layer on its way back, and early layers barely learn. If it's above 1, the blame grows out of control.

Sigmoid's slope is at most 0.25, so with 16 layers the blame shrinks to almost nothing. Try 1, then 1.2.

One fix

A skip connection adds a path whose slope is exactly 1, so blame has a clear way back. It's one of the main reasons very deep networks can be trained.

Thirty plain layers lose almost all the gradient. With skip connections, it arrives intact.

Learn how this works, properly

A free account opens all 244 lessons, with Python that runs in your browser, saved progress and certificates.

Create a free account