Gradient Descent
Gradient descent is a first-order iterative optimization algorithm that locates local minima of differentiable objective functions by updating parameters along the negative direction of the local gradient.
Gradient descent (also known as steepest descent) is a first-order iterative optimization algorithm in computation and algorithms designed to find local or global minima of a differentiable scalar objective function L(θ) defined over a parameter space θ ∈ Rd. Introduced by French mathematician Augustin-Louis Cauchy in 1847 to solve nonlinear equations governing astronomical orbital mechanics, the method exploits the geometric property that the gradient vector ∇L(θ) points in the direction of greatest local rate of increase of L. By stepping in the opposite direction—along the negative gradient −∇L(θ)—each iteration reduces the objective value whenever the learning rate η is appropriately bounded. In contemporary scientific computing, stochastic and adaptive variants of gradient descent serve as the primary parameter-fitting engines for high-dimensional statistical models, inverse problems, and deep neural networks such as AlphaFold.
Mathematical Formulation and First-Order Optimality
Directional Derivatives and Cauchy's Update Rule
Let L: Rd → R be a continuously differentiable objective (or loss) function parameterized by θ = (θ1, ..., θd)T. For any unit displacement direction u ∈ Rd satisfying ‖u‖2 = 1, the first-order Taylor expansion around the current iterate θt gives the directional derivative:
DuL(θt) = ∇L(θt)T u = ‖∇L(θt)‖2 cos φ
where ∇L(θt) = (∂L/∂θ1, ..., ∂L/∂θd)T is the gradient vector and φ is the angle between ∇L(θt) and u. By the Cauchy–Schwarz inequality, DuL(θt) is minimized when cos φ = −1, meaning u = −∇L(θt)/‖∇L(θt)‖2. Starting from an initial guess θ0 ∈ Rd, gradient descent generates a sequence of iterates {θt}t≥0 via:
θt+1 = θt − ηt ∇L(θt)
where ηt > 0 is the step size or learning rate. Iteration proceeds until the gradient norm satisfies ‖∇L(θt)‖2 ≤ ε, indicating proximity to a first-order stationary point where ∇L(θ*) = 0.
Lipschitz Smoothness and Step-Size Bounds
To establish convergence without overshooting the valley of the objective surface, L is assumed to have an Llip-Lipschitz continuous gradient (Llip-smoothness):
‖∇L(θ) − ∇L(φ)‖2 ≤ Llip ‖θ − φ‖2, for all θ, φ ∈ Rd
When L is twice differentiable, Llip bounds the largest eigenvalue λmax of the Hessian matrix H(θ) = ∇2L(θ). Integrating along the segment connecting θt and θt+1 yields the Descent Lemma:
L(θt+1) ≤ L(θt) + ∇L(θt)T(θt+1 − θt) + (Llip / 2) ‖θt+1 − θt‖22
Substituting θt+1 − θt = −η∇L(θt) simplifies the upper bound to:
L(θt+1) ≤ L(θt) − η (1 − Llipη / 2) ‖∇L(θt)‖22
Ensuring L(θt+1) < L(θt) whenever ∇L(θt) ≠ 0 requires 0 < η < 2/Llip. The optimal fixed step size under worst-case smoothness is η = 1/Llip, which decreases L by at least ‖∇L(θt)‖22/(2Llip) per step. For convex Llip-smooth objectives, the suboptimality gap decays at sublinear rate L(θT) − L(θ*) ≤ Llip‖θ0 − θ*‖22/(2T) = O(1/T). When L is μ-strongly convex (0 < μ ≤ λi(H) ≤ Llip) with spectral condition number κ = Llip/μ, setting η = 2/(μ + Llip) yields geometric contraction:
‖θt − θ*‖2 ≤ [ (κ − 1) / (κ + 1) ]t ‖θ0 − θ*‖2
When κ ≫ 1, the level sets of L(θ) form elongated ellipsoidal ravines. Because −∇L is perpendicular to contour lines, standard gradient descent oscillates across the narrow canyon walls while advancing slowly along the valley floor—a pathology alleviated by momentum or the Conjugate Gradient Method.
Momentum and Accelerated First-Order Methods
Polyak Heavy-Ball Momentum and Nesterov Acceleration
To damp cross-valley oscillations in ill-conditioned ravines, Soviet mathematician Boris T. Polyak introduced the heavy-ball method in 1964. By analogy with an inertial particle moving through a viscous potential field, the update accumulates a velocity vector vt with damping coefficient β ∈ [0, 1):
- vt+1 = β vt − η ∇L(θt)
- θt+1 = θt + vt+1 = θt − η ∇L(θt) + β (θt − θt−1)
Along high-curvature axes where the gradient reverses sign each step, oscillations cancel; along low-curvature axes, velocity builds up by 1/(1 − β), improving quadratic contraction from (κ − 1)/(κ + 1) to (√κ − 1)/(√κ + 1).
In 1983, Yurii Nesterov formulated Nesterov Accelerated Gradient (NAG), which evaluates the gradient at the extrapolated lookahead position θ̃t = θt + βtvt:
- vt+1 = βt vt − η ∇L(θt + βt vt), with θt+1 = θt + vt+1
With schedule βt = (t − 1)/(t + 2), NAG achieves the optimal first-order smooth convex rate L(θT) − L(θ*) = O(1/T2).
Stochastic and Adaptive Gradient Algorithms
Robbins–Monro Stochastic Gradient Descent (SGD)
In empirical risk minimization over n observations, L(θ) = (1/n) ∑i=1n ℓi(θ). Evaluating the full gradient costs O(nd) operations per step. Building on Herbert Robbins and Sutton Monro's 1951 stochastic approximation framework, Stochastic Gradient Descent (SGD) draws a uniform mini-batch Bt ⊂ {1, ..., n} of size b ≪ n and computes an unbiased estimator:
gt = (1 / b) ∑i∈Bt ∇ℓi(θt), with E[gt | θt] = ∇L(θt)
reducing per-step cost to O(bd). Convergence to θ* under mini-batch variance Var(gt) = O(σ2/b) holds under the Robbins–Monro schedules ∑t=1∞ ηt = ∞ and ∑t=1∞ ηt2 < ∞.
| Optimizer | Update Mechanism | Memory | Convex Rate | Primary Scientific & ML Use Cases |
|---|---|---|---|---|
| Full-Batch GD | Deterministic step along −∇L(θt) | O(d) | O(1/T) | Moderate-n convex problems, Linear Regression |
| Nesterov (NAG) | Extrapolated lookahead gradient ∇L(θt + βvt) | O(2d) | O(1/T2) | Compressed sensing, LASSO (FISTA) |
| Mini-Batch SGD | Unbiased subsample gradient gt | O(d) | O(1/√T) | Large-scale empirical risk minimization, CNNs |
| AdaGrad | Coordinate scaling by cumulative ∑ gτ,j2 | O(2d) | O(1/√T) | Sparse high-dimensional features |
| Adam / AdamW | Bias-corrected decaying 1st (mt) and 2nd (vt) moments | O(3d) | O(1/√T) | Transformers, protein folding, variational Bayesian Inference |
AdaGrad, RMSProp, and Adam Adaptive Moment Estimation
To adapt learning rates across parameters with disparate gradient scales, AdaGrad (Duchi et al., 2011) scales each coordinate j inversely by √(∑τ=1t gτ,j2), while RMSProp replaces the cumulative sum with a geometrically decaying average governed by exp(−λt) decay dynamics. Adam (Adaptive Moment Estimation, Kingma and Ba, 2015) combines momentum with per-coordinate scaling by tracking decaying averages of the first moment mt and uncentered second moment vt:
- mt = β1 mt−1 + (1 − β1) gt, and vt = β2 vt−1 + (1 − β2) (gt ⊙ gt)
- m̂t = mt / (1 − β1t), and v̂t = vt / (1 − β2t)
- θt+1 = θt − η m̂t / (√v̂t + εstab)
where β1 = 0.9, β2 = 0.999, and εstab = 10−8, correcting for zero-initialization bias in early iterations.
Frequently Asked Questions
Why does gradient descent zig-zag in elongated valleys?
The gradient ∇L(θ) is perpendicular to the contour surfaces of L(θ). When the Hessian matrix has a large condition number κ = λmax/λmin ≫ 1, the contours form narrow ellipses whose perpendiculars point across the short axis rather than along the valley floor toward the minimum.
Why is mini-batch SGD often preferred over full-batch gradient descent in deep learning?
Beyond cutting per-step cost from O(nd) to O(bd), mini-batch gradient noise destabilizes sharp, high-curvature local minima and helps trajectories settle into broad, flat basins that generalize better on unseen data.
How does gradient descent differ from Newton's method?
Gradient descent is a first-order method using only ∇L(θt) in O(d) memory. Newton's method is a second-order method that multiplies by the inverse Hessian [H(θt)]−1∇L(θt), achieving quadratic local convergence at the expense of O(d2) memory and O(d3) linear solver operations per step.
References
- Cauchy, A.-L. (1847). Méthode générale pour la résolution des systèmes d'équations simultanées. Comptes Rendus Hebdomadaires des Séances de l'Académie des Sciences, 25, 536–538. https://doi.org/10.1017/CBO9780511702396.091
- Robbins, H., & Monro, S. (1951). A stochastic approximation method. The Annals of Mathematical Statistics, 22(3), 400–407. https://doi.org/10.1214/aoms/1177729586
- Polyak, B. T. (1964). Some methods of speeding up the convergence of iteration methods. USSR Computational Mathematics and Mathematical Physics, 4(5), 1–17. https://doi.org/10.1016/0041-5553(64)90137-590137-5)
- Nesterov, Y. (1983). A method for solving the convex programming problem with convergence rate O(1/k2). Soviet Mathematics Doklady, 27(2), 372–376. https://doi.org/10.1007/978-1-4419-8853-9
- Duchi, J., Hazan, E., & Singer, Y. (2011). Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12, 2121–2159. https://doi.org/10.5555/1953048.2021068