FP8, or 8-bit floating point, is a number format that stores each value in a single byte with a sign bit, an exponent and a mantissa, allowing AI accelerators to double matrix throughput and halve memory traffic compared with 16-bit formats. In AI hardware, FP8 is the main low-precision format for training and inference of large transformer models on data-center GPUs and custom AI chips.
Two encodings dominate: E4M3, with four exponent bits and three mantissa bits, and E5M2, with five exponent bits and two mantissa bits. Both were standardized in the OCP 8-bit floating point specification and are supported natively by NVIDIA Hopper and Blackwell, AMD Instinct MI300 and later, Intel Gaudi and other accelerators.
How FP8 encodes numbers
FP8 follows the same principle as IEEE 754 formats: a value equals the sign times the mantissa times two raised to the exponent minus a bias. With only eight bits, every bit spent on the exponent extends the dynamic range, while every bit spent on the mantissa improves precision between neighboring values. The two FP8 variants make opposite choices in this trade-off.
The table below compares the two standard encodings with their most relevant numeric properties.
| Property | E4M3 | E5M2 |
|---|---|---|
| Bit layout | 1 sign, 4 exponent, 3 mantissa | 1 sign, 5 exponent, 2 mantissa |
| Exponent bias | 7 | 15 |
| Largest normal value | 448 | 57,344 |
| Smallest subnormal value | 2 to the power of minus 9 | 2 to the power of minus 16 |
| Infinity | Not represented | Represented |
| Typical role | Weights and activations | Gradients |
E4M3 gives up infinity and most special encodings to gain one extra binade of range, which is why its maximum is 448 rather than 240. E5M2 keeps IEEE-style special values and behaves like a truncated FP16, which makes conversion from FP16 simple.
Scaling: the key to usable FP8
FP8 cannot represent the range of real tensor values directly, so every practical FP8 workflow relies on scaling factors. A tensor is multiplied by a scale that maps its largest absolute value, the amax, close to the format maximum, then cast to FP8. The scale is stored in higher precision and reapplied after the matrix multiplication, which accumulates in FP32 or at least higher-precision accumulators.
Scaling granularity has become the main design axis, because finer scales protect outliers at the cost of extra metadata and kernel complexity.
| Strategy | Scale shared by | Main trade-off |
|---|---|---|
| Per-tensor delayed scaling | Whole tensor, from amax history | Cheap, but sensitive to sudden outliers |
| Per-tensor current scaling | Whole tensor, from current amax | More accurate, needs an extra reduction |
| Per-channel or per-token | One row or column | Handles uneven channels well |
| Block-wise scaling | Tiles such as 128 by 128 | Robust training at large scale |
| MXFP8 microscaling | Blocks of 32 values with a power-of-two scale | Hardware support required, as on Blackwell |
NVIDIA’s Transformer Engine popularized delayed scaling, which estimates the scale from a history of amax values in previous iterations. Later practice shifted toward finer-grained block scaling, which tolerates the activation outliers common in large language models.
FP8 among other low-precision formats
FP8 sits between 16-bit formats, which are the safe default for training, and 4-bit formats, which push density further at a higher accuracy risk. Choosing a format means weighing throughput, memory footprint and numerical robustness for each part of the model.
| Format | Bits | Typical use | Relative tensor throughput |
|---|---|---|---|
| FP32 | 32 | Master weights, accumulation | Lowest |
| bfloat16 | 16 | Default mixed-precision training | Baseline |
| FP16 | 16 | Inference, older training recipes | Baseline |
| FP8 | 8 | Training and inference of large models | About 2 times baseline |
| INT8 | 8 | Quantized inference | About 2 times baseline |
| FP4 | 4 | Low-cost inference on newer chips | About 4 times baseline |
Compared with INT8, FP8 has a non-uniform grid that represents both very small and large values in one tensor, so it usually needs less calibration and works for gradients during training. INT8 remains attractive for inference on hardware without FP8 units.
Using FP8 in training and inference
In practice, FP8 is applied selectively. Large matrix multiplications in attention projections and feed-forward layers run in FP8, while sensitive operations such as softmax, normalization, loss computation and optimizer states stay in higher precision. The common hybrid recipe uses E4M3 in the forward pass and E5M2 for gradients in the backward pass.
The following decision table summarizes typical choices for common deployment goals.
| Goal | Recommended setup | Reason |
|---|---|---|
| Pretraining a large transformer | Hybrid E4M3 and E5M2 with block scaling | Speed with stable loss curves |
| Serving a model on Hopper-class GPUs | E4M3 weights and activations | Halves memory, raises batch size |
| Reducing KV cache memory | FP8 KV cache | Longer contexts on the same hardware |
| Older GPUs without FP8 units | bfloat16 or INT8 | No native FP8 speedup |
| Accuracy-critical small model | bfloat16 | Savings rarely justify the risk |
Real speedups depend on arithmetic intensity. Memory-bound layers gain mainly from the smaller data size, while compute-bound matrix multiplications gain from the roughly doubled tensor core peak. End-to-end training gains are therefore usually lower than the peak ratio suggests.
Limitations and failure modes
FP8 is powerful but unforgiving, and most problems trace back to range or precision loss in specific tensors. Practitioners watch for the following issues.
- Overflow and underflow occur when scales lag behind changing tensor statistics.
- Activation outliers in large language models can force a coarse scale that crushes small values.
- Long training runs may diverge late even when early loss curves match bfloat16.
- Vendor differences in rounding, saturation and NaN handling affect reproducibility.
- Software support varies, so not every operator or framework path has an FP8 kernel.
The safest approach is to validate against a bfloat16 baseline on the same data and to monitor amax statistics, loss spikes and downstream accuracy throughout the run.
In plain words
Computers store numbers using bits. More bits mean more exact numbers but slower work. FP8 uses only 8 bits per number, a quarter of the usual 32.
Think of it as writing prices rounded to fewer digits. You lose some detail, but you can carry far more lists at once. AI chips use FP8 to train and run large models faster and with less memory. A scaling trick keeps the rounded numbers in a useful range, so the model still learns correctly.
A real-world example
A research team pretrains a language model with about 30 billion parameters on a cluster of Hopper-class GPUs. With bfloat16, a planned run would take roughly six weeks. The team enables FP8 for the attention and feed-forward matrix multiplications, keeping normalization, softmax and the optimizer in higher precision.
They use E4M3 for weights and activations, E5M2 for gradients and block-wise scaling. Before committing, they train a smaller model for a few billion tokens in both precisions and confirm that the loss curves stay within normal run-to-run variation.
The full FP8 run delivers about 30 to 40 percent higher training throughput, shortening the schedule by more than a week. The team saves substantial GPU hours while the final benchmark scores match the bfloat16 reference within noise.