Foundations to Frontier
Tests
A. Mathematical Foundations › A6 Optimization › Optimization for ML

Momentum and Nesterov Acceleration

Gradient descent forgets its past; momentum remembers. Adding a fraction of the previous step to each update cancels zig-zags and builds speed along shallow directions, cutting iteration counts from O(κ) to O(√κ). You will derive Polyak's heavy-ball method and Nesterov's accelerated gradient, see why Nesterov's look-ahead makes acceleration robust on all smooth convex functions (achieving the optimal O(1/k²)), view momentum as a damped physical system, tune its parameters, and use adaptive restart when the curvature is unknown.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

A heavy ball, not a careful hiker

A careful hiker in a narrow valley steps straight downhill each time, which mostly means bouncing from wall to wall. A heavy ball rolling down the same valley keeps its speed. Its side-to-side wobbles cancel out, while its motion along the valley floor keeps building. It reaches the bottom much sooner.

That memory of past motion is momentum. A clever version, Nesterov’s method, looks a little ahead before deciding which way is downhill.

A heavy ball rolls through the valley: momentum and acceleration
steps to ‖x‖ < 10⁻³: GD 382 · heavy ball 45 · Nesterov 66 · theory: GD ∝ κ = 50, accelerated ∝ √κ ≈ 7.1
GD (grey) zig-zags across the valley and creeps along it, needing about κ steps. Momentum keeps a running velocity: the zig-zags cancel and progress along the valley accumulates, so about √κ steps suffice. Too little momentum gives GD-like crawling. Too much (β near 1) under-damps it, so it overshoots and spirals. Nesterov evaluates the gradient at a look-ahead point, which makes acceleration provably robust on all smooth convex functions.
Why engineers care

Almost every neural network is trained with momentum (SGD + momentum, or Adam’s first moment). Accelerated gradient methods are used in fast MPC solvers, image reconstruction and large-scale estimation. For badly conditioned problems they can be 10–100× faster than plain gradient descent.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Momentum adds to each step a fraction of…
  2. 2. In a narrow valley, momentum makes side-to-side wobbles…
  3. 3. Too much momentum can cause…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

Heavy ball (Polyak, 1964)

xk+1=xk−α∇f(xk)+β(xk−xk−1)x_{k+1} = x_k - \alpha\nabla f(x_k) + \beta(x_k - x_{k-1})

The term xk−xk−1x_k - x_{k-1} is the velocity, and β∈[0,1)\beta\in[0, 1) is the momentum coefficient (typically 0.9).

Nesterov’s accelerated gradient (1983)

xk+1=yk−1L∇f(yk)yk+1=xk+1+βk(xk+1−xk)\begin{aligned}x_{k+1} &= y_k - \tfrac1L\nabla f(y_k)\\ y_{k+1} &= x_{k+1} + \beta_k(x_{k+1} - x_k)\end{aligned}

The gradient is evaluated at the extrapolated point yky_k, which is the look-ahead.

  • Strongly convex: β=κ−1κ+1\beta = \frac{\sqrt\kappa - 1}{\sqrt\kappa + 1}.
  • Convex: βk=tk−1tk+1\beta_k = \frac{t_k - 1}{t_{k+1}} with tk+1=1+1+4tk22t_{k+1} = \frac{1 + \sqrt{1 + 4t_k^2}}2, which is about k−1k+2\frac{k - 1}{k + 2}.

Speed-up

Per-step contraction: GD gives 1−1/κ1 - 1/\kappa, accelerated methods give 1−1/κ1 - 1/\sqrt\kappa. At κ=100\kappa = 100 that’s 0.99 vs 0.9: about 10× fewer iterations.

📝 Quick check (Level 1)
0/3 answered
  1. 1. Nesterov evaluates the gradient at…
  2. 2. Accelerated per-step contraction at κ = 100 is about…
  3. 3. Iterations needed scale like … for accelerated methods

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.

