Summary
A floating-point format spends bits on magnitude range and local precision. More exponent bits do not preserve smaller relative updates.
Round to FP16 and BF16 using round-to-nearest-even. Both use sixteen bits, but FP16 has ten fraction bits and BF16 has seven. Which format retains more of this change from one?
FP16 vs. BF16: range vs. precision
For normal values, decode sign , fraction and unbiased exponent as . With fraction bits, spacing within is .
Same storage, different rounded value
Actual rounded bit fields for 1.003
FP16: 1 sign + 5 exponent + 10 fraction
More fraction bits make nearby values finer; fewer exponent bits narrow the normal range.
| Field | Bits | What those bits buy |
|---|---|---|
| Exponent | 5 | normal magnitudes ≈ 6.10 × 10−5 to 6.55 × 104 |
| Fraction | 10 | next value after 1 is 1 + 2−10 ≈ 1.00098 |
Failure mode: values below the narrow range become subnormal, then zero.
BF16: 1 sign + 8 exponent + 7 fraction
More exponent bits preserve FP32-like range; fewer fraction bits make nearby values coarser.
| Field | Bits | What those bits buy |
|---|---|---|
| Exponent | 8 | normal magnitudes ≈ 1.18 × 10−38 to 3.39 × 1038 |
| Fraction | 7 | next value after 1 is 1 + 2−7 ≈ 1.00781 |
Failure mode: updates can round away because adjacent values are farther apart.
Reference drawing
Same storage, different rounded value
Spend bits on range or resolution; distinguish rounding, overflow, and scaled-integer saturation
Derivation
FP16: 1 sign + 5 exponent + 10 fraction
More fraction bits make nearby values finer; fewer exponent bits narrow the normal range.
| Field | Bits | What those bits buy |
|---|---|---|
| Exponent | 5 | normal magnitudes ≈ 6.10 × 10−5 to 6.55 × 104 |
| Fraction | 10 | next value after 1 is 1 + 2−10 ≈ 1.00098 |
Failure mode: values below the narrow range become subnormal, then zero.
BF16: 1 sign + 8 exponent + 7 fraction
More exponent bits preserve FP32-like range; fewer fraction bits make nearby values coarser.
| Field | Bits | What those bits buy |
|---|---|---|
| Exponent | 8 | normal magnitudes ≈ 1.18 × 10−38 to 3.39 × 1038 |
| Fraction | 7 | next value after 1 is 1 + 2−7 ≈ 1.00781 |
Failure mode: updates can round away because adjacent values are farther apart.
References: NVIDIA's IEEE 754 overview, Google Cloud's BF16 documentation, and the BFLOAT16 study.
In , FP16 spacing is . BF16 spacing is , eight times wider.
| Format | Rounded | Absolute error |
|---|---|---|
| FP16 | ||
| BF16 |
These are rounding errors in a fixture, not measurements of model quality.
Change the numerical requirement
1. Prioritize range
New task: store with the same rounding rule.
Picture and change: inspect the exponent range rather than only spacing near one.
Check: FP16 overflows because its largest finite value is . BF16 rounds to finite , not exact .
Use when: activations exceed FP16 range and BF16 rounding is acceptable for the application.
2. Store scaled integers
New task: store as signed INT8 with scale and zero point zero.
Picture and change: compute , then reconstruct . This is scaled integer quantization, not an exponent/fraction format.
Check: reconstructs , with error . Scale reconstructs exactly but narrows the representable range. For 1024 raw values, INT8 uses 1024 bytes versus BF16’s 2048 bytes, excluding metadata.
Use when: storage or bandwidth motivates quantization and calibration can establish a suitable scale.
Saturation is not rounding noise
At scale , exceeds INT8’s largest code. Clamping reconstructs instead. Finer rounding within the existing range cannot recover the clipped value.
Try the next exponent interval
What is BF16 spacing within ?
Check your answer
It is . Increasing the exponent doubles spacing while the fraction width stays fixed.
The standard layouts
The table gives approximate finite endpoints and normal minima. FP8 rows use the E4M3 finite-endpoint and E5M2 conventions described in FP8 Formats for Deep Learning.
| Format | Stored bits | Exponent / fraction | Largest finite magnitude | Smallest positive normal |
|---|---|---|---|---|
| FP32 | 32 | 8 / 23 | ||
| FP16 | 16 | 5 / 10 | ||
| BF16 | 16 | 8 / 7 | ||
| TF32 multiply input precision | FP32 storage | 8 / 10 | Approximately FP32 range | Approximately FP32 normal range |
| FP8 E4M3 | 8 | 4 / 3 | ||
| FP8 E5M2 | 8 | 5 / 2 | ||
| Signed INT8 | 8 | Neither | Codes through | Scale-dependent step |
| FP64 | 64 | 11 / 52 |
FP16’s smallest positive subnormal is , below its normal minimum. Actual operations may flush subnormals to zero; representable values and hardware behavior are separate questions.
TF32: a hybrid for matmul accumulation
TF32 is an internal multiply-input precision, not a packed nineteen-bit tensor dtype. Its reduced fraction precision and FP32 accumulation describe separate stages. Check the actual operation, library version and enabled precision policy; defaults and speedups are not universal.
FP8: the new training format
OFP8 E4M3 has more fraction precision and a smaller finite range than E5M2. E4M3’s finite-endpoint convention has no infinity encoding; E5M2 includes infinities. Other FP8 variants have different endpoint conventions. Scaling, tensor placement and accumulation precision are part of a training recipe, not implied by the bit count.
INT8: the inference format
Affine quantization adds a zero point : . Reconstruction is . Per-tensor, per-channel and grouped scales trade metadata and kernel support against quantization error.
INT4 / NF4 / GPTQ: aggressive inference quantization
INT4 stores sixteen codes; its reconstruction depends on scales and zero points. NF4 uses nonuniform levels motivated by a normal-weight distribution. GPTQ and AWQ are distinct quantization methods, not scalar floating-point formats. Evaluate the actual model, calibration distribution, kernels and downstream quality.
Choosing precision by operation
| Task | Format |
|---|---|
| Training | Select parameter, activation, reduction and optimizer-state precision separately |
| FP16 backward | Consider loss scaling; unscale before clipping and optimizer updates |
| BF16 backward | Broader range often avoids loss scaling, but coarse updates can still disappear |
| Inference | Check weight, activation and KV-cache quantization independently |
| Memory-limited deployment | Include scales, metadata, workspace and kernel support, not only raw weight bits |
Common pitfalls
Loss scaling does not repair low-precision master-weight rounding or incorrect arithmetic. Reduced-precision optimizer states need a validated recipe; FP32 is not a universal theorem or the only workable choice. Throughput comparisons must state format, sparsity, operation and workload.
Related
- Mixed precision training. Practical training in FP16/BF16.
- Quantization. Inference quantization in depth.
- GPU memory hierarchy. Why bandwidth matters.