- Key idea
- How each format splits its bits between exponent and mantissa, and what that costs in range and precision
- Real world
- A camera with a fixed number of pixels can capture a wide landscape (range) or zoom in on a face (detail), but not both. Each format picks a point on that trade-off.
- In an LLM
- Models are trained in bf16, served in bf16 or fp8, and squeezed into 4-bit formats for laptops and phones. Knowing what each one can and can’t represent explains which parts of a model break first.
The family
| Format | Sign | Exponent | Mantissa | Largest value | Relative precision | Used for |
|---|---|---|---|---|---|---|
| fp32 | 1 | 8 | 23 | ~ | master weights, optimizer states, sums | |
| fp16 | 1 | 5 | 10 | 65,504 | ~ | older training and inference |
| bf16 | 1 | 8 | 7 | ~ | training and serving today | |
| fp8 E4M3 | 1 | 4 | 3 | 448 | ~6% | weights and activations |
| fp8 E5M2 | 1 | 5 | 2 | 57,344 | ~12% | gradients |
| fp4 E2M1 | 1 | 2 | 1 | 6 | ~25% | block formats like MXFP4, NVFP4 |
“E4M3” just means 4 exponent bits and 3 mantissa bits.
Try it
Move the slider to choose a number and watch which formats store it well, which round it coarsely, and which overflow.
bf16: range over precision
bf16 (“brain float”, from Google Brain) is fp32 with the bottom 16 mantissa bits chopped off. It keeps all 8 exponent bits, so it has exactly fp32’s range, but only 7 mantissa bits, so roughly 2–3 significant decimal digits.
fp16 spends the same 16 bits differently: 5 exponent bits and 10 mantissa bits. More precise, but its largest number is 65,504 and anything below about is zero.
For training, range turned out to matter more. Gradients and activations vary over many orders of magnitude; in fp16 they overflow or underflow unless you carefully rescale them (loss scaling). In bf16 they simply fit. So modern LLMs are trained in bf16, with sums and optimizer states in fp32.
A 12-megapixel camera can photograph a whole mountain range with each pixel covering a metre, or one face with each pixel covering a fraction of a millimetre. Same pixel budget, different trade-off. bf16 is the wide-angle lens; fp16 is the zoom.
Some LLMs develop a few enormous activation values in specific channels, sometimes in the thousands, and attention logits can grow large too. Multiply two such numbers and you can exceed 65,504, giving infinity, then NaN, and training or inference silently produces garbage. Several open models released in bf16 produce NaNs when naively run in fp16 for exactly this reason. bf16 would need values beyond to overflow.
fp8: two flavours
With only 8 bits, you can’t have both. The FP8 standard used by NVIDIA, AMD and Intel defines two:
- E4M3: more precision, range up to 448. It gives up infinity entirely to gain one extra binade. Used for weights and activations in the forward pass.
- E5M2: more range, up to 57,344, with IEEE infinity and NaN. Used for gradients, which vary more.
Because fp8’s range is small, every tensor (or block of values) gets its own scale factor so its values land in the representable region. That idea, a cheap format plus a scale, is the same one integer quantization uses: what quantization is.
fp4: fifteen numbers
E2M1 has 16 bit patterns. With a sign bit, those give : 15 distinct values (+0 and −0 are both zero). On its own that is useless for weights. With a shared scale per block of 16 or 32 values it becomes MXFP4 and NVFP4, the 4-bit formats of the newest GPUs: see FP8, MXFP4 and NVFP4.
Integers in the same picture
Integer formats (int8, int4) have no exponent at all: all their bits are mantissa, and every value is evenly spaced. In the widget, they store every whole number in range exactly and nothing in between. That makes integer hardware simple and fast, and it is why integer quantization depends entirely on a well-chosen scale.
Where this shows up
- The layout behind every row: floating point.
- Scales turn a coarse grid into a useful one: what quantization is.
- Block-scaled 4- and 8-bit floats on current hardware: FP8, MXFP4 and NVFP4.
- Training in bf16 and fp8: training in low precision.
Exact limits
| Format | Bias | Max | Min normal | Min subnormal | |
|---|---|---|---|---|---|
| fp32 | 127 | ||||
| fp16 | 15 | 65,504 | |||
| bf16 | 127 | ||||
| E4M3 | 7 | 448 | |||
| E5M2 | 15 | 57,344 | |||
| E2M1 | 1 | 6 | 1 | 0.5 |
E4M3 keeps the all-ones exponent for ordinary numbers and reserves only the single pattern S.1111.111 for NaN, which is why its maximum is rather than 240. Conversions into E4M3 usually saturate (clamp to ±448) instead of producing infinity.
In papers
Micikevicius et al., 2022 define the E4M3 and E5M2 formats and show that, with per-tensor scaling, FP8 training matches bf16 on models up to 175B parameters. DeepSeek-V3 was trained largely in FP8 with fine-grained (block-wise) scaling (DeepSeek-AI, 2024). The OCP Microscaling spec (Rouhani et al., 2023) defines MXFP8, MXFP6 and MXFP4 as blocks of 32 elements sharing a power-of-two scale.