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

The optimizer race

Five optimizers race down one loss surface with a ravine and a saddle point.


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.C2 · OPTIMIZER BAYGD · RATE 0.08 · |W₁| ≥ 1 AT STEP 53
01
Stage 1 of 6 · Gradient descent
Gradient descent steps by −η∇L down the objective L. At learning rate η = 0.08, it zigzags, then crawls past the saddle point.
Explain it simply

The map shows the loss L for every pair of weights. Darker means higher. Each of 8 examples tilts the surface a bit, and L is their average. Gradient descent steps downhill, times the learning rate. It zigzags across the steep walls. Then the floor is nearly flat, so it crawls past the saddle point.

A contour map of L with a saddle at (0, 0) and minima at (2, 0) and (−2, 0). GD starts at (0.02, 1.2) with learning rate 0.08. It reaches w₁ = 1 at step 53, and its loss at step 100 is < 0.0001.

examples and their tiltsweights w, their moves, decayloss, gradients, noisevelocity v
objective L(w): the mean loss of 8 examplesloss L per step (log scale)the 8 examplesthe race board−3−2−10123−101w₁w₂1411saddle L = 1min L = 0min L = 0start w₀ = (0.02, 1.2)w₂ × (1 − 20η) = −0.6 each stepw₁ × (1 + η) = 1.08 each stepGD10110⁻¹10⁻²10⁻³10⁻⁴0255075100step53< 0.0001GD 2.26optimizer|w₁| ≥ 1 atL at 100each example tilts L by aᵢ·w12345678the 8 tilts add to (0, 0)so L is the plain surfaceobjective L(w): the mean loss of 8 examplesloss L per step (log scale)the 8 examplesthe race board−3−2−10123−101w₁w₂1411saddle L = 1min L = 0min L = 0start w₀ = (0.02, 1.2)w₂ × (1 − 20η) = −0.6 each stepw₁ × (1 + η) = 1.08 each stepGD10110⁻¹10⁻²10⁻³10⁻⁴0255075100step53< 0.0001GD 2.26optimizer|w₁| ≥ 1 atL at 100each example tilts L by aᵢ·w12345678the 8 tilts add to (0, 0)so L is the plain surface
Toy: 2 weights · 8 examples · 100 steps · AdamW λ = 0.5
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
wt+1=wt−η ∇L(wt),L(w)=18∑iℓi(w)\sy{w}{param}{w_{t+1}} = \sy{w}{param}{w_t} - \sy{eta}{param}{\eta}\,\sy{grad}{grad}{\nabla L(w_t)},\qquad \sy{L}{grad}{L(w)} = \tfrac{1}{8}\textstyle\sum_i \ell_i(w)
w1=(0.02, 1.2)−0.08⋅(−0.02, 24)=(0.022, −0.72),1−20η=−0.6\sy{w}{param}{w_1} = (0.02,\ 1.2) - 0.08\cdot(-0.02,\ 24) = (0.022,\ -0.72),\quad 1 - 20\eta = -0.6

Step against the gradient of the mean loss, scaled by η.

Common mix-ups

MYTHOne optimizer stays ahead at every step.

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

Predict, then reveal
3 CHECKS · PRO
Q01Set η to 0.11. What does plain gradient descent do?

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.