| A linear layer | |
|---|---|
| layer input, tokens by features | |
| weight, outputs by inputs | |
| output gradient , | |
| layer output | |
| forward NVFP4 input , blocked along | |
| NVFP4 weight, one scale per tile | |
| a backward copy blocked down the columns (avoided) | |
| Encoding | |
| NVFP4 encoding of a tensor with round to nearest, with stochastic rounding; rounds to the nearest E4M3 number | |
| a value before encoding | |
| E4M3 scale of block or tile | |
| FP32 outer scale, one per tensor | |
| adjacent grid points around , step | |
| small excess in the MXFP4 example | |
| Rotation | |
| rotation of each run of 16 tokens by | |
| Hadamard matrix, entries ( in Thinking Machines' combine) | |
| diagonal matrix of random signs | |
| size of an outlier | |
| Paper's symbols | |
| what the paper writes for and | |
| what the paper writes for and the block scale | |
| what the paper writes for | |
| Fprop, Dgrad, Wgrad | the forward, input-gradient and weight-gradient products |
Context. On NVIDIA's GB300 Blackwell GPU, a GEMMgeneral matrix multiplication, the product of two matrices; GEMMs account for most of the compute of training a transformer in the 4-bit format NVFP44-bit E2M1 values , one 8-bit E4M3 scale per block of 16 and one FP32 outer scale , decoded as ; a value below about of its block's largest rounds to zero. Reading note: End-to-end 4-bit training peaks at 6 times the BF16bfloat16: a 16-bit floating-point format with 8 exponent bits and 7 mantissa bits, the default for large-model training rate, compared with 2 times for 8-bit formats. Its operands also take about half the memory of 8-bit ones. That speed comes with rounding error at every layer and step. Over trillions of tokens, small systematic errors can compound, and a weight gradient summed over every token in a batch accumulates any rounding bias. NVIDIA (2025) trained a 12B-parameter hybrid Mamba-Transformera language model that mixes self-attention blocks with Mamba-2 blocks, state-space layers whose cost grows linearly with sequence length, and feed-forward blocks; here the Nemotron-H family on 10 trillion tokens with the forward product and both backward products of most linear layers in NVFP4. It was the longest publicly documented 4-bit training run when it appeared, and the paper compares it against the same model trained in FP88-bit floating point; here E4M3 values with one scale per 128 by 128 block of a weight and per 1 by 128 block of an activation or gradient, as in DeepSeek-V3.
Four bits hold across both passes for 10T tokens when each tensor gets a safeguard matched to how its error hurts training. Weights use one scale per 16 by 16 tile so the forward and backward passes multiply by the same 4-bit weights. Gradients use unbiased stochastic roundingrounding a value between adjacent grid points up to with probability and down to otherwise, so that . Reading note: End-to-end 4-bit training, while every other tensor rounds to nearest for smaller error. The weight-gradient product, the only product without a weight operand, applies a random Hadamard rotationmultiplication of a run of values by , with a Hadamard matrix scaled to be orthogonal and a diagonal matrix of random signs; it keeps the norm and spreads an outlier evenly over the run. Reading note: End-to-end 4-bit training to both inputs to spread outliers. A small share of linear layers, mostly at the end of the network, stays in BF16. The 12B model finished with a loss slightly more than 1.5% above FP8's and matched it on most downstream tasks, including 62.58% against 62.62% on MMLU-Proa harder, ten-option version of the MMLU multiple-choice benchmark of academic and professional questions. Removing any single safeguard at 12B worsened the loss. Most of the remaining gap comes from the forward pass, and switching that pass to BF16 around the start of learning-rate decay closes most of it.
Setting. The model follows the Nemotron-Nano-12B-v2-Base architecture with 62 blocks: 28 Mamba-2, 28 feed-forward, and 6 self-attention. Training uses a warmup-stable-decay schedulea learning-rate schedule that warms up, holds the rate constant, then decays it; here constant for the first 80% of training and decayed over the last 20%, holding the learning rate constant for the first 80% of tokens and decaying it over the last 20%. All NVFP4 matrix products accumulate in FP32. Embeddings, normalization layers, the output head, and attention's softmax and two batched products stay in BF16 or FP32, along with master weights, accumulated gradients, and optimizer states.
For a linear layer with input the input of a linear layer: tokens by features, weight the weight of the linear layer: output features by input features, and loss gradient the gradient of the loss with respect to the layer's output , a matrix (), training computes three matrix products, called Fprop, Dgrad, and Wgrad in the paper:Here NVFP4 encoding with round to nearest: each value divided by its block scale and outer scale goes to the closest E2M1 value and NVFP4 encoding with stochastic rounding of each scaled value, unbiased: denote NVFP4 encoding with round to nearest and with stochastic rounding, blocked in groups of 16 along the summed dimension. The forward input the forward pass's NVFP4 input , in 1 by 16 blocks along the features is blocked along the features, along the outputs, and both weight-gradient operands along the tokens. The weight the NVFP4 weight, encoded from the FP32 master weight with one scale per 16 by 16 tile and round to nearest is encoded from the FP32 master weight in square tiles. The operator the rotation that multiplies each run of 16 consecutive tokens by ; it is orthogonal, applies an orthogonal random Hadamard rotation to each run of 16 tokens, detailed below. Every tensor carries one FP32 outer scale the FP32 outer scale of a tensor, , with its values before encoding over its unquantized values , setting its largest block scale to 448, the top of E4M3an 8-bit floating-point format with 4 exponent bits and 3 mantissa bits; its positive values run from to 448.
Square weight tiles make the backward pass use the same 4-bit weights as the forward pass. A tensor corethe GPU unit that executes block-scaled matrix multiplications; it needs both operands blocked along the dimension that the product sums over requires both operands to be blocked along the summed dimension: in the forward product and in the input-gradient product. Under 1 by 16 blocks, the weight would need two encodings: along its rows as , and down its columns as a different copy a backward copy of the weight encoded in 1 by 16 blocks down its columns; in general . The product would then compute the input gradient of , a layer the forward pass never ran. A 16 by 16 tile groups the same 256 weights in both orientations. Giving tile a single scale, rounded to the nearest E4M3 value,produces one for both products. Replicating that scale across each of the tile's sixteen 1 by 16 rows keeps the tensor in standard NVFP4 for hardware, though the scale is coarser because it comes from 256 weights.
In a 1.2B-parameter ablation, weights encoded along different dimensions in the two passes trained worse than square tiles, despite the tiles' coarser scale. They also trailed a hardware-unsupported control that keeps 1 by 16 blocks oriented the same way in both passes to isolate consistency. The authors suggest that weights tolerate the coarser tile scale because they adapt to their 4-bit values during training. They also hypothesize that inconsistent backward weights hurt by injecting error into the activation gradient, which then propagates down to earlier layers. Activations keep 1 by 16 blocks and are encoded afresh for the weight gradient, so differs from . In the same ablation, that activation mismatch mattered only during learning-rate decay.
Stochastic rounding goes on the gradients only, because its unbiasedness costs error size. For a value between adjacent grid points the two grid values on either side of ; is the grid step there, round to nearest has error with a fixed sign, while stochastic rounding removes bias at the cost of higher variance:For uniform over the cell of width , the mean squared error doubles from for round to nearest to for stochastic rounding (computed here). Weight gradients sum products across every token in a batch, so zero-mean noise partly cancels while bias adds up. Unbiasedness pays off there. Underflow causes the sharpest bias. A gradient at of its block's peak scales to 0.2 on the 4-bit grid, so round to nearest sends it to 0 every time. Stochastic rounding maps it to 0.5 with probability 0.4 and preserves its mean.
Forward tensors benefit from the smaller error of round to nearest. In the 1.2B ablation, stochastic rounding converged on gradients, diverged on activations or weights, and added little when extended to every backward tensor. At 12B, gradients needed stochastic rounding in both backward products, and removing it caused the largest loss jump among the four 12B ablations. Blackwell GPUs perform stochastic rounding directly inside the conversion instruction.
The rotation goes on the weight-gradient product only, because it must act on both operands to cancel. The rotation multiplies each run of 16 consecutive tokens by . Here the Hadamard matrix scaled to be orthogonal: entries and orthogonal rows is the orthogonal Hadamard matrix with entries , and a diagonal matrix of random signs , one sign vector shared by all layers for the whole run is a diagonal matrix of random signs. Because is orthogonal along the summed token dimension,so both operands can be encoded after rotation without changing the product up to rounding. Rotating the forward or input-gradient product would rotate the weight along in one pass and along in the other, bringing back two incompatible weight encodings. Inside each 16-token run, spreads an outlier of size the magnitude of a single outlier among the 16 values of a run as across all 16 entries. In the 1.2B ablation, rotating the weight-gradient inputs lowered the loss, while rotating forward or input-gradient inputs raised it. The authors suggest that rotation adds more rounding error in those products than it removes from outliers. At 12B, shrinking the rotation from to after 3.4T tokens raised the loss, while lowered it slightly, so 16 stayed for its lower cost. The random signs in mattered at 12B, though not at 1.2B, and one sign vector shared across all layers for the whole run was enough.
The last layers stay in higher precision because they diverge in 4 bits. With every linear layer in NVFP4 and no other safeguards, the 1.2B model diverged early in training. Keeping its last four blocks in BF16 restored convergence, while keeping its first four did not. First blocks helped only alongside last ones. Because the authors measured larger weight-gradient quantization errors in the final layers, they suggest using those error measurements to choose which layers stay in higher precision. The 12B run kept its first two and last eight blocks in BF16, or 16% of its linear layers. An ablation keeping only the last four blocks stayed stable with a loss close to the full recipe's, showing that ten blocks was conservative. The paper recommends keeping about 15%why: an empirical rule from the 1.2B and 12B runs; every layer in 4 bits diverged, and the last blocks are the ones whose 4-bit weight gradients carry the most error of linear layers in higher precision, mostly at the end.
Switching the forward pass to BF16 during decay closes most of the remaining gap. On the 12B run, NVFP4's loss stayed within 1% of FP8's during the constant-learning-rate phase and widened during decay. Most of that gap comes from the forward pass. Switching the forward product to BF16 at 8.2T tokens, just after decay started at 8T, cut the gap to 0.5%. That switch put about 6% of total compute, one third of the final 18%, into higher precision. Switching both passes matched FP8's loss, while switching only the backward pass gave no gain, unlike in Chmiel et al. (2025). Switching both passes around 10T tokens, for under 1% of training, closed much of the gap but not all of it. The authors guess that the learning rate was already too low by then for the weights to move far. They recommend switching shortly before decay begins, or at the very end for a smaller gain at almost no cost.
NVFP4's finer scales and shorter blocks also carry part of the gain. MXFP4a 4-bit microscaling format with the same E2M1 values and one power-of-two (E8M0) scale per block of 32 uses the same E2M1 grid with one power-of-two scale per 32 values, rounded up to prevent overflow. Rounding up can leave the top of the grid unused. A block whose largest magnitude is , for small a small positive amount, maps toThe first arrow rounds the scale up to a power of two, and the second rounds the scaled value to nearest. Codes 4 and 6 sit empty, restricting the block to of the grid's binadesfactors of two in magnitude; a range from 0.5 to 6 spans of them. NVFP4's E4M3 scale lands the block peak close to 6 across blocks half as long. On an 8B hybrid model trained for 1T tokens with the same recipe, MXFP4 finished 2.5% above BF16's loss against 1.5% for NVFP4, and needed 36% more tokens to match NVFP4's loss.
Comparing the two NVFP4 recipes. Thinking Machines' recipe, which runs 4-bit forward products from pretraining through RL, faces the same transpose problem and solves it the opposite way. NVIDIA runs all three products in NVFP4 and enforces bit-for-bit weight equality with one scale per 256 weights. Thinking Machines keep 1 by 16 row blocks and put 4 bits only in the forward pass of their expert layers. To match the forward tensors in expectation during the backward pass, they decode and , transpose them, and re-encode them in MXFP8an 8-bit microscaling format with E4M3 or E5M2 values and one power-of-two scale per 32 values, 8.25 bits per value with stochastic rounding. They tested square tiles and found the coarser scale cost more compute efficiency than they would accept. The two recipes handle activations differently too. NVIDIA's weight gradient re-encodes the BF16 input directly, so it is not strictly the gradient of the forward function, while Thinking Machines re-encode the decoded .
The two results do not contradict each other. NVIDIA compared square tiles against inconsistent 1 by 16 blocks, never against re-encoded MXFP8 copies. The architectures also differ, with dense hybrid layers here and mixture-of-experts layers at Thinking Machines. So do the yardsticks. NVIDIA evaluates relative loss and benchmark parity, while Thinking Machines track compute efficiency. Going by the 8B comparison above, a single percentage point of relative loss is costly in compute efficiency. NVIDIA's run adds evidence that the backward pass itself can run in 4 bits over trillions of tokens.
Evidence and limits. The main comparison is a full-length run at realistic scale: the 12B model trained for 10T tokens tracked a matched FP8 run in loss and downstream accuracy throughout. To test each safeguard at scale, the 12B ablations branch from the 3.43T-token checkpoint for about half a trillion tokens, removing one safeguard at a time. Finer choices, such as which tensors get stochastic rounding or rotation and which layers stay in BF16, rest on 1.2B ablations. Because random signs and rotation size mattered at 12B but not at 1.2B, small-scale ablations can miss effects that emerge at scale. The paper reports one run per configuration. Downstream parity holds on most tasks, with code as the exception at 56.67% against 59.52%. The authors suspect that gap comes from a noisy evaluation of the final checkpoint. The FP8 baseline kept only its first block and last two blocks in BF16, compared with ten blocks for NVFP4, and no mixture-of-experts model was tested. Because the paper focuses on numerics, it reports no wall-clock training speeds. The GEMM speedups cited above are hardware peaks.
Terms
- Three products
- , , , all in NVFP4
- 16 by 16 weight tiles
- one scale per tile, the same in both orientations, so the forward and input-gradient products use the same 4-bit weights
- Stochastic rounding
- on gradients only: unbiased, but for a value uniform over a grid cell of width the mean squared error is against for round to nearest
- Hadamard rotation
- , on the weight-gradient inputs only, where both operands can be rotated:
- BF16 layers
- about 15% of linear layers, mostly the last blocks; every layer in 4 bits diverges
- Remaining gap
- under 1% of FP8's loss in the stable phase, about 1.5% after the decay; mostly from the forward pass
- Precision switch
- forward pass to BF16 around the decay's start cuts the gap to 0.5% for about 6% of the compute
- NVFP4 against MXFP4
- MXFP4's rounded-up power-of-two scale can waste the codes 4 and 6; it needed 36% more tokens at 8B
- Against Thinking Machines
- bit-for-bit weights with coarse tiles and 4-bit backward, against fine blocks with MXFP8 backward copies equal in expectation
- Result
- 12B, 10T tokens: MMLU-Pro 62.58% against 62.62% for FP8
Sources
- NVIDIA et al. Pretraining Large Language Models with NVFP4. arXiv preprint, 2025.
Connected notes
SGD's expected loss is the gradient-descent loss plus a term from noise injected while the loss is still of order one, so SGD noise matters only when the kernel decays more slowly than the gradient-descent loss.
- Softmax attention as a sum of RNNsEfficient sequence models · Fixed scales for stable training
Dividing the numerator of softmax attention by its L2 norm, which fixes the output's length, follows the softmax loss curve, while dividing by the sequence length behind a gate, with scores clamped at 5 and gradients clipped, still gives loss spikes.
- Maximal update parametrizationLazy training and feature learning · Predicting large runs from small ones
Under P the optimal learning rate, initialization scale and multipliers are nearly stable in width, so they can be tuned on a small proxy and copied, and a 40M proxy beat the published 6.7B GPT-3 at a tuning cost of 7% of its pretraining cost.
- The information exponentHigh-dimensional SGD · Averaging out gradient noise
Smoothing the loss over a cap of radius shrinks gradient noise faster than the squared signal up to , which lowers the sample cost from to the correlational-query lower bound .