Foundations to Frontier
Tests
E. Deep Learning › E3 Optimizers (one page each)

Nesterov accelerated gradient

Nesterov's accelerated gradient is momentum with a look-ahead: it first moves along the momentum, then evaluates the gradient at that look-ahead point. This small change gives provable acceleration on all smooth convex functions: O(1/t²) instead of O(1/t), and about √κ instead of κ iterations for strongly convex ones. This page covers the update in its look-ahead and velocity forms, the convex and strongly convex parameter schedules, the theory, and how it differs from heavy-ball momentum. In the exercises you verify the equivalent forms and the faster convex rate, then reproduce a published counterexample in which heavy ball with its optimal parameters falls into a period-3 cycle while Nesterov converges from every start.

Level 0: Foundation

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

Look before you leap

Momentum keeps moving in the direction it has been going. Nesterov’s idea: since you are going to move along the momentum anyway, first look at where that will take you, and measure the slope there. If the look-ahead point is already past the bottom of the valley, the gradient there points back, and the step corrects itself before overshooting. That small piece of foresight turns momentum into a method that is provably fast on every smooth convex problem.

Optimizer lab: Nesterov versus plain gradient descent
Nesterov: final loss diverged · gradient descent: final loss 2.2e-9 (step 22)
Orange: the chosen optimizer; grey dashed: plain gradient descent with the same learning rate. Darker shading means higher loss. On the ill-conditioned bowl, raise κ and watch gradient descent zig-zag across the narrow direction; on the saddle it stalls near the flat start; on the plateau its gradients are tiny. Adaptive methods rescale each direction; momentum methods build speed along consistent directions. The target is 1% of the starting loss (for the saddle, a loss below −0.2; its minima are at −0.25).
Why engineers care

Nesterov momentum is an option in every deep-learning SGD implementation and inside Nadam. In optimisation-based control and estimation (MPC, moving-horizon estimation), accelerated gradient methods with guaranteed rates are used when an answer is needed within a fixed number of iterations each control cycle. Provable behaviour matters there more than average-case speed.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Nesterov evaluates the gradient…
  2. 2. On smooth convex problems Nesterov's rate is…
  3. 3. Nesterov differs from heavy ball by…

Level 1: Beginner

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

By hand

  • Look-ahead form: y = x_t + β(x_t − x(t−1)), then x(t+1) = y − η∇f(y). Example: x = 2, previous 1, β = 0.5 gives y = 2.5; with ∇f(y) = 2y and η = 0.1, x_new = 2.5 − 0.5 = 2.
  • Velocity form (Sutskever et al., 2013): v ← βv − η∇f(w + βv), then w ← w + v. It gives the same iterates.
  • Strongly convex parameters: η = 1/L and β = (√κ − 1)/(√κ + 1). For μ = 1, L = 25: η = 0.04, β = 2/3. The per-step contraction is about 1 − 1/√κ (0.9 at κ = 100).
  • Convex (not strongly) schedule: β_t = (t − 1)/(t + 2), which rises from 0 toward 1. It gives f(x_t) − f* ≤ 2L‖x₀ − x*‖²/(t + 1)².
  • PyTorch: SGD(..., momentum=0.9, nesterov=True) uses an equivalent reformulation on the current parameters.
📝 Quick check (Level 1)
0/3 answered
  1. 1. Look-ahead point for x = 3, previous 2, β = 0.5?
  2. 2. Nesterov's β for κ = 9?
  3. 3. β_t for t = 4 in the convex schedule?

Level 2: Intermediate

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

Nesterov in code

Exercise 1.

  • The look-ahead and velocity forms produce identical iterates.
  • The convex schedule starts at 0 and tends to 1.
  • On a convex quadratic with curvatures down to 10⁻⁴ (badly conditioned, effectively not strongly convex), Nesterov reached a loss of 5.9 × 10⁻⁶ after 400 steps, against 2.5 × 10⁻³ for gradient descent.

Practice.

  • In deep learning, Nesterov momentum (β ≈ 0.9) usually performs about as well as or slightly better than classical momentum. The differences are small under heavy gradient noise.
  • The convex schedule β_t → 1 can cause oscillations late in training. Adaptive restart (O’Donoghue and Candès, 2015), resetting momentum when the loss increases, removes them.
  • The theory assumes exact gradients; with noisy gradients acceleration is limited, and errors accumulate.
torch.optim.SGD(model.parameters(), lr=0.1, momentum=0.9, nesterov=True)
🐍 Exercise 1: Nesterov's forms and the convex rate
Implement the look-ahead and velocity forms of Nesterov's method, the convex momentum schedule, and compare its loss with gradient descent on a badly conditioned convex quadratic.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Adaptive restart resets momentum when…
  2. 2. Under heavy gradient noise, Nesterov's advantage is…
  3. 3. PyTorch's nesterov=True requires…

Level 3: Advanced

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

Theory

