FP8

Also known as: 8-bit floating point · E4M3 · E5M2

On this page 7

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.

PropertyE4M3E5M2
Bit layout1 sign, 4 exponent, 3 mantissa1 sign, 5 exponent, 2 mantissa
Exponent bias715
Largest normal value44857,344
Smallest subnormal value2 to the power of minus 92 to the power of minus 16
InfinityNot representedRepresented
Typical roleWeights and activationsGradients
E4M3 and E5M2 compared

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.

StrategyScale shared byMain trade-off
Per-tensor delayed scalingWhole tensor, from amax historyCheap, but sensitive to sudden outliers
Per-tensor current scalingWhole tensor, from current amaxMore accurate, needs an extra reduction
Per-channel or per-tokenOne row or columnHandles uneven channels well
Block-wise scalingTiles such as 128 by 128Robust training at large scale
MXFP8 microscalingBlocks of 32 values with a power-of-two scaleHardware support required, as on Blackwell
FP8 scaling strategies

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.

FormatBitsTypical useRelative tensor throughput
FP3232Master weights, accumulationLowest
bfloat1616Default mixed-precision trainingBaseline
FP1616Inference, older training recipesBaseline
FP88Training and inference of large modelsAbout 2 times baseline
INT88Quantized inferenceAbout 2 times baseline
FP44Low-cost inference on newer chipsAbout 4 times baseline
FP8 in the family of AI number formats

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.

GoalRecommended setupReason
Pretraining a large transformerHybrid E4M3 and E5M2 with block scalingSpeed with stable loss curves
Serving a model on Hopper-class GPUsE4M3 weights and activationsHalves memory, raises batch size
Reducing KV cache memoryFP8 KV cacheLonger contexts on the same hardware
Older GPUs without FP8 unitsbfloat16 or INT8No native FP8 speedup
Accuracy-critical small modelbfloat16Savings rarely justify the risk
Choosing an FP8 setup

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.