Log inStart free
LESSON 2.31 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Learning-rate schedules and warmup

Watch one weight blow up, warm up, then settle as its learning rate changes.


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

Go Pro · $8.25/mo
EXPLAINER · 2.31 · SCHEDULE BAYRATE 0.50 · GRADIENT 8.88 · STEP −4.44
01
Stage 1 of 5 · Take a step
A mini-batch of 4 examples gives the gradient ĝ = 8.88. The learning rate η = 0.5 scales it: w moves by −4.44.
Explain it simply

You see one weight, w, on its loss curve. The four bright bars below are this step's batch of examples, and they give a slope, the gradient. The learning rate sets how far each step goes: here 0.5 times 8.88. So w jumps 4.44, right past the bottom.

The weight w starts at 2.00. The batch gradient is 8.88. With the learning rate 0.5, the step moves w to −2.44.

example, batchweight w, learning rate ηgradient, overshoot, noiselosssafe limit 2 / L″
learning rate η per steploss curve L(w)loss per step (log)00.510204060step t0204060safe limit at step 0: 0.16η_max = 0.5−3−2−10123w0510ĝ = 8.88 (true 8.40)η·ĝ = 0.5 × 8.88 = 4.44aᵢā = −0.480.0000010.00010.011100step tlearning rate η per steploss curve L(w)loss per step (log)00.510204060step t0204060safe limit at step 0: 0.16η_max = 0.5−3−2−10123w0510ĝ = 8.88 (true 8.40)η·ĝ = 0.5 × 8.88 = 4.44aᵢā = −0.480.0000010.00010.011100step t
Toy: 1 weight w · loss ¼w⁴ + 0.1w² · 32 examples · batches of 4 · 60 steps of SGD
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
wt+1=wt−ηt g^t,g^t=wt3+0.2 wt−aˉtw_{t+1} = \sy{w}{param}{w_t} - \sy{eta}{param}{\eta_t}\,\sy{g}{grad}{\hat g_t},\qquad \sy{g}{grad}{\hat g_t} = w_t^3 + 0.2\,w_t - \sy{abar}{data}{\bar a_t}
g^0=8.00+0.40−(−0.48)=8.88,w1=2.00−0.5⋅8.88=−2.44\hat g_0 = 8.00 + 0.40 - (-0.48) = 8.88,\quad w_1 = 2.00 - 0.5\cdot 8.88 = -2.44

The new weight is the old weight minus the rate times the batch gradient.

Common mix-ups

MYTHA higher learning rate always trains faster.

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

Predict, then reveal
3 CHECKS · PRO
Q01With a peak rate of 0.1 and no warmup, does the run blow up?

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

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 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.