Accelerated rates.

  • For L-smooth convex f, gradient descent achieves f(x_t) − f* = O(L‖x₀ − x*‖²/t).
  • Nesterov (1983) achieves O(L‖x₀ − x*‖²/t²), which matches the lower bound for first-order methods: no method using only gradients can do better in the worst case. Nesterov’s method is optimal.
  • For μ-strongly convex f, it contracts like (1 − 1/√κ)ᵗ, against (1 − 1/κ)ᵗ for gradient descent.

Heavy ball versus Nesterov.

  • On quadratics, heavy ball with Polyak’s parameters is actually faster: (√κ − 1)/(√κ + 1) against 1 − 1/√κ.
  • Heavy ball’s guarantee relies on the Hessian being constant. Lessard, Recht and Packard (2016) built a one-dimensional strongly convex function with κ = 25, with a gradient that is linear in three pieces, on which heavy ball with its optimal parameters converges from some starts but cycles from others.
  • Nesterov’s look-ahead gradient makes it robust to such curvature changes. Its analysis uses an estimate-sequence or Lyapunov argument valid for all smooth convex functions.

Continuous-time view. As the step size goes to zero, Nesterov’s convex scheme tends to the ODE ẍ + (3/t)ẋ + ∇f(x) = 0 (Su, Boyd and Candès, 2014): a damped oscillator whose damping decays over time.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Nesterov's O(1/t²) rate is…
  2. 2. On quadratics, which is faster with optimal parameters?
  3. 3. Nesterov's continuous-time limit has damping…

Level 4: Expert

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

A function where heavy ball fails

History.

  • Y. Nesterov (1983) introduced the accelerated gradient method and proved its optimal rate.
  • A. Nemirovski and D. Yudin (1983) established the matching lower bounds.
  • I. Sutskever et al. (2013) brought Nesterov momentum to deep learning.
  • W. Su, S. Boyd and E. Candès (2014) gave the ODE view.
  • L. Lessard, B. Recht and A. Packard (2016) built the heavy-ball counterexample using integral quadratic constraints.

Exercise 2. The test function is f with gradient 25x for x < 1, x + 24 for 1 ≤ x < 2, and 25x − 24 for x ≥ 2. It is strongly convex with μ = 1, L = 25, and its minimum is at 0. We run heavy ball with Polyak’s optimal parameters (η = 0.111, β = 0.444) and Nesterov with η = 1/L = 0.04, β = 2/3, for 300 steps from several starts, and report the largest |x| over the last 50 steps.

start x₀ heavy ball Nesterov
3.3 2.12 (no convergence) 0
3.0 7 × 10⁻⁴⁰ 0
2.5 3 × 10⁻⁴² 0
1.5 8 × 10⁻⁴³ 0
−1.0 3 × 10⁻⁴² 0
−3.0 2.12 (no convergence) 0
  • Heavy ball fell into a stable cycle from x₀ = 3.3 and −3.0, repeating −1.802 → 2.116 → 0.647 forever, even though the function is strongly convex and smooth. From the other starts it converged quickly.
  • Nesterov converged from every start. It reached exactly 0, because once in the region x < 1 a gradient step with η = 1/L lands exactly on the minimum of that quadratic piece.
  • On a pure quadratic (curvature 25 or 1), both converged, and heavy ball was faster on the flat one (4.5 × 10⁻⁵¹ against 1.5 × 10⁻²⁷), as the theory predicts.
  • Lesson: heavy ball’s speed-up is guaranteed only for quadratics. Nesterov’s look-ahead trades some speed on quadratics for guarantees on all smooth convex functions.
🐍 Exercise 2 (research): a function where heavy ball fails
Run heavy ball with Polyak's optimal parameters and Nesterov with η = 1/L on Lessard, Recht and Packard's piecewise strongly convex function from several starts, and on two quadratics; check for convergence and find heavy ball's cycle.

Nesterov in AI, robotics and aerospace

  • Real-time optimisation: fast gradient methods with Nesterov acceleration solve MPC quadratic programs on embedded flight and automotive controllers with certified iteration bounds.
  • Training: Nesterov momentum is a common, safe default for SGD-trained perception networks.
  • Estimation: accelerated proximal methods (FISTA) solve sparse reconstruction and compressed-sensing problems in imaging and radar.

References

  1. Y. Nesterov (1983). “A method for solving the convex programming problem with convergence rate O(1/k²).” Soviet Mathematics Doklady 27.
  2. Y. Nesterov (2004). Introductory Lectures on Convex Optimization. Springer.
  3. L. Lessard, B. Recht, A. Packard (2016). “Analysis and design of optimization algorithms via integral quadratic constraints.” SIAM Journal on Optimization 26(1).
  4. W. Su, S. Boyd, E. Candès (2014). “A differential equation for modeling Nesterov’s accelerated gradient method.” Advances in NeurIPS 27.
  5. B. O’Donoghue, E. Candès (2015). “Adaptive restart for accelerated gradient schemes.” Foundations of Computational Mathematics 15.