Nesterov Accelerated Gradient
Plain gradient steps correct where you stand. Nesterov first jumps where momentum carries you, then corrects there, which damps zigzags and lifts smooth convex speed.
Why Does This Exist?
Ill-conditioned valleys stall plain descent. On the curvature ratio is , so a step that is stable across the steep axis crawls along the flat axis. From distance 5, gradient descent needs about 153 steps to reach , while each step in a real model touches millions of parameters. Heavy-ball momentum helps but reads the gradient at the stale position and still overshoots the walls.
Nesterov fixes the staleness by reading the gradient at the predicted position. The smooth convex rate lifts from to , which is optimal for first-order methods, and the strongly convex rate lifts from to .
This page covers the lookahead mechanism and its rates. The loop taxonomy lives in gradient descent variants, the rate definitions in convergence rates, and noisy extensions in stochastic gradient descent variants.
The one idea you need first
Momentum carries velocity , where is the current iterate and is the step just taken. Heavy-ball steps , where is the step size, is the gradient at the old spot, and is the momentum weight. Nesterov keeps the inertia but moves the gradient to the predicted spot. The full loop list is in gradient descent variants.
Think of It Like This
Steering where the car will be
Heavy-ball steers from the rear-view mirror: it measures the slope where the car was, then adds speed. Nesterov looks through the windshield at the predicted position and steers there.
Speed maps to momentum, the steering correction maps to the gradient, a straight highway maps to a well-conditioned bowl where both work, and a slalom maps to a stretched valley where mirror-steering oscillates wall to wall.
Where it stops: lookahead assumes a smooth road. Potholes such as nonsmooth kinks and stochastic noise punish prediction and need smaller momentum or proximal variants.
How It Actually Works
For -smooth convex , where is the objective and is the smoothness constant bounding curvature, the iterates are and , where is the lookahead point, is the current iterate, is the scheduled weight, and is the gradient at the lookahead. This gives , where is the minimum value and is a minimizer.
For -strongly convex , where is the strong-convexity constant bounding curvature from below and is the condition number, the fixed-weight variant uses and step . Its linear rate is per step, versus for plain descent. The proximal extension FISTA ports the schedule to with nonsmooth such as the Lasso penalty.
Worked example
Take . The Hessian is diagonal with entries and , so , , and . Use and . Start at with , where is velocity.
First step, with zero momentum, both methods agree. The gradient is , so and . Velocity becomes .
Second step splits them. Plain descent stays on axis: . Nesterov first looks ahead to , reads , then steps to . Two steps give plain versus lookahead, and the gap widens because Nesterov steps grow while plain steps shrink.
Project to from , which makes on axis. Plain descent shrinks by per step, so needs . Nesterov shrinks by about per step, so needs . Those are the 28 versus 153 counts in the diagram.
Code
The point is the check: the same two steps and the same 28 versus 153 projection, in plain Python with no dependencies.
import math
def grad(p: tuple[float, float]) -> tuple[float, float]: return (2.0 * p[0], 50.0 * p[1])
def sub(a: tuple[float, float], b: tuple[float, float]) -> tuple[float, float]: return (a[0] - b[0], a[1] - b[1])
def add(a: tuple[float, float], b: tuple[float, float]) -> tuple[float, float]: return (a[0] + b[0], a[1] + b[1])
def scale(a: tuple[float, float], s: float) -> tuple[float, float]: return (a[0] * s, a[1] * s)
alpha: float = 0.02beta: float = 2.0 / 3.0x0: tuple[float, float] = (5.0, 2.0)g0 = grad(x0)x1: tuple[float, float] = sub(x0, scale(g0, alpha))print((round(x1[0], 4), round(x1[1], 4))) # -> (4.8, 0.0)
v1 = sub(x1, x0)y2 = add(x1, scale(v1, beta))print((round(y2[0], 4), round(y2[1], 4))) # -> (4.6667, -1.3333)
g2 = grad(y2)x2_nes: tuple[float, float] = sub(y2, scale(g2, alpha))print((round(x2_nes[0], 4), round(x2_nes[1], 4))) # -> (4.48, 0.0)
g1 = grad(x1)x2_gd: tuple[float, float] = sub(x1, scale(g1, alpha))print((round(x2_gd[0], 4), round(x2_gd[1], 4))) # -> (4.608, 0.0)
k_gd: int = math.ceil(math.log(0.002) / math.log(0.96))k_nes: int = math.ceil(math.log(0.002) / math.log(0.80))print((k_gd, k_nes)) # -> (153, 28)The prints give , lookahead , Nesterov versus plain , and the projection . The only change from heavy-ball is where the gradient is read.
Watch Out For
Running textbook schedule on noisy stochastic gradients
The proof needs exact gradients. With minibatch noise, the lookahead chases sampling noise: at the loss oscillates worse than plain SGD and can diverge, even though the same schedule glides on full batches.
Symptom is early violent oscillation that lowering only slows. Dampen to , grow batches, or switch to variance-reduced accelerated variants. If Nesterov-SGD oscillates worse than SGD, noise is driving the wheel.
Skipping restarts on locally strong bowls
Global scheduling overshoots near the bottom once local strong convexity kicks in. The loss sawtooths late: it falls for 20 steps, ripples up, then falls again, wasting the -step linear tail the fixed would give.
Restart momentum when , meaning the velocity points uphill. That recovers the fast tail. If the loss sawtooths late, momentum is stale, not small.
The Quick Version
- Nesterov reads the gradient at the lookahead , not at the position .
- Smooth convex rates lift from to , which is optimal for first-order oracles.
- On from , two steps give versus plain.
- Reaching takes about steps versus about plain.
- Strongly convex rate lifts from to .
- FISTA extends the schedule to proximal nonsmooth splits such as Lasso.
- Dampen momentum under noise and restart it when it points uphill.