Loading

Quipoin Menu

Learn • Practice • Grow

deep-learning / Backpropagation
tutorial

Backpropagation

Backpropagation is the algorithm that computes gradients of the loss with respect to all weights and biases in the network. These gradients are then used by gradient descent to update parameters. It is the chain rule applied efficiently.

Backpropagation = backward flow of errors. It propagates the loss gradient from the output layer back to the input layer.

Intuition

Imagine a team of workers in a chain. The last worker makes a mistake. He tells the previous worker how to adjust. That worker tells the previous, and so on. Backpropagation does the same: the output error is passed backward, and each layer computes how much it contributed to the error.

The Chain Rule

If loss L depends on weight w through intermediate values, the gradient ∂L/∂w = (∂L/∂output) × (∂output/∂w). Backpropagation uses this to compute gradients layer by layer.

∂L/∂w² = ∂L/∂ŷ * ∂ŷ/∂z² * ∂z²/∂w²
∂L/∂w¹ = ∂L/∂a¹ * ∂a¹/∂z¹ * ∂z¹/∂w¹, etc.

Steps in Backpropagation

1. Forward pass: compute all activations and loss.
2. Compute gradient of loss with respect to output layer.
3. Propagate gradients backward using the chain rule.
4. Compute gradients for all weights and biases.
5. Use optimizer (e.g., SGD) to update weights.

You Don't Need to Derive It Manually

Deep learning frameworks (PyTorch, TensorFlow) compute gradients automatically using autograd. Understanding backpropagation helps debug issues like vanishing gradients.


Two Minute Drill
  • Backpropagation computes gradients using the chain rule.
  • Error flows backward from output to input.
  • Gradients are used by optimizers to update weights.
  • Frameworks automate backpropagation (autograd).

Need more clarification?

Drop us an email at career@quipoinfotech.com