LearnBenchStart learning →

AI Research Scientist · Scaling Laws & Stability

Numerical precision and mixed-precision failure modes

Real lesson card · Page 1 of 4

Numerical precision and mixed-precision failure modes

fp16 overflow

fp16 uses only 5 exponent bits, capping representable magnitude near 6550465504. When a gradient or activation’s magnitude exceeds that ceiling in a forward or backward pass, the value clips to infinity or NaN instead of a large finite number.
Example
An attention score climbing to 7000070000 during training becomes inf in fp16; the next multiply turns it into NaN, corrupting the loss and halting learning.

Recall check from the same lesson

If an fp16 run instead shows gradient norms silently plateauing near zero rather than NaN losses, scaling the loss upward before backward() would help because it shifts those small gradients into fp16's representable range, and then dividing the gradients back down by the same factor before the optimizer step restores their true magnitude.

Sources

· Editorial policy

One sitting · 20–30 minutes

A focused session on your AI Research Scientist interview

LearnBench starts from what you already know — skip what you have, master what you’re missing.

Start now

More Scaling Laws & Stability questions