Log inStart free
LESSON 2.28 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Momentum

Watch a velocity carry gradient descent off a saddle, and past the minimum.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 2.28 · OPTIMIZER BAYstart: loss 15.4 · downhill (0.02, −24)
01
Stage 1 of 6 · A ravine
The loss is a ravine with a saddle point in its floor. At the start, −∇L points down the wall.
Explain it simply

The map shows the loss for two weights, and darker means higher. The walls rise fast across the map, and a floor runs along the middle. The floor sinks from a saddle point in the center, at loss 1, to two lowest points at loss 0. The red arrow at the start points straight down the wall.

A map of the loss L = (w₁² − 4)²/16 + 10w₂². The start is (0.02, 1.2) with loss 15.4. The downhill direction there is (0.02, −24).

weights w and their pathgradient and lossvelocity vloss map: darker is higher
loss map · L(w) = (w₁² − 4)²/16 + 10w₂²−3−2−10123−101w₁: along the floor →w₂saddle L = 1min L = 0min L = 0straight to the minimum−∇L (0.02, −24)start (0.02, 1.2)loss map · L(w) = (w₁² − 4)²/16 + 10w₂²−3−2−10123−101w₁: along the floor →w₂saddle L = 1min L = 0min L = 0straight to the minimum−∇L (0.02, −24)start (0.02, 1.2)
Toy: the 2.C2 ravine L = (w₁² − 4)²/16 + 10w₂² · start (0.02, 1.2) · 100 steps · PyTorch SGD momentum: v = βv + ∇L, w = w − ηv
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
L(w)=116(w12−4)2+10 w22,−∇L=−(14w1(w12−4), 20 w2)\sy{f}{grad}{L}(\sy{th}{param}{w}) = \tfrac{1}{16}(w_1^2 - 4)^2 + 10\,w_2^2,\quad -\sy{g}{grad}{\nabla L} = -\left(\tfrac14 w_1(w_1^2 - 4),\ 20\,w_2\right)
−∇L(0.02, 1.2)=(0.02, −24)-\nabla L(0.02,\ 1.2) = (0.02,\ -24)

Across, the curvature is 20; along the floor, at most 2.

Common mix-ups

MYTHLike a plain step, every momentum step lowers the loss.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01Why not raise η to 0.11 for plain steps, instead of adding momentum?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.