Log inStart free
LESSON 2.29 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

RMSProp and Adam

Watch three optimizers leave a saddle, and see Adam size each step per weight.


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

Go Pro · $8.25/mo
EXPLAINER · 2.29 · OPTIMIZER BAYGD · LR 0.05 · LOSS AFTER 100: 0.122
01
Stage 1 of 6 · One step size
Gradient descent (GD) steps each weight by η times its gradient. At step 1, w₂ moves 1.2, but w₁ moves only 0.001.
Explain it simply

The bands are height lines of the loss, a map of a narrow ravine. It's steep across w₂ and almost flat along w₁, where a saddle sits between two low points. Plain gradient descent steps by η times the slope. So it drops to the floor, then crawls. It needs 83 steps to get halfway off the saddle.

The GD path drops to the ravine floor without crossing it, then crawls along it. After 100 steps the loss is 0.122.

loss map, gradient g, m and vweights, their paths and the step Δwstep with the other bias setting
loss mapL = (w₁² − 4)²/16 + 10w₂²GD · step 1w₁w₂w₁ → · the ravine floor↑ w₂ · curvature 20 acrossloss after 100 steps:start1411saddleminimumminimumw (before the step)0.021.2g = ∇L−0.0224× per step near 01.050Δw = −η·g1.0×10⁻³−1.2GD 0.122Δw₁ 1.0×10⁻³Δw₂ −1.2step 1 · zoom ×0.5loss mapL = (w₁² − 4)²/16 + 10w₂²GD · step 1w₁w₂w₁ → · the ravine floor↑ w₂ · curvature 20 acrossloss after 100 steps:start1411saddleminimumminimumw (before the step)0.021.2g = ∇L−0.0224× per step near 01.050Δw = −η·g1.0×10⁻³−1.2GD 0.122Δw₁ 1.0×10⁻³Δw₂ −1.2step 1 · zoom ×0.5
Toy: the 2.C2 ravine · 2 weights · L = (w₁² − 4)²/16 + 10w₂² · start (0.02, 1.2) · 100 steps each · full gradients
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Δw=−η g\Delta \sy{w}{param}{w} = -\sy{eta}{param}{\eta}\, \sy{g}{grad}{g}
Δw=−0.05⋅(−0.02, 24)=(1.0×10−3, −1.2)\Delta w = -0.05 \cdot (-0.02,\ 24) = (1.0\times 10^{-3},\ -1.2)

Each weight steps by the learning rate times its own gradient.

Common mix-ups

MYTHA bigger gradient makes Adam take a bigger step.

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

Predict, then reveal
3 CHECKS · PRO
Q01If the loss is 10 times larger, what happens to Adam's path?

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 3 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.