LESSON 6.07 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW
Mixed precision and loss scaling
Watch mixed precision round tiny FP16 gradients to zero, and loss scaling save them.
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/moEXPLAINER · 6.07 · AMP BAY25 WEIGHTS IN FP16 · LOSS 4.0E−9 IN FP32
01
Stage 1 of 6 · Cast and forward
Autocast casts the FP32 weights to FP16 for the matmuls. The loss, 4.0e−9, stays in FP32 by rule; FP16 would round it to 0.
Explain it simply
Mixed precision means training with two sizes of number. Autocast copies the 32-bit weights, the gold dots, into 16-bit numbers for the big multiplications. The blue dots are the outputs. Autocast keeps the loss in 32-bit by rule. Here that matters: 16-bit would turn it into zero.
A log scale of number sizes with the FP16 range shaded. 25 weights and 16 outputs sit in the range. The loss, 4.0e−9, sits in FP32.
weights, updates, Soutputsloss, gradients, infrounded to 0number range
Toy: a 4 → 4 → 1 net, 25 weights, outputs near 0.001, Adam
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Outputs come from 16-bit matmuls, and the loss averages in FP32.
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.