NVIDIA reported pretraining a 12B model on 10 trillion tokens in NVFP4 with loss and accuracy comparable to FP8. Explain the format, why naive 4-bit training diverges, and the techniques that made it work. Which parts of a training step would you keep in higher precision?
Answer
Model answer, written in a candidate's voice
In short
- NVFP4: E2M1 values (up to ±6) in 16-element blocks, FP8 E4M3 block scales plus per-tensor FP32 scale, (16x4+8)/16 = 4.5 bits/value; MXFP4 uses 32-element blocks with E8M0 power-of-two scales, 4.25 bits/value
- Naive 4-bit training diverges because outliers dominate block scales, round-to-nearest biases gradients, and forward/backward can see inconsistent quantised weights
- Reported fixes: random Hadamard transforms on weight-gradient GEMM inputs, 2-D 16x16 block scaling for weights so forward and backward share the same representation, stochastic rounding for gradients, ~16% of linear layers kept in BF16
- Keep higher precision: master weights and optimiser state, normalisation, softmax/attention internals, embeddings and output head, and usually final layers; switch to higher precision shortly before LR decay, or earlier if loss diverges
- Validate with long-horizon runs against FP8/BF16 baselines: loss gap over the whole run and downstream evals, since 4-bit errors can appear only after many tokens
In full
NVFP4 packs E2M1 values (up to ±6) into 16-element blocks with an FP8 E4M3 scale per block and a per-tensor FP32 scale, unlike MXFP4’s 32-element blocks with power-of-two E8M0 scales:
Naive 4-bit training fails because a few outlier values set the block scale and crush the rest, round-to-nearest makes gradients biased, and the forward and backward passes can effectively see different quantised weights. The reported recipe spreads outliers with random Hadamard transforms on the inputs of the weight-gradient GEMMs, uses 2-D 16x16 block scaling for weights so forward and backward share the same representation, applies stochastic rounding to gradients, and keeps a few sensitive linear layers in BF16 (about 16% in the 12B run, mostly the final blocks). I would still keep master weights and optimiser state, normalisation, softmax/attention internals, embeddings and the output head, and usually the final layers in higher precision, and I would plan to switch to higher precision late in training, shortly before learning-rate decay, to close any remaining loss gap, or earlier if the loss starts to diverge. The key evidence is a long-horizon comparison against an FP8 or BF16 baseline: loss gap over the whole run plus downstream evals, because 4-bit errors can remain hidden for many tokens before they show up.
What a strong answer covers
- Format: E2M1 elements (values up to ±6) in 16-element blocks, each with an FP8 E4M3 scale, plus a per-tensor FP32 scale; about 4.5 bits per value, versus MXFP4’s 32-element blocks with power-of-two E8M0 scales
- Failure modes: outliers dominate block scales and crush other values, gradients are biased by round-to-nearest, and forward and backward passes can see inconsistent quantised weights
- Fixes reported: random Hadamard transforms to spread outliers within blocks, 2-D block scaling of weights so forward and backward use the same representation, stochastic rounding for gradients, and a few sensitive layers kept in BF16
- Keeps in higher precision: master weights and optimiser state, normalisation, softmax/attention internals, embeddings and output head, and usually the final layers; switches to higher precision late in training if loss diverges
- Validates with long-horizon comparisons against an FP8 or BF16 baseline (loss gap over the whole run, downstream evals), because 4-bit errors can show up only after many tokens
Common mistakes
- Assuming 4-bit training means 4-bit optimiser state and master weights
- Judging stability from the first few billion tokens
Follow-ups
- What does the 2× matmul throughput of FP4 over FP8 buy you end to end, once communication and non-matmul work are counted?