Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
bf16 keeps fp32's 8-bit exponent so it matches fp32's dynamic range with less precision. fp16 has only a 5-bit exponent and overflows on values fp32 and bf16 handle fine.
Picture a 16-character licence plate. You can spend characters on the year of the car or on the unique serial. fp32 has 32 characters and lots of room for both. bf16 and fp16 only get 16 characters and have to choose. bf16 spends the same number on year as fp32 does, so it can stamp any year fp32 can, but it has fewer characters left for the serial so two plates can look the same. fp16 spends fewer characters on year and more on serial, so it tells two plates apart more easily but cannot stamp very old or very future years at all. In numerical training that 'year' is dynamic range and 'serial' is precision. bf16 trades precision to keep fp32's range. fp16 keeps more precision but loses range, which is why it needs extra scaffolding to train without overflowing.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: fp32 bit layout + bf16 keeps the 8-bit exponent + fp16 has only 5 exponent bits + why range matters more than precision for training + loss scaling for fp16 + hardware support and default choice for modern training.
| Aspect | fp32 | bf16 | fp16 |
|---|---|---|---|
| Bit layout (sign / exp / mantissa) | 1-8-23 | 1-8-7 | 1-5-10 |
| Dynamic range (approx) | 1e-38 to 1e+38 | 1e-38 to 1e+38 | 6e-8 to 6.5e+4 |
| Decimal precision | ~7 digits | ~2-3 digits | ~3-4 digits |
| Loss scaling needed for training | No | No | Yes |
| Hardware support | Universal | Ampere+, TPU v3+ | Pascal and later |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating bf16 and fp16 as interchangeable. They use different bit budgets, behave differently under gradient updates, and need different training scaffolding.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.