esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

What Is Backpropagation?

What backpropagation is, how it finds which weights to blame, why deep networks can stall, and how to explain it simply for your AI interview.

In short

Backpropagation is how a neural network learns from its mistakes. It sends the error from the output back through every layer, so each weight learns how much it caused the miss, and the weights are nudged to reduce it.

11 min readIntermediateVery common · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

Backpropagation is how a neural network learns. It runs a prediction forward, measures how wrong it was, then sends that error backward through every layer to work out how much each weight contributed. Each weight moves a small step to reduce the error. Libraries like PyTorch do the calculation for us. The idea underneath is the chain rule from calculus, applied one layer at a time, which makes training multi-layer networks feasible.

What is backpropagation, in plain words?

A neural network makes a guess, finds out how wrong it was, and changes its weights so the next guess is a little better. Backpropagation is the step that works out which weights to change, and by how much.

Picture a credit analyst at a bank reviewing a loan that went bad. She traces the decision back through each check and asks how much each step pushed the outcome the wrong way. Backpropagation does the same for a network, one layer at a time.

A real case: a bank's default model scores a borrower as high risk, and the borrower repays on time. Training finds the weights that pushed that score up and moves them down a little. The numbers here are made up, but the job is the same.

Key words

Weight
A number inside the model that inputs are multiplied by. Training changes it.
Loss
One number for how wrong a prediction was. Lower is better.
Forward pass
The input goes through the layers to a prediction.
Backward pass
The error goes back through the layers, and each weight gets its share of the blame.
Learning rate
How big a step each weight takes once backpropagation has found its direction.

Backpropagation runs during training. A finished model that answers a customer does not run it on each chat.

How does backpropagation work, step by step?

Each training round has two halves. The forward pass makes the predictions. The backward pass uses the error to work out each weight's share of the blame, and the weights are then updated.

The chain rule is a calculus rule for passing a change along a chain of steps. Backpropagation uses it on the backward pass: when an output depends on a value that depends on a weight, the small effects multiply along the path.

  • “Backpropagation is the most common training algorithm for neural networks.”

    Google, Machine Learning Crash Course

  • “In calculus terms, backpropagation implements the chain rule.”

    Google, Machine Learning Glossary

One round of training

Batch of claims

past claims with known settle times

Forward pass

the model makes predictions

Loss

how far each prediction missed

Backward pass

blame for each weight, chain rule

New weights

each nudged by the learning rate

  1. 1The batch of past claims goes into the model.
  2. 2Each prediction is compared with the real answer.
  3. 3The miss is passed back through every layer.
  4. 4Each weight moves a small step to reduce the miss.
  5. 5The next batch runs through the updated model.
One round of training, left to right. The model's miss goes back through its layers, every weight is nudged, and the next batch starts from the new weights. Orange is the miss, blue the blame and green the new weights.
  1. 1

    Forward pass

    The model takes a batch of past claims and makes a prediction for each one.

  2. 2

    Measure the loss

    Each prediction is compared with the real answer, giving one number for the miss.

  3. 3

    Backward pass

    The chain rule passes the miss back through each layer, so every weight gets its share of the blame.

  4. 4

    Update the weights

    Each weight moves a small step, sized by the learning rate, to reduce the loss. Then the next batch starts.

A gradient is the answer for one weight: if this weight moves up a little, does the loss go up or down, and by how much?

What does one round look like with real numbers?

Here is one weight and one bias, small enough to check by hand. The model predicts how many days a claim takes to settle. The made-up claim is $4,000, shown as 4 in thousands, and it really took 9 days. The model starts with a weight of 1.5 and a bias of 0.5.

Python
# A claims model predicts how many days a claim takes to settle (made-up numbers).
# One input, one weight, one bias. A $4,000 claim really took 9 days.
x, target = 4.0, 9.0
w, b, lr = 1.5, 0.5, 0.05

def loss(w, b):
    pred = w * x + b
    return (pred - target) ** 2  # squared miss: big misses cost more

# Backward pass, by hand, with the chain rule
pred = w * x + b
d_loss_d_pred = 2 * (pred - target)  # how the loss moves as the prediction moves
d_loss_d_w = d_loss_d_pred * x       # a change in w moves the prediction by x
d_loss_d_b = d_loss_d_pred * 1.0     # a change in b moves the prediction one for one

# Check: nudge w a tiny bit and measure how the loss changes
eps = 1e-6
numeric = (loss(w + eps, b) - loss(w, b)) / eps
print("loss:", round(loss(w, b), 2))
print("backprop gradient for w:", round(d_loss_d_w, 3))
print("nudge check for w:", round(numeric, 3))

