Momentum & Nesterov Acceleration
Heavy-ball momentum and the optimal first-order rate.
Gradient descent remembers nothing but its current position. Give it a little memory of its last step and the dependence on the condition number drops from to : a hundredfold speedup when . This lesson derives Polyak's heavy ball on quadratics, proves the optimal rate of Nesterov's method, shows why the heavy ball can cycle forever on a function that is only slightly non-quadratic, and finds the differential equation hiding inside acceleration.
What you’ll learn
- Analyze the heavy-ball method on quadratics through its characteristic polynomial, and derive its optimal parameters and the rate .
- State Nesterov's accelerated method for smooth convex and strongly convex functions, and prove the rate with a potential function.
- Explain why the heavy ball can fail on non-quadratic strongly convex functions, while Nesterov's method cannot.
- Derive the ODE limit of Nesterov's method and its Lyapunov proof, and describe restarts and momentum's role in deep learning.
The heavy ball on a quadratic
Polyak (1964) added a momentum term to gradient descent, the heavy-ball method:
It discretizes a ball with friction rolling on the graph of , . Deep-learning libraries write the same method with a velocity, , , which is the formula above with . On a quadratic with spectrum in , the analysis is exact.
In the eigenbasis of , the error component along an eigenvector with eigenvalue obeys a two-term recursion:
Its solutions are combinations of , where solves the characteristic equation. The product of the two roots is :
If the roots are complex they are conjugate, so both have modulus , whatever is. They are complex when the discriminant is negative:
Fit the whole spectrum into that window, with equality at both ends: and . Dividing gives , hence Polyak's parameters and rate:
The factor comes from the double roots at the two ends of the spectrum and does not change the exponential rate. Since , accuracy takes about iterations instead of . No first-order method can do better: Nesterov's lower bound exhibits a quadratic on the infinite-dimensional space (the limit of large dimension) on which every such method has (Lower Bounds & Oracle Complexity).
| gradient descent, | heavy ball, | |
|---|---|---|
| 10 | 0.818 (69 iterations) | 0.519 (22 iterations) |
| 100 | 0.980 (691) | 0.818 (69) |
| 0.9998 (69,078) | 0.980 (691) |
A quadratic has . How many iterations of optimally tuned heavy ball reduce the error by a factor , counting the exponential rate only?
Show the answer
69 iterations
The rate is , and , so 69 iterations. Gradient descent with its best step needs 691: the factor of 10 is .
Nesterov’s accelerated gradient
Nesterov (1983) moved the gradient evaluation to a look-ahead point. In its common momentum form, Nesterov's accelerated gradient is
with for smooth convex and the constant for -strongly convex . Unlike gradient descent it is not a descent method: can go up for a while, and the iterates overshoot and ripple.
The cleanest proof uses an equivalent three-sequence form and a potential function that never increases. Let and, for , let solve and . Starting from , write and iterate
Define the potential . Use the descent lemma at , then convexity at twice, toward (weight ) and toward (weight ):
The definition of makes the bracket collapse:
Expand the distance term with the -update. The cross terms cancel when the two lines are added:
What is left is a multiple of , and the choice makes it vanish:
Finally the weights grow quadratically: , so , and .
When the heavy ball fails
The heavy-ball analysis is spectral: it studies one fixed linear map. On a non-quadratic function the "effective curvature" changes from step to step, and a product of matrices that each contract can still expand. Lessard, Recht & Packard (2016) made this concrete with a one-dimensional function that is 1-strongly convex and 25-smooth:
Run the heavy ball with Polyak's parameters for , namely and , from . The iterates never converge: they settle into a cycle of period 3 through about , and . Gradient descent with , and Nesterov's method with , both converge to on the same function. Goujaud, Taylor & Dieuleveut (2025) proved that this is no accident: for every condition number and every choice of parameters, the heavy ball either is not accelerated on quadratics or fails to converge on some smooth strongly convex function.
Why does Nesterov's method keep its accelerated guarantee on every smooth strongly convex function, while the heavy ball can cycle?
- Nesterov's method uses a smaller step size
- The heavy ball's momentum coefficient is too large to ever converge
- Nesterov's proof uses only inequalities valid for the whole function class (smoothness and convexity at the look-ahead point, a decreasing potential), while the heavy ball's optimal tuning comes from the spectrum of one linear iteration
- Nesterov's method is a descent method, so cannot cycle
Show the answer
C. Nesterov's proof uses only inequalities valid for the whole function class (smoothness and convexity at the look-ahead point, a decreasing potential), while the heavy ball's optimal tuning comes from the spectrum of one linear iteration
The potential-function argument never assumes is quadratic; it only chains the descent lemma and convexity inequalities, which hold for every member of the class. The heavy ball's rate is an eigenvalue statement about a fixed matrix, which says nothing once the Hessian varies along the path.
The differential equation behind acceleration
Su, Boyd & Candès (2016) showed that, as the step with time , Nesterov's iterates (with ) follow the ODE below, started at rest at . It is a heavy ball whose friction fades over time: early on it is damped, later it keeps its momentum.
Consider the energy
Differentiate. The ODE gives , the derivative of the bracket:
The terms cancel, and convexity, , makes the rest nonpositive:
So .
The constant 3 is not arbitrary. For the family , Su, Boyd & Candès show that is exactly what guarantees an rate for all convex ; for there are convex functions where it fails, a sharp phase transition.
Restarts. Because Nesterov's method keeps momentum when it should stop, its iterates ripple, especially when is strongly convex but the method was tuned for the merely convex case. O'Donoghue & Candès (2015) proposed resetting the momentum whenever increases, or whenever the momentum points uphill (); this simple heuristic recovers the optimal rate in many cases without knowing .
Momentum in deep learning
Sutskever, Martens, Dahl & Hinton (2013) showed that stochastic gradient descent with a well-designed random initialization and a slowly increasing momentum schedule (the coefficient rising toward a cap as high as , with Nesterov-style momentum usually doing best) trains deep and recurrent networks to levels previously reached only with Hessian-free second-order methods. Momentum around has been standard ever since.
Two cautions. First, on a long stretch where the gradient barely changes, the velocity settles at , so momentum multiplies the effective learning rate by , ten for ; comparing optimizers at equal is misleading. Second, acceleration is a statement about exact gradients. With noisy gradients the noise term dominates, and Kidambi, Netrapalli, Jain & Kakade (2018) exhibited simple least-squares instances where heavy ball and Nesterov's method with stochastic gradients cannot beat plain SGD for any parameter choice, arguing that their practical gains are largely a by-product of mini-batching.
Key takeaways
- Heavy ball: . On quadratics, complex characteristic roots of modulus give the optimal rate with : about instead of iterations per factor .
- Nesterov's method evaluates the gradient at a look-ahead point and achieves , and under strong convexity: optimal among first-order methods.
- A decreasing potential with proves the rate using only smoothness and convexity.
- The heavy ball with quadratic-optimal parameters can cycle forever on a strongly convex function (, Lessard–Recht–Packard); Nesterov's method cannot.
- Acceleration's continuous limit is ; in deep learning, momentum raises the effective step by and averages noise, and with noisy gradients the classical heavy-ball and Nesterov updates can lose their accelerated rate.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
A strongly convex quadratic has . With optimally tuned constant parameters, by what factor does each method shrink the error per iteration (asymptotically)?
- Gradient descent , heavy ball
- Gradient descent , heavy ball
- Both
- Gradient descent , heavy ball
Show the answer
B. Gradient descent , heavy ball
Gradient descent: . Heavy ball: . A millionfold reduction takes about 2,760 versus 138 iterations.
You train with SGD and momentum at learning rate . Through a long stretch where the gradient is almost constant, how far do the parameters move per step?
- About , as without momentum
- About
- About
- It grows without bound
Show the answer
C. About
The velocity obeys , whose fixed point is . The step is ten times the plain gradient step, which is why momentum and the learning rate must be tuned together.
In the ODE for convex , what is special about , the value that Nesterov's method produces?
- It is the only value for which solutions exist
- It is the smallest that guarantees an rate for every convex
- It is the value that makes the solution a descent path, with decreasing
- It gives linear convergence for strongly convex
Show the answer
B. It is the smallest that guarantees an rate for every convex
For a Lyapunov argument like the one above yields ; for , Su, Boyd & Candès give convex functions on which this rate fails.
Further reading
- B. T. Polyak, "Some methods of speeding up the convergence of iteration methods," USSR Computational Mathematics and Mathematical Physics 4(5), 1–17 (1964).
- Yu. E. Nesterov, "A method of solving a convex programming problem with convergence rate ," Doklady Akademii Nauk SSSR 269(3), 543–547 (1983).
- L. Lessard, B. Recht & A. Packard, "Analysis and design of optimization algorithms via integral quadratic constraints," SIAM Journal on Optimization 26(1), 57–95 (2016).
- W. Su, S. Boyd & E. J. Candès, "A differential equation for modeling Nesterov's accelerated gradient method: theory and insights," Journal of Machine Learning Research 17(153), 1–43 (2016).
- I. Sutskever, J. Martens, G. Dahl & G. Hinton, "On the importance of initialization and momentum in deep learning," Proceedings of the 30th ICML, PMLR 28(3), 1139–1147 (2013).