VIZRA BLOG · Batch 2 · Machine Learning & Advanced AI · ARTICLE 13 OF 20

Gradient Descent and Backpropagation Explained

Every modern neural network—from compact vision classifiers to 400-billion-parameter language models—learns through a quiet partnership between two mathematical ideas: gradient descent to choose the direction of improvement, and backpropagation to compute that direction across millions of layered equations. This deep dive traces their 180-year lineage, walks through the calculus and software engineering that make them scale, and examines the challengers trying to replace them.

The Invisible Engine of Machine Intelligence

When a large language model drafts working code, or a structural biology network predicts the three-dimensional fold of a protein down to atomic resolution, the finished artifact looks almost effortless. Beneath that fluency lies a relentless numerical grind. Training a modern neural network means adjusting hundreds of millions—or hundreds of billions—of floating-point numbers called weights so that the network's predictions gradually stop being wrong. Doing that by trial and error is mathematically hopeless: a model with even a few million parameters lives in a space so vast that random search would outlast the age of the universe without stumbling onto a coherent solution.

Historical Lineage: From Celestial Mechanics to Error Backpropagation

Neither gradient descent nor backpropagation was born inside an artificial intelligence lab. Both emerged from older struggles in astronomy, statistics, numerical analysis, and optimal control—and both waited decades before computer hardware caught up to their implications.

The Geometry of Learning: Loss Landscapes, Gradients, and the Multivariate Chain Rule

To see why gradient descent and backpropagation fit together so cleanly, it helps to translate a neural network into geometry. Suppose a model has p trainable parameters—weights and biases—stacked into a single vector θ = (θ1, θ2, …, θp) ∈ ℝp. For any input x, the network outputs a prediction ŷ = f(x; θ). A loss function L(θ) measures the discrepancy between those predictions and the ground-truth targets y across a dataset (for instance, mean squared error for regression or cross-entropy loss for classification and next-token prediction).

Gradient Descent in Practice: Batch, Stochastic, and Mini-Batch Regimes

In textbook optimization, computing the exact gradient ∇θ L(θ) requires averaging the loss over every single training example in the dataset N:

Navigating Curvature: Momentum, Adaptive Optimizers, and Learning Rate Schedules

Plain mini-batch SGD treats every parameter identically and reacts only to the current mini-batch's slope. In real neural network landscapes, that simplicity runs into trouble. Loss valleys are rarely circular bowls; they are frequently long, narrow ravines where the slope is steep across the canyon walls and almost flat along the canyon floor. Standard SGD bounces back and forth between the steep walls while making agonizingly slow progress down the ravine.

Reverse-Mode Automatic Differentiation: How Backpropagation Actually Computes Gradients

If gradient descent is the steering wheel, backpropagation is the engine under the hood. To appreciate why reverse-mode automatic differentiation (AD) is so indispensable, it helps to contrast it with the two naive alternatives for computing derivatives on a computer [7]:

Pathologies of Depth: Vanishing Gradients, Exploding Gradients, and Saddle Points

If backpropagation computes exact gradients, why did deep neural networks fail to train reliably for nearly twenty years after 1986? The answer lies in what happens when you multiply dozens of Jacobian matrices together along a deep chain rule.

Engineering Reality: Autograd in PyTorch and JAX, and Industry Case Studies

Today, almost no machine learning engineer derives backpropagation equations by hand. Instead, modern frameworks compile and execute reverse-mode AD automatically—though they take strikingly different architectural philosophies to do it.

Advantages, Limitations, and the Biological Plausibility Question

Backpropagation paired with adaptive gradient descent remains unbeaten for general-purpose deep learning because it delivers exact, low-variance gradients in O(1) passes relative to parameter count, scales predictably across thousands of accelerators, and works identically for images, text, audio, and physical simulations.

Current Developments and Future Outlook

Every modern neural network—from compact vision classifiers to 400-billion-parameter language models—learns through a quiet partnership between two mathematical ideas: gradient descent to choose the direction of improvement, and backpropagation to compute that direction across millions of layered equations. This deep dive traces their 180-year lineage, walks through the calculus and software engineering that make them scale, and examines the challengers trying to replace them.

Frequently Asked Questions

Key technical questions answered in Gradient Descent and Backpropagation Explained:

