AI Backpropagation Tutorial: How Gradients Flow

TL;DRBackpropagation efficiently computes the gradient for every weight via the chain rule.

To do gradient descent in a deep net, you need each weight's gradient. Backprop computes them in one backward pass: run the input forward to get the loss, then propagate the error backward layer by layer using the chain rule, reusing intermediate results. It's what makes training deep networks computationally feasible — the algorithm that powers all modern deep learning.

Key points

Common mistakes

Try it: Describe the forward-then-backward flow of one training step.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>forward:  input → layers → prediction → loss
backward: loss → gradients back through layers (chain rule)
update weights → repeat</pre></body></html>
Open the interactive lesson →
Gradient Descent · The Optimizer Learning Rate · The Most Important Knob