3.2.3 · D4Training Deep Networks

Exercises — Momentum and Nesterov momentum

2,407 words11 min readBack to topic

Throughout, we use the parent note's conventions: where ==== is the learning rate (how far one step goes), ==== is the momentum coefficient (how much of the past velocity we keep), and is the velocity (a running average of gradients). We always start with unless told otherwise.


Level 1 — Recognition

Recall Solution

The symbol is , the momentum coefficient, with .

  • If : — no memory, we are back to plain gradient descent.
  • As : the sum keeps more and more old gradients (each weight decays slowly), so the ball gets "heavier". scales the step size, not the memory — so the answer is .
Recall Solution

Recall , the gradient at the starting point. . Step . Notice this is exactly the plain-GD step . Why? With no accumulated history (), momentum has nothing to add on the first step. This is the "slow start" the parent note warns about — not a bug.


Level 2 — Application

Recall Solution

The gradient is just the current , so . Keep every digit — small roundings compound.

  • ; .
  • (exactly , not ); .
  • ; . Compare to plain GD (): it would give . Momentum reaches at step 3 — visibly ahead, because consistent-sign gradients keep adding into .

Read the figure (s01): the amber momentum curve dives below the cyan plain-GD curve after step 2. That gap is the accumulated velocity : because never changes sign on the way down, each new gradient adds to instead of cancelling, so the step keeps growing while plain GD's step shrinks with . The amber arrow marks exactly where momentum overtakes.

Figure — Momentum and Nesterov momentum
Recall Solution

At the fixed point , so and The step is , so That is a 10× amplification of the raw learning rate along a consistent direction — the parent note's "10× speed-up".


Level 3 — Analysis

Recall Solution
  • .
  • .
  • .
  • . The velocity stays small and bounded: for an alternating unit gradient the worst case is a geometric sum , but the sign flips keep it hovering near instead. Compare a consistent-sign coordinate where . So momentum shrinks the oscillating direction relative to the consistent one — exactly the ill-conditioning cure.

Read the figure (s02): the cyan bars are the raw gradients; the amber bars are the velocity . Watch the amber bars stay pinned near zero (about at most) while the dotted white line at marks where velocity would sit if the gradients all agreed. The visual message: the same that would give a boost gives almost nothing here — that selectivity is the whole point.

Figure — Momentum and Nesterov momentum
Recall Solution

Plain GD gives . This shrinks to iff , i.e. Now imagine two coordinates with curvatures (steep) and (flat). The steep coordinate needs to not diverge; the flat one converges at rate . Because is shared, the steep constraint caps , making the flat direction crawl at rate where is the condition number (see Hessian and Condition Number). Large ⇒ painfully slow. Momentum fixes this without touching .


Level 4 — Synthesis

Recall Solution

Step 1: . Gradient at look-ahead . ; . (Identical to classical — .) Step 2: . Gradient at look-ahead (smaller than the classical uses). ; . Compare: classical (from L2.1, computed exactly) had . Nesterov's is smaller because it evaluated the gradient at the anticipated, closer-to-minimum point rather than at . It aims a touch gentler → less overshoot. On this simple 1-D bowl classical actually lands marginally closer this single step ( vs ), but Nesterov's anticipatory damping pays off on oscillating/ill-conditioned surfaces where classical overshoots.

Recall Solution

Derivation. From we get , and likewise . Substitute into : Multiply by and solve for : The term literally is times the previous step — "keep going the way you were going." Numeric check (fully exact, no rounding). From L2.1, , and . Then Compute each term: and , so This matches L2.1's exactly — there is no discrepancy once we avoid the earlier mis-rounding of . The two formulations (velocity-based and position-based) are algebraically identical.


Level 5 — Mastery

Recall Solution

Use . Solve for : So gives a steady-state amplification, turning a stable into an effective only where gradients agree — precisely the direction-selective boost momentum is for. This is the design logic behind picking as a default.

Recall Solution

(a) Unrolling each: So (with ). Since the update multiplies by , using instead of just rescales the effective learning rate by : . Same direction, same trajectory shape — only is relabelled.

The why behind the normalization. The factor is chosen so the weights sum to one: for a long history the geometric series . That makes a genuine weighted average of past gradients — its scale matches a single gradient, so it is interpretable and comparable across steps. The parent's is an unnormalized sum whose weights instead total ( for ); that is why silently carries the effective-LR boost inside it. Neither is "wrong" — they just push the same factor into different places (into for momentum, into for Adam).

(b) Because is a normalized average, at we have , which underestimates by the factor (e.g. for ): the average hasn't "filled up" its window yet, so it is diluted toward the zero we initialised with. Bias correction exactly cancels that dilution. Plain momentum's is not normalized, so it never claims to be an average and simply "accepts a slow start" for the first few steps rather than correcting — that is the parent note's warm-up remark. See Exponentially Weighted Moving Average for the bias-correction algebra.