NVFP4 buys a 6x smaller rounding error than MXFP4 for a quarter of a bit
1. Representation
A floating point number is made of three parts: a sign, an exponent and a mantissa. It works like scientific notation in base 2. For example, is stored as . Figure 1 lets you flip the bits of a few real formats and see the value they build.
The sign gives the direction of the number. Here the sign bit is , so the number is negative, while would have . The exponent gives the scale, which sets the range the number falls in. With , the number lies in , and would move it up to . The mantissa gives the detail, meaning where exactly the number sits inside that range. With , it sits halfway through , which gives .
The number of mantissa bits decides how many values each range can hold. With mantissa bits (as in E4M3), is split into steps (), so cannot be stored exactly and is rounded to . With a single mantissa bit (as in FP4 E2M1), each range holds only values, so would contain just and . In real FP4 the largest range is , which holds only and . In short, the exponent places the number at the right order of magnitude, and the mantissa pins it down within that magnitude.
1.2 Common formats
The three formats most used in deep learning divide their bits differently between range and detail, as shown in Figure 2. FP32 (E8M23) is the full-precision reference, reaching about with roughly decimal digits of detail. FP16 (E5M10) halves the size and keeps a good amount of detail by cutting the exponent down to bits. Its range stops at , so large values overflow and tiny gradients underflow unless the loss is rescaled. BF16 (E8M7) makes the opposite choice. It keeps the exponent bits of FP32, and with them the same range, but only mantissa bits, about to decimal digits. Since training cares more about range than about fine detail, BF16 became the standard training format.
Bit layouts of FP32, FP16 and BF16: sign, exponent (range) and mantissa (detail)
Precision grows linearly with the number of mantissa bits (Figure 3), and each extra bit adds about decimal digits. Range, on the other hand, does not follow this line. BF16 has fewer digits than FP16 but a far larger maximum, because its bits went to the exponent rather than the mantissa.
Precision vs mantissa bits: decimal digits , with the maximum value of each format
1.3 MXFP4: microscaling FP4
MXFP4 (Microscaling FP4) is a 4-bit format standardized by the Open Compute Project (OCP).1 Each value is stored in FP4 (E2M1), with sign bit, exponent bits and mantissa bit, as shown in Figure 4. With so few bits, FP4 alone can only represent the magnitudes , while real tensors often span many orders of magnitude. The key idea of MXFP4 is therefore scaling. Rather than treating each value on its own, it cuts the tensor into blocks of consecutive values that share one scale factor. Values are divided by the scale before being rounded to FP4 and multiplied back when read, so .
The scale is stored in E8M0, an -bit format made only of exponent bits, so it must be a power of two. The standard picks , which places the largest value of the block near the top of the FP4 range. Power-of-two scales are very cheap in hardware, since multiplying by only shifts the exponent, and sharing one scale across values adds just bit per value, for about bits in total.
For example, take a block containing , , and . Its largest magnitude is and , so the scale is . Dividing by gives , , and , which round to the FP4 values , , and . Multiplying back by gives , , and . The large values survive roughly intact, but disappears entirely and comes back as . Both errors trace back to the two limits of MXFP4: blocks of values, where one large value dictates the scale for all the others, and a scale restricted to powers of two. NVFP4 was designed to fix both.
FP4 (E2M1): sign bit, exponent bits (range) and mantissa bit (precision), and the magnitudes it can represent
1.4 NVFP4
NVFP4 is NVIDIA’s 4-bit format, introduced with the Blackwell GPUs.2 Its values are still FP4 (E2M1) codes, so the difference lies entirely in how they are scaled, which happens on two levels. First, the tensor is cut into blocks of consecutive values, and each block gets its own scale stored in FP8 (E4M3). Second, the whole tensor gets one FP32 scale that brings its values into the range the E4M3 block scales can express. A value is then recovered as (Figure 5).
The block scale is chosen so that the largest value of the block lands on the largest FP4 magnitude, . For example, a block whose largest value is gets , which E4M3 stores as . The value is then encoded as , rounded to , and decoded as , an error of only . The storage cost stays small, since one -bit scale shared by values adds bit per value, for about bits in total.
NVFP4 hierarchy of scales: one FP32 tensor scale, one E4M3 scale per block of values, then the FP4 codes
1.5 NVFP4 vs MXFP4
NVFP4 builds on MXFP4 and fixes its two main limits (Figure 6). The first is the block size. MXFP4 shares one scale across values, so a single large value forces a large scale on the whole block and crushes its small values toward zero. NVFP4 halves the block to values, which gives each scale a more local view of the data and leaves less disparity inside each block.
The second is the scale format. Because E8M0 can only represent powers of two, the ideal scale from the example above must become either or . With , the value becomes and is clipped to , giving . With , it becomes and is rounded to , which also gives . Either way the error is , against with the E4M3 scale of NVFP4. E4M3 covers a much smaller range than E8M0, however, which is why NVFP4 adds the FP32 per-tensor scale on top: the tensor scale restores the global range, while the block scales handle local precision. The price is a slightly larger footprint of about bits per value, against for MXFP4.
The two limits of MXFP4 (large blocks, power-of-two scales) and how NVFP4 fixes them
2. NVFP4 training recipe
In Pretraining Large Language Models with NVFP4,2 NVIDIA pretrained a B-parameter model on trillion tokens in NVFP4 and almost exactly matched the same model trained in FP8, with against on MMLU-Pro. Simply switching every layer to FP4 makes training diverge, though. The result relies on four ingredients, each fixing a specific way in which bits break training.
2.1 Keep sensitive layers in higher precision
Not all layers are equally fragile. The layers at the ends of the network, and above all the last ones that turn the internal representation into the final prediction, need more range and detail than FP4 can offer. The recipe therefore keeps about of the linear layers in BF16, namely the first blocks and the last blocks of the B model, and runs everything else in NVFP4. The price is small, since most of the compute still happens in bits, and it removes the main source of divergence.
2.2 2D block scaling for the weights
During training, each weight matrix is used twice: as in the forward pass and as its transpose in the backward pass. With the usual NVFP4 blocks of values, a block that is a row of becomes a column of , so the two passes would group, scale and round the weights differently. The gradient would then be computed for slightly different weights than the ones actually used in the forward pass. The fix is to scale the weights in square blocks of values (Figure 7). A square block remains the same square after a transpose, so both passes see exactly the same quantized weights. Activations and gradients keep the standard blocks.
2D block scaling: the weights are tiled into blocks with one scale each, so and use the same blocks and the same scales
2.3 Random Hadamard transforms against outliers
Since a block has only one scale, a single outlier sets that scale for all values and pushes the small ones to zero. A Hadamard transform is a rotation that mixes the values of a block together, spreading the energy of the outlier across all of them. For example, with values, becomes . The largest value drops from times the others to about times, which FP4 represents much better. The rotation is exactly reversible, so no information is lost, and random signs are added to the matrix so that no pattern in the data lines up badly with it. The recipe uses transforms and applies them only to the inputs of the weight-gradient computation (Wgrad), the only place where they helped. On the forward pass, they brought no gain.
2.4 Stochastic rounding on gradients
Normal rounding always sends a value to its nearest neighbor, which creates a bias for gradients. FP4 cannot represent , so round-to-nearest turns it into every single time, and small updates silently vanish. Stochastic rounding instead picks one of the two neighbors at random, with the closer one being more likely. Here becomes with probability and with probability , so its average is exactly . Each individual value is noisier, but the errors cancel out over many steps instead of piling up in one direction. The recipe applies it only to gradients. On the forward pass the extra noise would hurt more than the bias does, so weights and activations keep round-to-nearest.
Glossary
- Precision: number of bits used to store a number. Fewer bits means less memory and faster math, but also less information per value.
- FP (floating point): number format made of a sign , an exponent and a mantissa fraction , with value , where is the bias.
- Sign bit: a single bit giving the direction of the number, with for positive and for negative.
- Exponent: bits giving the scale of the number. More exponent bits means a wider dynamic range.
- Mantissa: bits giving the detail inside a given scale. With mantissa bits, each range is split into evenly spaced values.
- Bias: constant subtracted from the stored exponent so that both large numbers and small numbers (negative exponents) can be represented.
- ExMy notation: shorthand for a format with exponent bits and mantissa bits, plus the sign bit. For example, E4M3 uses bits.
- FP32: the -bit float (E8M23), considered standard “full” precision.
- BF16 (Brain Float 16): the -bit format from Google Brain (E8M7). It keeps the same exponent bits as FP32, and therefore the same range, but has much less detail.
- FP16: the -bit IEEE float (E5M10), which has more detail than BF16 but a much smaller range.
- FP8: the -bit floats, mainly E4M3, which favors detail with a maximum of about , and E5M2, which trades detail for range.3
- FP4 (E2M1): a -bit float with sign, exponent and mantissa bit, which can only represent the magnitudes .
- E8M0: an -bit format made only of exponent bits, so it can only represent powers of two (). It is used as the MXFP4 scale.
- Dynamic range: ratio between the largest and smallest non-zero values a format (or a tensor) covers.
- Exponent vs mantissa trade-off: with a fixed bit budget, every bit given to the exponent (range) is taken away from the mantissa (detail), and vice versa.
- Quantization: converting values from a high-precision format to a lower-precision one, for example from BF16 to FP4. Dequantization is the reverse operation.
- Scale factor: number that values are divided by before quantization, so that they fit the representable range of the small format, with and later .
- Block (micro) scaling: splitting a tensor into small blocks of consecutive values, each with its own shared scale factor, instead of using one scale for the whole tensor.
- MXFP4 (Microscaling FP4): OCP standard 4-bit format that stores FP4 (E2M1) values in blocks of , each block sharing one power-of-two (E8M0) scale.
- NVFP4: NVIDIA 4-bit format that stores FP4 (E2M1) values in blocks of , gives each block an FP8 (E4M3) scale, and adds one FP32 scale per tensor.
- Per-tensor scale: single FP32 scale applied to a whole tensor in NVFP4, which brings the tensor into the range where the E4M3 block scales can work.
- Hierarchical (two-level) scaling: the NVFP4 scheme combining the FP32 per-tensor scale with the E4M3 per-block scales, so a value is recovered as .
- Outlier: value much larger in magnitude than the rest of its block. It forces a large scale, which crushes the other values toward zero.
- Sensitive layers: layers where low precision hurts accuracy the most, such as the last layers of the network, which are therefore kept in higher precision (BF16).
- 2D block scaling: scaling weights with 2D blocks of instead of 1D blocks, so the weight quantizes the same way in the forward pass and in the backward pass, where it is transposed.
- Random Hadamard Transform (RHT): orthogonal rotation , using a Hadamard matrix with random signs, applied before quantization. It spreads outliers across many values so the block distribution becomes smoother, and it can be undone exactly with .
- Round-to-nearest: deterministic rounding to the closest representable value. Small updates can be systematically lost, which makes it biased.
- Stochastic rounding: rounding up or down at random, with the closer neighbor being more likely. For example, rounds to with probability and to with probability , so the expected result is exactly . This unbiasedness matters for gradients.
- Gradient: direction and size of the weight update computed during backpropagation.
- Mixed precision: using different precisions for different parts of training, for example FP4 matrix multiplications, BF16 sensitive layers, and FP32 master weights and optimizer states.
Footnotes
-
Open Compute Project, OCP Microscaling Formats (MX) Specification, Version 1.0, 2023; Rouhani et al., Microscaling Data Formats for Deep Learning, 2023. ↩
-
NVIDIA, Pretraining Large Language Models with NVFP4, 2025. ↩ ↩2
-
Micikevicius et al., FP8 Formats for Deep Learning, 2022. ↩