Part I — Calculus, Optimization & Gradients · Chapter 8

Momentum & Nesterov acceleration

Hook

Momentum reacts to the gradient right where it's standing, then carries that reaction forward as velocity. What if, instead, it looked ahead to roughly where the velocity is about to carry it — and reacted to that gradient instead?

Intuition
Step 0 — accent = Momentum, ink = Nesterov (both β = 0.7)

Same ravine, same starting point, same β. The accent trail is plain Momentum; the ink trail is Nesterov. Step through it — the two are identical on step one, since velocity starts at zero either way, and then they visibly split.

Formalize

Momentum evaluates the gradient at the current point. Nesterov accelerated gradient (NAG) evaluates it at a look-ahead point first:

θ~=θηβv,v=βv+f(θ~),θ=θηv\tilde\theta = \theta - \eta\beta v, \qquad v' = \beta v + \nabla f(\tilde\theta), \qquad \theta' = \theta - \eta v'
  • θ~\tilde\theta — the look-ahead point: where momentum alone would carry θ\theta before this step's gradient is even computed.
  • vv — the velocity carried over from the previous step.
  • vv' — the new velocity, built from the gradient at θ~\tilde\theta instead of at θ\theta.
  • θ,θ\theta, \theta' — the parameters before and after this step.
  • η,β\eta, \beta — the learning rate and momentum coefficient, same roles as in plain Momentum.
  1. Same bookkeeping, one different input

    Every quantity here — vv, η\eta, β\beta — means exactly what it meant in the Momentum chapter. The only change is where the gradient is evaluated.

  2. Step one is always identical to Momentum

    With v=0v=0 at the start, θ~=θ\tilde\theta=\theta, so the first step's gradient is evaluated at the same place either way — the two methods can only start splitting apart from step two onward.

  3. Looking ahead corrects overshoot sooner

    If the velocity is about to carry the point past the minimum, the look-ahead gradient already points back the other way — Nesterov reacts to that correction one step earlier than plain Momentum can.

Play
Step 0 — (x=4.00, y=1.00), |v| = 0.00

Push β high on Momentum and watch it overshoot and oscillate. Switch to Nesterov at the same β — the look-ahead gradient starts pulling back sooner, which is why NAG tends to tolerate higher β before it starts bouncing.

Worked example

Starting at (4,1)(4,1) on f(x,y)=x2+10y2f(x,y)=x^2+10y^2, with η=0.045\eta=0.045, β=0.7\beta=0.7, velocity initially zero:

  1. Step 1 is identical to Momentum

    θ~=(4,1)0.045(0.7)(0,0)=(4,1)\tilde\theta = (4,1) - 0.045(0.7)(0,0) = (4,1), so the gradient there is (8,20)(8,20), giving v=(8,20)v'=(8,20) and θ=(4,1)0.045(8,20)=(3.64,0.1)\theta' = (4,1)-0.045(8,20) = (3.64, 0.1) — exactly Momentum's first step.

  2. Step 2's look-ahead point is new

    θ~=(3.64,0.1)0.045(0.7)(8,20)=(3.64,0.1)(0.252,0.63)=(3.388,0.53)\tilde\theta = (3.64,0.1) - 0.045(0.7)(8,20) = (3.64,0.1) - (0.252, 0.63) = (3.388, -0.53)

  3. Evaluate the gradient there, not at (3.64, 0.1)
    f(3.388,0.53)=(2×3.388, 20×(0.53))=(6.776, 10.6)\nabla f(3.388,-0.53) = (2 \times 3.388,\ 20\times(-0.53)) = (6.776,\ -10.6)
  4. Finish the update

    v=0.7(8,20)+(6.776,10.6)=(12.376,3.4)v' = 0.7(8,20)+(6.776,-10.6) = (12.376, 3.4), so θ=(3.64,0.1)0.045(12.376,3.4)=(3.08308,0.053)\theta' = (3.64,0.1) - 0.045(12.376,3.4) = (3.08308, -0.053) — already noticeably different from Momentum's second step, (3.0604,0.62)(3.0604, -0.62), purely from evaluating the gradient one point ahead.

Checkpoint

Using Nesterov, tune β so the point gets within 0.3 of the bottom of the ravine in 10 steps or fewer.

Step 0 / 10 — distance to bottom = 4.12
0/10 steps used
Take a step to try it
Summary
θ~=θηβv,v=βv+f(θ~),θ=θηv\tilde\theta=\theta-\eta\beta v,\qquad v'=\beta v+\nabla f(\tilde\theta),\qquad \theta'=\theta-\eta v'

Nesterov keeps every piece of Momentum's machinery and changes exactly one thing: where the gradient gets evaluated. That single change is enough to correct overshoot earlier, which is why Adam and most modern optimizers offer a Nesterov-style variant as a near-free upgrade over plain momentum.