What is FP8?
8-bit floating-point formats: E4M3 (4 exponent, 3 significand bits) and E5M2 (5 exponent, 2 significand bits), chosen to trade precision against range. Used to make AI training and inference faster and more power-efficient.
Field: Computer Arithmetic
Japanese name: FP8
The two layouts
Both FP8 formats have a sign bit; they differ in how the other seven bits are split. E4M3 has a 4-bit exponent and 3-bit significand; in the widely used definition it gives up infinities and keeps only one NaN pattern per sign in order to extend its largest finite value to 448. E5M2 has a 5-bit exponent and 2-bit significand and follows IEEE 754 conventions with infinities and NaNs, reaching 57344. With 3 significand bits, adjacent E4M3 values within a binade differ by 12.5 percent of the binade's lower bound; with 2 bits, E5M2 steps are 25 percent.
Which format for which tensor
Weights and activations in a trained network usually have a fairly predictable spread of magnitudes, so the extra precision of E4M3 is worth more than range. Gradients during backpropagation can vary over many orders of magnitude between layers and steps, so E5M2's extra exponent bit matters more there. A common recipe is therefore E4M3 for the forward pass and E5M2 for gradients, though some systems use E4M3 throughout. Either way, only the matrix multiply inputs are FP8; master weights, optimizer state and many sensitive operations remain in higher precision.
Scaling factors are essential
Eight bits cannot cover the values of a real tensor without help. Before casting, software multiplies each tensor, or each block of a tensor, by a scale factor chosen from its recently observed maximum absolute value, so that the largest elements land near the top of the FP8 range and small ones are not flushed to zero. The scale is stored in higher precision and divided out after the matrix multiply. Matrix units multiply the FP8 inputs but accumulate products in a wider format, such as FP16 or FP32, so long dot products do not lose precision step by step.
FP8 vs. INT8
INT8 quantization spaces its 256 values uniformly, which suits tensors with a bounded, even distribution but wastes resolution when a few outliers set the scale. FP8 values are spaced roughly logarithmically, with fine steps near zero and coarse steps for large magnitudes, which better matches the bell-shaped distributions with long tails common in neural networks and often reduces calibration effort. Both halve memory and bandwidth relative to 16-bit formats and allow more multiply-accumulate units per area and watt. Which is more accurate depends on the model.
Try it: questions about FP8
- AE4M3 for weights and activations, E5M2 for gradients
- BBoth have the same precision and range, so they are used interchangeably
- CE4M3 is used as an integer and E5M2 as a floating-point number
Show answer and explanation
Answer: A. E4M3 for weights and activations, E5M2 for gradients
How the scarce 8 bits are split between exponent and significand determines the format's character. E4M3 has one more significand bit, giving more precision but less range; E5M2 has one more exponent bit, giving more range but less precision. E4M3 is therefore typically used for weights and activations, whose magnitudes are fairly uniform, and E5M2 for gradients, whose magnitudes vary widely. Some systems use E4M3 throughout. Both are floating-point formats, not integers.
FAQ
What is the difference between E4M3 and E5M2?
E4M3 uses 4 exponent bits and 3 significand bits, giving more precision but a smaller range, with a maximum of 448. E5M2 uses 5 exponent bits and 2 significand bits, giving a much wider range but coarser steps.
Why does FP8 training need scaling factors?
FP8's representable range is so narrow that unscaled tensors would overflow or underflow. A per-tensor or per-block scale shifts the values into the usable range before conversion and is removed after the computation.
Is FP8 better than INT8 for inference?
Not universally. FP8 handles wide, outlier-prone value distributions with less calibration, while INT8 is widely supported and accurate for many models when quantized carefully.
Books on Computer Arithmetic Ad
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.
Back to the glossary