Guarantees

  • Heavy ball with α=4(L+μ)2\alpha = \frac4{(\sqrt L + \sqrt\mu)^2}, β=(κ−1κ+1)2\beta = \big(\frac{\sqrt\kappa - 1}{\sqrt\kappa + 1}\big)^2 converges like (κ−1κ+1)k\big(\frac{\sqrt\kappa - 1}{\sqrt\kappa + 1}\big)^k on quadratics. On general strongly convex functions it can fail to converge (Lessard, Recht and Packard, 2016).
  • Nesterov: on all L-smooth convex functions, f(xk)−f⋆≤2L∥x0−x⋆∥2(k+1)2f(x_k) - f^\star\le\frac{2L\|x_0 - x^\star\|^2}{(k + 1)^2}, which matches the lower bound up to constants. On strongly convex functions the rate is (1−1/κ)k(1 - 1/\sqrt\kappa)^k.

Momentum as physics

Heavy ball discretizes x¨+γx˙+∇f(x)=0\ddot x + \gamma\dot x + \nabla f(x) = 0, a mass on a potential with friction. Nesterov’s method corresponds to x¨+3tx˙+∇f(x)=0\ddot x + \frac3t\dot x + \nabla f(x) = 0, whose vanishing friction gives O(1/t2)O(1/t^2) (Su, Boyd and Candès, 2016).

Practice

  • Deep learning: SGD + momentum with β≈0.9\beta\approx0.9. With stochastic gradients, acceleration’s gains shrink, but momentum still damps oscillations.
  • Non-monotone: accelerated methods overshoot. Without knowing μ\mu, adaptive restart (reset momentum when ff increases or ∇f(yk)⊤(xk+1−xk)>0\nabla f(y_k)^\top(x_{k+1} - x_k) > 0) recovers linear convergence (O’Donoghue and Candès, 2015).
  • Robustness: with inexact gradients, accelerated methods accumulate errors faster than GD (Devolder, Glineur and Nesterov, 2014).
🐍 Exercise 1: κ vs √κ
Implement GD, the heavy ball and Nesterov for strongly convex quadratics. Count iterations to 10⁻⁶ at κ = 100 and κ = 3600, and check that GD scales like κ while momentum methods scale like √κ.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Nesterov's rate on smooth convex f is…
  2. 2. The heavy ball's optimal-parameter guarantee holds for…
  3. 3. Adaptive restart resets momentum when…

Level 3: Advanced

★★★★☆ Advanced⏱ 45 minGraduate level, with full derivations and proofs.

Heavy-ball analysis on a quadratic

In each eigen-direction with curvature λ\lambda, the error obeys ek+1=(1+β−αλ)ek−βek−1e_{k+1} = (1 + \beta - \alpha\lambda)e_k - \beta e_{k-1}. The characteristic roots satisfy r2−(1+β−αλ)r+β=0r^2 - (1 + \beta - \alpha\lambda)r + \beta = 0. When the roots are complex, ∣r∣=β|r| = \sqrt\beta. Choosing α,β\alpha, \beta so that the extreme eigenvalues μ,L\mu, L sit exactly on the boundary between real and complex roots gives the optimal parameters and contraction β=κ−1κ+1\sqrt\beta = \frac{\sqrt\kappa - 1}{\sqrt\kappa + 1}. ∎

Why is GD not optimal?

Nesterov’s worst-case function is a quadratic with a tridiagonal Hessian. After kk steps, any gradient-span method has touched only kk coordinates, so the error is at least of order LR2/k2LR^2/k^2. GD’s LR2/kLR^2/k is a factor kk away. Momentum methods reach the bound by combining past gradients cleverly (a Chebyshev-polynomial view).

Estimate sequences (sketch)

