3.2.3 · D3Training Deep Networks

Worked examples — Momentum and Nesterov momentum

2,871 words13 min readBack to topic

Before anything, let us re-anchor the two machines in plain words. Each symbol is earned here so you never have to scroll up.

Throughout, our test loss is the simplest bowl, , whose gradient is . A bowl is chosen because its gradient literally equals the position, so you can read off the slope by looking at where the bead sits — no calculus needed each line. (This bowl is the 1-D face of the ill-conditioning story.)


The scenario matrix

Every situation this topic throws at you falls into one of these cells. Each worked example below is tagged with the cell(s) it covers.

# Cell class What is special Covered by
A Consistent gradients, same sign velocity accumulates, effective step grows Ex 1
B Alternating gradients (steep valley) velocity cancels, stays small Ex 2
C Nesterov look-ahead on a bowl look-ahead gradient is smaller, gentler step Ex 3
D Zero / degenerate input ( or ) update collapses to a known simpler case Ex 4
E Limiting value high, steady effective LR , saturation Ex 5
F Overshoot: too heavy ball orbits the minimum, sign of flips Ex 6
G Negative-side start / sign symmetry mirror image, signs flip cleanly Ex 7
H Real-world word problem translate a story into Ex 8
I Exam twist: classical vs Nesterov, same seed show they diverge numerically Ex 9

The worked examples

Look at figure s01: the violet dashed curve is plain GD, the magenta solid curve is momentum. Notice how the two start on top of each other at step 1 (no memory yet), then the magenta curve peels below the violet one — that widening gap is the accumulated velocity. The orange dotted line is the target ; watch how much sooner magenta approaches it.

Figure — Momentum and Nesterov momentum

Look at figure s02: the violet bars are the raw gradients (they never shrink); the magenta bars are the velocity . The two orange dotted guides at and mark the band the velocity never escapes — that boundedness is the cancellation. See how the magenta bar at step 2 collapses almost to zero while the violet bar is still at full height.

Figure — Momentum and Nesterov momentum

Look at figure s03: the navy curve is the loss bowl. The magenta dot sits at the current point (slope ); the violet arrow "peek" carries you left to the orange dot at , whose slope is visibly gentler because it is lower on the bowl. The whole trick is reading the slope at the orange dot, not the magenta one.

Figure — Momentum and Nesterov momentum

Look at figure s04: the magenta curve is the velocity climbing step by step; the orange dashed line is the ceiling . Notice the curve bends over and hugs the ceiling rather than crossing it — that flattening is the geometric -decay of the error closing the gap.

Figure — Momentum and Nesterov momentum

Look at figure s05: the magenta curve is for the heavy ball; watch it dive, cross the orange dotted zero-line at step 5, and swing to the far negative side — a growing orbit, never parking. The violet dashed curve is the well-behaved run from Ex 1 for contrast, which settles calmly toward zero.

Figure — Momentum and Nesterov momentum

Look at figure s06: the magenta curve is the negative-start run and the violet dashed curve is Ex 1's positive-start run; the orange dotted horizontal is . Notice the two curves are perfect mirror images across that zero-line — each magenta point is exactly the reflection of its violet twin, which is the odd symmetry made visual.

Figure — Momentum and Nesterov momentum

Recall Self-test: which cell is this?

A gradient stream reads . Which matrix cell, and what happens to velocity? ::: Cell B — alternating; velocity stays small and bounded because opposite signs cancel. You set . What does the update become? ::: Cell D3 — plain gradient descent, . Constant gradient , . Steady velocity? ::: (Cell E).