# One update: move each weight against its gradient
w = w - lr * d_loss_d_w
b = b - lr * d_loss_d_b
print("after one update: w =", round(w, 2), "b =", round(b, 2))
print("new loss:", round(loss(w, b), 2))

Output

loss: 6.25
backprop gradient for w: -20.0
nudge check for w: -20.0
after one update: w = 2.5 b = 0.75
new loss: 3.06

The first printed line is the loss. The model predicts 6.5 days, a miss of 2.5 days, so the squared loss is 6.25. The gradient is negative, so raising the weight lowers the loss. The nudge check agrees with the backprop number, which is how engineers test gradient code. After one update, the loss falls from 6.25 to 3.06.

Normal training does not run the nudge check. It is a debugging tool. The backward pass gets every gradient by reusing work from each layer, which is why the chain rule is worth knowing.

Why can deep networks stop learning?

Blame has to travel back through every layer. The early layers get the signal last, after it has been multiplied by many small slopes. Google's course describes the trap.

  • “In deep networks (networks with more than one hidden layer), computing these gradients can involve taking the product of many small terms.”

    Google, Machine Learning Crash Course

  • “Layers with vanishing gradients train very slowly, or not at all.”

    Google, Machine Learning Crash Course

Where the signal shrinks

Blame passed back

Last layer

gets the full error signal

Middle layer

gets it multiplied by a slope

First layer

a product of many small terms

Early layers stall

their weights barely change

  1. 1The error is passed back one layer.
  2. 2Another slope multiplies in, so the signal shrinks.
  3. 3Near the input the signal is almost gone.
Blame flows down the stacked layers. When each layer's slope is small, it shrinks at each step, so little is left by the input layer. Blue marks the strong signal and orange the stalled one.

Google's course names fixes for each problem. The ReLU activation function, which passes positive numbers and blocks negative ones, can help prevent vanishing gradients. Batch normalisation, which keeps each layer's numbers in a steady range, or a lower learning rate, can help prevent exploding gradients.

Tip

If a model stalls, check the gradients layer by layer before you change the data. The layer numbers show where the signal died.

How would you debug a deep model that stopped learning?

Say a 30-layer model that reads claim documents has a loss that flattens after its first week. I would start with the numbers, not the code.

  1. 1

    Read the gradients by layer

    If the input layer's gradients are near zero and the output's are not, the signal is vanishing. Check that first.

  2. 2

    Change one thing at a time

    For vanishing gradients, try ReLU activations first. If the gradients blow up instead, lower the learning rate or add batch normalisation. Keep whatever helps.

  3. 3

    Check the labels

    A stall can also come from wrong labels in the training data, so verify a sample of past claims before blaming the maths.

What does the interviewer want to hear?

A strong answer covers

  • Backpropagation finds the gradient of the loss for every weight, using the chain rule.
  • The loop: forward pass, loss, backward pass, weight update, repeated over batches.
  • Backprop computes the gradients. Gradient descent uses them to update the weights.
  • Vanishing and exploding gradients, with one or two fixes.
  • Frameworks such as PyTorch compute it, so you know what they do and how to debug them.
  • Backprop runs in training only. A finished model answering questions runs none of it.

Common traps

  • Trap"Backpropagation is how the model learns from every chat."

    BetterIt runs during training and adjusts weights. A finished model answering a chat runs no training.

  • Trap"Backpropagation and gradient descent are the same thing."

    BetterBackprop computes the gradients. Gradient descent uses them to move the weights.

  • Trap"I would work out every derivative by hand."

    BetterFrameworks such as PyTorch and Keras compute it. Know what it does and how to debug it.

Can you spot the vanishing gradients?

Read the training log

A 30-layer model that reads claim documents has stalled. Which log line shows vanishing gradients near the input?

Quick check

Your claims model is retrained every week. Which step is backpropagation?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q415What is gradient descent?12 min
  2. Q417What does the learning rate do?Coming soon
  3. Q419MSE vs cross-entropy loss?11 min
  4. Q426Vanishing and exploding gradients?Coming soon
  5. Q427What is batch normalisation?Coming soon
  6. Q438Why does weight initialisation matter?Coming soon

Learn it in depth

Last updated on 26 November 2026

Building a model that has to learn from messy business data?

I design and build AI products and agents, including the interface and the system behind them. Book a short call and tell me what your model needs to learn and what it must never get wrong.