Nesterov’s proof builds lower models ϕk\phi_k of ff with ϕk(x)≤(1−λk)f(x)+λkϕ0(x)\phi_k(x)\le(1 - \lambda_k)f(x) + \lambda_k\phi_0(x), λk=O(1/k2)\lambda_k = O(1/k^2), and maintains f(xk)≤min⁡ϕkf(x_k)\le\min\phi_k. Then f(xk)−f⋆≤λk(ϕ0(x⋆)−f⋆)=O(LR2/k2)f(x_k) - f^\star\le\lambda_k(\phi_0(x^\star) - f^\star) = O(LR^2/k^2).

Exercise 3.1: Heavy-ball root modulus with β = 0.81

For complex roots, ∣r∣=0.81=0.9|r| = \sqrt{0.81} = 0.9 per step. That corresponds to optimal tuning for κ=19\sqrt\kappa = 19, so κ=361\kappa = 361, where GD would contract only by 1−1/361≈0.99721 - 1/361\approx0.9972.

📝 Quick check (Level 3)
0/3 answered
  1. 1. For complex characteristic roots, the heavy-ball contraction is…
  2. 2. Nesterov's lower-bound function has a Hessian that is…
  3. 3. Nesterov's ODE has friction coefficient…

Level 4: Expert

★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.

Acceleration without knowing μ: restart

For a least-squares calibration problem with κ ≈ 1500, the convex momentum schedule (which needs no μ) overshoots: the objective oscillates, and it reaches a 10⁻⁸ gap only after about 2300 iterations. Restarting the momentum whenever the objective rises cuts that to under 500, nearly the strongly-convex optimal rate, without ever estimating μ. GD doesn’t finish in 3000. Restart schemes are standard in first-order solvers (O’Donoghue and Candès, 2015).

🐍 Exercise 2 (research): adaptive restart
Implement Nesterov's method with the convex momentum schedule, with and without function-value restart, on an ill-conditioned least-squares problem. Compare iterations to a 10⁻⁸ gap with GD.

Momentum in AI, robotics and aerospace

  • Neural network training: SGD + momentum (Sutskever et al., 2013) and Adam’s first moment (A6.3-4).
  • Fast MPC: the fast gradient method (Nesterov) gives certified iteration bounds for embedded QPs on drones and spacecraft (Richter, Jones and Morari, 2012).
  • Imaging and reconstruction: FISTA (A6.2-7) is accelerated proximal gradient.
  • Control-theoretic analysis: integral quadratic constraints analyse and design optimizers as feedback systems (Lessard, Recht and Packard, 2016).

References

  1. B. Polyak (1964). “Some methods of speeding up the convergence of iteration methods.” USSR Computational Mathematics and Mathematical Physics, 4(5).
  2. Y. Nesterov (1983). “A method of solving a convex programming problem with convergence rate O(1/k²).” Soviet Mathematics Doklady, 27.
  3. Y. Nesterov (2004). Introductory Lectures on Convex Optimization. Kluwer.
  4. I. Sutskever, J. Martens, G. Dahl, G. Hinton (2013). “On the importance of initialization and momentum in deep learning.” ICML.
  5. W. Su, S. Boyd, E. Candès (2016). “A differential equation for modeling Nesterov’s accelerated gradient method.” JMLR, 17.
  6. L. Lessard, B. Recht, A. Packard (2016). “Analysis and design of optimization algorithms via integral quadratic constraints.” SIAM Journal on Optimization, 26(1).
  7. B. O’Donoghue, E. Candès (2015). “Adaptive restart for accelerated gradient schemes.” Foundations of Computational Mathematics, 15.
  8. O. Devolder, F. Glineur, Y. Nesterov (2014). “First-order methods of smooth convex optimization with inexact oracle.” Mathematical Programming, 146.
  9. G. Goh (2017). “Why momentum really works.” Distill.
  10. S. Richter, C. Jones, M. Morari (2012). “Computational complexity certification for real-time MPC with input constraints based on the fast gradient method.” IEEE Transactions on Automatic Control, 57(6).