What is the difference between gradient descent and backpropagation?
Gradient descent is an optimization algorithm that updates a model's weights by stepping in the opposite direction of the loss function's gradient. Backpropagation is the differentiation algorithm— specifically reverse-mode automatic differentiation—that efficiently computes those exact gradients across every layer of a neural network using the chain rule [7].
Why does deep learning use reverse-mode automatic differentiation instead of forward-mode?
Forward-mode automatic differentiation requires one pass per input parameter, whereas reverse-mode requires one pass per output [7]. Because neural network training minimizes a single scalar loss (m = 1) with respect to millions or billions of parameters (n ≫ 1), reverse-mode computes all gradients in a single backward pass rather than billions of passes.
Why is AdamW preferred over standard Adam for training Transformers and LLMs?
In standard Adam, L2 regularization gets mixed into the gradient and divided by the adaptive second-moment denominator, which unintentionally weakens regularization on weights with large gradients [11]. AdamW decouples weight decay from the adaptive gradient step, applying consistent regularization across all parameters and improving generalization [11].
What causes vanishing and exploding gradients, and how do modern networks prevent them?
Both problems arise from repeatedly multiplying layer Jacobians during the backward pass across many layers or sequence steps [14]. Modern architectures prevent them using residual skip connections that create direct gradient pathways [16], non-saturating activations like ReLU/GELU, normalization layers (BatchNorm or LayerNorm) that smooth the loss landscape [18], [19], and gradient norm clipping to cap sudden spikes [15].
Are local minima still the biggest obstacle in training deep neural networks?
No. Research by Dauphin et al. (2014) demonstrated that in high-dimensional non-convex landscapes, bad local minima are exponentially rare; instead, saddle points—where the surface slopes upward in some directions and downward in others—are the dominant geometric obstacle that slows optimization [20].
What is activation checkpointing, and why is it needed for large models?
Reverse-mode backpropagation normally caches every layer's forward activations in GPU memory until the backward pass finishes, causing memory to grow linearly with depth. Activation checkpointing saves activations only at selected intervals and recomputes the intermediate values on demand during the backward pass, reducing activation memory from O(n) to O(√(n)) at the cost of roughly one extra forward pass [22].
Does the human brain use backpropagation?
Neuroscientists and AI researchers generally agree that the brain does not implement textbook backpropagation, primarily because biological synapses lack a known mechanism to copy exact forward weight matrices onto backward feedback pathways (the weight transport problem) and do not freeze inference to run global backward passes [29]. However, the brain may approximate gradient-like credit assignment through local mechanisms such as predictive coding or equilibrium dynamics [29], [31].
Can alternatives like Forward-Forward or MeZO replace backpropagation today?
Not for pre-training frontier models from scratch. Hinton's Forward-Forward algorithm [30] and Equilibrium Propagation [31] remain active research directions suited to future analog hardware, while zeroth-order methods like MeZO are already practical for memory-efficient fine-tuning of pre-trained language models on single GPUs [32].

Primary Sources

