Deep Learning Basics

Backpropagation is bookkeeping with consequences

5 min read

Backpropagation is often introduced as a sequence of nouns: forward pass, loss, gradient, update. The sequence is correct, but the nouns can make a small calculation sound like a hidden ceremony.

The mechanism is more ordinary. The forward pass produces intermediate values. The loss measures the prediction error. The backward pass follows the dependencies that produced that error. The optimizer uses those local changes to adjust the parameters.

It is bookkeeping, but the entries in the ledger determine what changes next.

start with what the forward pass left behind

Backpropagation needs the forward pass. It uses the values computed on the way to the prediction:

z = W x + b
a = ReLU(z)

Those intermediate values are not incidental. A negative pre-activation means ReLU produced zero, which changes the path available to the gradient. A large active value can carry a different amount of influence than a value that was clipped away.

The interactive module puts those values next to one another: inputs, weights, raw z values, activations, prediction, target, and gradients. Looking at them together gives the backward pass somewhere concrete to start.

loss turns a gap into a target for training

The model needs more than the observation that its answer was wrong. It needs a number that represents the error.

That number is the loss. A smaller prediction gap should generally produce a smaller loss; a larger gap should produce a larger one. The exact function can vary, but the training loop needs a scalar signal before it can ask what to change.

The useful question is not only:

How wrong was the output?

It is also:

Which earlier values made this output more likely?

Backpropagation answers the second question by tracing the calculation backward.

a gradient is a direction

A gradient describes how the loss changes when a value changes slightly. It is not a score for whether a weight is good or bad.

The familiar update rule is:

new_weight = old_weight - learning_rate * gradient

The gradient points toward increasing loss, so the subtraction points in the direction of decreasing loss. The learning rate controls the size of the move. A tiny rate can make progress difficult to see. A large rate can jump over useful values or make training unstable.

The same gradient can therefore produce a restrained adjustment or a damaging one, depending on the step size.

ReLU opens some paths and closes others

ReLU is simple in the forward pass: positive values pass through, negative values become zero. That decision also matters in the backward pass.

A unit that was active does not send the same gradient as a unit that was off. For a particular example, some paths through the network contributed to the prediction and others were blocked. The update is shaped by that actual path, not distributed evenly across every parameter.

This is why the activation values are worth inspecting. They show which parts of the network were available to learn from that example.

the chain rule follows the wiring

Suppose the loss depends on an output, the output depends on a hidden activation, and the hidden activation depends on a weight. The loss depends on that weight through each of those links.

The chain rule keeps those local relationships connected:

How did the loss change when the output changed?
How did the output change when this hidden value changed?
How did this hidden value depend on the earlier weight?

Backpropagation multiplies the relevant local derivatives while walking the graph in reverse. The advantage is reuse: the network does not need to recompute an entire forward pass independently for every parameter.

the update is local evidence, not a promise

The gradient describes the neighborhood around the current parameters. It does not guarantee that every example improves after one step. A batch may contain competing signals. The learning rate may overshoot. The data may reward behavior the product does not actually want.

Backpropagation follows the loss it is given. If the target or loss is poorly chosen, the system can optimize the wrong behavior very efficiently.

inspect one path at a time

The module is easiest to use as a debugging surface. Choose one weight, predict whether increasing it should raise or lower the loss, and then compare that prediction with the gradient. Check which hidden units were active and whether ReLU blocked the route.

Questions worth asking:

  • Which output was wrong?
  • Which hidden units contributed?
  • Which weights received the largest gradients?
  • Did an inactive ReLU block the path?
  • Does the update direction match the prediction?

When it does not match, follow the values backward. Backpropagation is not a fog machine. It is a dependency trail from the loss to the parameters, and a small network makes every turn in that trail inspectable.

Jeremy London

About Jeremy London

Engineering leader and builder in Denver. I write about AI platforms, agents, security, reliability, homelab infrastructure, and the parts of engineering work that have to survive production.