What is Backpropagation?
The training computation that propagates the error between output and target backward from output to input to obtain each weight's gradient.
Japanese name: 逆伝播
The training computation that propagates the error between output and target backward from output to input to obtain each weight's gradient.
Japanese name: 逆伝播
Training starts with a forward pass that computes the output and a loss measuring its error against the target. Backpropagation then applies the chain rule in reverse: starting from the loss, each layer receives the gradient with respect to its output and computes two things, the gradient with respect to its weights and the gradient with respect to its input, which it passes to the previous layer. For a fully connected layer, the weight gradient combines the incoming gradient with the input activations saved during the forward pass. An optimizer then nudges each weight against its gradient.
Frameworks represent a model as a computational graph, with operations such as matrix products, additions and activations as nodes and tensors as edges. Because each node knows its own local derivative, the framework can traverse the graph backward and compute all gradients automatically, a technique called reverse-mode automatic differentiation. The graph also exposes which operations are independent. Inference runtimes such as TensorRT or ONNX Runtime drop the bookkeeping needed for backpropagation, then fuse operations, lower precision where needed and pick hardware-specific kernels, which is why they run faster than the training framework used for inference.
The backward pass costs about twice the forward pass, because each layer computes gradients for both its inputs and its weights. A forward pass is about 2N operations per token for N parameters, so training costs about 6N per token, or 6ND for D tokens; a 7-billion-parameter model on 1 trillion tokens needs about operations. Memory grows even more: training stores intermediate activations, gradients equal in number to the weights, and optimizer state such as Adam's two moving averages. Gradient checkpointing saves only some activations and recomputes the rest, costing roughly one extra forward pass.
Gradients are often tiny. FP16 (1 sign, 5 exponent, 10 significand bits) covers positive values from only about , including subnormals, up to 65504, so many gradients underflow to zero and learning stalls. Loss scaling multiplies the loss by a factor such as 1024 before backpropagation, lifting gradients into range, and divides it back out before the weight update. Mixed-precision training usually also keeps a higher-precision master copy of the weights. BF16, with 8 exponent bits like FP32, has a much wider range and rarely needs loss scaling.
Answer: B. Spiking is a discontinuous operation decided by whether a threshold is crossed, so it is not differentiable
Each SNN neuron accumulates incoming spikes as a membrane potential and emits a spike when it crosses a threshold. Because this output switches discontinuously between 0 and 1, the gradient that backpropagation needs is zero almost everywhere or undefined. Workarounds therefore include using, only during training, gradients that approximate the spike function with a smooth function, or training a conventional network and converting it into an SNN.
Backpropagation computes the gradient of the loss with respect to every weight. Gradient descent, or another optimizer such as Adam, uses those gradients to update the weights.
Training must keep forward activations for the backward pass, plus a gradient for every weight and optimizer state, while inference needs only the weights and transient activations.
Roughly twice as expensive, so one training step costs about three forward passes, which is the origin of the 6N operations-per-token rule of thumb.
Backpropagation appears in 8 practice questions across 2 topics, including AI Hardware & Software Stack, Computer Arithmetic.
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.