35 verified primary references cited in this monograph:

  • [1] Méthode générale pour la résolution des systèmes d'équations simultanées — Augustin-Louis Cauchy (Comptes Rendus de l'Académie des Sciences, Vol. 25, pp. 536–538). Publication Date: October 1847. URL: Type: Original Scientific Paper / Bibliographic Record) (https://cir.nii.ac.jp/crid/1573668925829538688?lang=en)
  • [2] A Stochastic Approximation Method — Herbert Robbins & Sutton Monro (The Annals of Mathematical Statistics, Vol. 22, No. 3, pp. 400–407). Publication Date: September 1951. URL: (Source Type: Peer-Reviewed Journal Paper) (https://projecteuclid.org/journals/annals-of-mathematical-statistics/volume-22/issue-3/A-Stochastic-Approximation-Method/10.1214/aoms/1177729586.full)
  • [3] Some Methods of Speeding Up the Convergence of Iteration Methods — Boris T. Polyak (USSR Computational Mathematics and Mathematical Physics, Vol. 4, No. 5, pp. 1–17). Publication Date: 1964. URL: Type: Peer-Reviewed Journal Paper) (https://papers.baulab.info/papers/also/Polyak-1964.pdf)
  • [4] Taylor Expansion of the Accumulated Rounding Error — Seppo Linnainmaa (BIT Numerical Mathematics, Vol. 16, No. 2, pp. 146–160; extending his 1970 University of Helsinki M.Sc. thesis). Publication Date: June 1976. URL: Type: Peer-Reviewed Journal Paper) (https://papers.baulab.info/papers/also/Linnainmaa-1976.pdf)
  • [5] Beyond Regression: New Tools for Prediction and Analysis in the Behavioral Sciences — Paul John Werbos (Harvard University Ph.D. Thesis). Publication Date: November 1974. URL: (Source Type: Doctoral Dissertation) (https://gwern.net/doc/ai/nn/1974-werbos.pdf)
  • [6] Learning Representations by Back-Propagating Errors — David E. Rumelhart, Geoffrey E. Hinton, & Ronald J. Williams (Nature, Vol. 323, pp. 533–536). Publication Date: October 9, 1986. URL: (Source Type: Peer-Reviewed Journal Paper) (https://www.nature.com/articles/323533a0)
  • [7] Automatic Differentiation in Machine Learning: a Survey — Atılım Güneş Baydin, Barak A. Pearlmutter, Alexey Andreyevich Radul, & Jeffrey Mark Siskind (Journal of Machine Learning Research, Vol. 18, No. 153, pp. 1–43). Publication Date: April 2018. URL: (Source Type: Peer-Reviewed Survey Paper) (https://jmlr.org/papers/v18/17-468.html)
  • [8] On the Importance of Initialization and Momentum in Deep Learning — Ilya Sutskever, James Martens, George Dahl, & Geoffrey Hinton (Proceedings of the 30th International Conference on Machine Learning, PMLR 28). Publication Date: 2013. URL: (Source Type: Peer-Reviewed Conference Paper) (https://proceedings.mlr.press/v28/sutskever13.html)
  • [9] Lecture 6.5 — RMSProp: Divide the Gradient by a Running Average of Its Recent Magnitude — Tijmen Tieleman & Geoffrey Hinton (Neural Networks for Machine Learning, University of Toronto / Coursera). Publication Date: 2012. URL: Type: Academic Lecture) (https://www.youtube.com/watch?v=defQQqkXEfE)
  • [10] Adam: A Method for Stochastic Optimization — Diederik P. Kingma & Jimmy Ba (arXiv:1412.6980; ICLR 2015). Publication Date: December 22, 2014. URL: Type: Conference Paper / arXiv Preprint) (https://arxiv.org/abs/1412.6980)
  • [11] Decoupled Weight Decay Regularization — Ilya Loshchilov & Frank Hutter (arXiv:1711.05101; ICLR 2019). Publication Date: November 14, 2017 (revised January 2019). URL: (Source Type: Conference Paper / arXiv Preprint) (https://arxiv.org/abs/1711.05101)
  • [12] SGDR: Stochastic Gradient Descent with Warm Restarts — Ilya Loshchilov & Frank Hutter (arXiv:1608.03983; ICLR 2017). Publication Date: August 13, 2016. URL: (Source Type: Conference Paper / arXiv Preprint) (https://arxiv.org/abs/1608.03983)
  • [13] Accurate, Large Minibatch SGD: Training ImageNet in 1 Hour — Priya Goyal, Piotr Dollár, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, & Kaiming He (Facebook AI Research, arXiv:1706.02677). Publication Date: June 8, 2017. URL: (Source Type: Technical Report / arXiv Preprint) (https://arxiv.org/abs/1706.02677)
  • [14] Learning Long-Term Dependencies with Gradient Descent Is Difficult — Yoshua Bengio, Patrice Simard, & Paolo Frasconi (IEEE Transactions on Neural Networks, Vol. 5, No. 2, pp. 157–166). Publication Date: March 1994. URL: Type: Peer- Reviewed Journal Paper) (https://pubmed.ncbi.nlm.nih.gov/18267787/)
  • [15] On the Difficulty of Training Recurrent Neural Networks — Razvan Pascanu, Tomas Mikolov, & Yoshua Bengio (ICML 2013; arXiv:1211.5063). Publication Date: November 21, 2012 (revised February 2013). URL: Type: Conference Paper / arXiv Preprint) (https://arxiv.org/abs/1211.5063)