Training LLMs with MXFP4

Albert Tseng, Tao Yu, Youngsuk Park · DOI

Abstract

Training Large Language Models (LLMs) is a resource-intensive process, driving the need for lower-precision numerical formats to improve hardware throughput. This paper introduces the first "near-lossless" recipe for training LLMs using 4-bit Microscaling (MXFP4) precision. The approach combines stochastic rounding (SR) to ensure unbiased gradients with a random Hadamard transform (RHT) to suppress noise caused by outliers. Experimental results on models ranging from 345M to 6.7B parameters show that this method achieves training stability and validation perplexity comparable to 16-bit (BF16) precision, while enabling an estimated 1.7× speedup during the backward pass.

Introduction

The staggering expense of training LLMs, often involving tens of thousands of GPUs for months, has led to the widespread adoption of low-precision datatypes like BF16 and FP8 for matrix multiplications (GEMMs). The industry is now pushing toward 4-bit precision (MXFP4) to potentially double throughput again. However, 4-bit quantization is inherently noisy. Standard rounding techniques introduce gradient bias, and the "outlier" values common in LLM activations can cause massive errors, leading to model divergence. Historically, 4-bit training required maintaining significant portions of the model in higher precision, which negates the intended speed benefits. This work addresses these challenges by providing a robust framework for stable, high-performance 4-bit training.

Methodology: Overcoming Bias and Outliers

The proposed recipe relies on two primary innovations to make 4-bit training viable without sacrificing model quality.

1. Unbiased Quantization with Stochastic Rounding

Quantization noise can lead to biased gradients if not handled carefully. The authors employ stochastic rounding (SR), where values are rounded up or down based on a probability proportional to their distance from the target 4-bit values. This ensures that the expected value of the quantized tensor remains equal to the original high-precision tensor. Additionally, a specific 3/4 scaling factor is introduced before quantization to mitigate "clipping" bias, where large values are otherwise capped at the maximum representable number of the 4-bit format.

2. Random Hadamard Transform (RHT)

LLMs are known to produce "outliers"—activations with unusually high magnitudes that dominate the quantization scale and increase noise for all other values in a block. Instead of expensive outlier detection and high-precision storage, the authors apply a Random Hadamard Transform (RHT). This mathematical rotation "smears" the energy of outliers across the entire block of numbers, effectively bounding the variance of the quantization noise. To maintain efficiency, the RHT is implemented "block-wise" (e.g., in groups of 64), keeping the operation memory-bound and compatible with modern hardware architectures.

The MXFP4 training recipe workflow, illustrating the transition from high precision to unbiased 4-bit estimates via RHT and Stochastic Rounding.

Experimental Setup and Results

The researchers evaluated the MXFP4 recipe by pretraining GPT-style models on the GPT2 Wikipedia corpus and the Tulu V2 dataset. Performance was tracked using validation perplexity and zero-shot downstream benchmarks.

Near-Lossless Performance

In experiments across various model scales, the combination of MXFP4, RHT, and SR consistently matched the performance of the BF16 gold standard. As shown in the validation perplexity curves, the proposed recipe prevents the divergence or performance degradation typically seen with naive 4-bit quantization.

Validation perplexity for a GPT 6.7B model, showing MXFP4+RHT+SR matching the BF16 baseline.

Downstream Benchmarks and Speedups

The 6.7B parameter model trained with the 4-bit recipe performed virtually identically to the 16-bit baseline on downstream tasks such as Arc-Challenge, PiQA, and BoolQ. Beyond accuracy, the method offers substantial efficiency gains. Using proxy benchmarks on existing hardware, the authors estimate that their approach is >1.3× faster than FP8 and >1.7× faster than BF16 during the backward pass.

Conclusion and Future Work

This paper demonstrates that near-lossless 4-bit LLM training is achievable by addressing the fundamental issues of quantization bias and outlier-induced variance. The recipe is designed for the OCP Microscaling (MX) standard, making it immediately relevant for upcoming hardware like NVIDIA’s Blackwell architecture.

While the results are promising, the authors note that native FP4 hardware was not available at the time of the study; speedup estimates are based on simulations and proxy benchmarks. Future work includes exploring the use of MXFP4 for the forward pass and investigating the scaling behavior of RHT block sizes for models exceeding 100B parameters.

Summary updated

BibTeX
@inproceedings{tseng2025training,
  author = {Albert Tseng and Tao Yu and Youngsuk Park},
  title = {{Training LLMs with MXFP4}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2025},
  url = {https://openreview.net/forum?id=a8z5Q0WSPL},
}
Figure