What is backpropagation in a neural network, and what roles do the forward pass and the backward pass play during training?
Deep learning, Backpropagation
Level L1 Beginner. Length Short. Nature Th Theoretical.
What's being asked
Whether you understand how a neural network assigns blame for its errors across layers before computing chain-rule derivatives by hand.
Key idea
Backpropagation (short for backward propagation of errors) is an efficient algorithm that uses the calculus chain rule to compute how much each weight in a network contributed to the final loss. It works in two stages: a forward pass that computes the prediction and loss while saving intermediate activations, followed by a backward pass that sends error signals from the output back to the first layer.
Steps
- Explain the forward pass: feed an input batch through the network layer by layer to produce a prediction and measure the loss against the true target , caching each layer's intermediate values for the return trip.
- Explain the backward pass: starting at the loss , apply the chain rule layer by layer in reverse to find each weight's gradient (how much nudging that weight changes the error).
- Give the intuition behind going backward: like a relay race or team review, you first see how wrong the final score is, then pass credit or blame one step back at a time instead of re-running the whole network once per weight.
- Separate gradient calculation from weight updates: backpropagation only computes the gradients ; an optimiser such as stochastic gradient descent (SGD) or Adam then uses those gradients to actually update the weights.
Common mistakes
- Calling the weight update step itself backpropagation; backprop only computes gradients, while gradient descent (or Adam) updates the weights.
- Forgetting why intermediate forward activations must be stored in memory during training: local derivatives in the backward pass depend on the values computed on the way forward.
How long your answer should be
About 2 minutes: define backprop, contrast forward vs backward pass, and separate it from the optimiser.
Read this
Previous in Deep learning: Why can a deep network with no non-linear activation functions represent nothing more than a single linear (affine) layer?
Next in Deep learning: A neural network is trained on 2000 labelled examples with a batch size of 50. What are an epoch, a batch and an iteration, and how many iterations make up one epoch?