Introduction
Training massive Transformer models is computationally expensive and memory-intensive. While moving from 32-bit or 16-bit floating-point arithmetic to 4-bit precision is a promising way to slash these costs, it faces two major hurdles. First, most existing 4-bit training research relies on custom numerical formats (like FP4 or logarithmic scales) that are not natively supported by current GPU hardware. Second, standard 4-bit quantization fails because Transformers produce "outliers"—a few values that are significantly larger than the rest. These outliers dominate the numerical range, forcing the quantizer to use a coarse scale that destroys the information in smaller, more common values.
This paper introduces a hardware-friendly method to train Transformers using 4-bit integers (INT4) for all matrix multiplications. By combining a Hadamard quantizer to tame activation outliers and leverage score sampling to exploit gradient sparsity, the authors achieve significant training speedups on current GPUs while maintaining competitive accuracy across diverse tasks.
Methods: Fully Quantized Training
The authors propose a "Fully Quantized Training" (FQT) workflow where all heavy-duty matrix multiplications are performed in INT4. Their approach addresses the challenges in both forward and backward passes:
Forward Propagation: The Hadamard Quantizer
To handle activation outliers, the authors apply a block-diagonal Hadamard transform before quantization. This mathematical technique spreads the information of a single large outlier across multiple entries, effectively "flattening" the distribution and making it much easier to quantize without losing precision.
Backpropagation: Bit Splitting & Leverage Score Sampling
Gradients are notoriously difficult to quantize. The authors use Bit Splitting to represent gradients as the sum of two 4-bit matrices, effectively achieving 8-bit precision. To keep this efficient, they employ Leverage Score Sampling, an importance sampling technique that identifies and keeps only the most "informative" rows or columns of the gradient matrix while discarding the rest. This keeps the total computation equivalent to a single 4-bit matrix multiplication.
Key Insights
Taming Outliers
The authors identify that activation outliers are the primary reason 4-bit training typically fails. The Hadamard transform successfully converts a "spiky" distribution into a quantization-friendly one, preserving the necessary information for accurate model updates.
Exploiting Gradient Sparsity
Gradients in Transformer training are "structurally sparse." Most tokens in a batch contribute very little to the overall gradient. As illustrated below, a small percentage of tokens account for nearly 100% of the gradient norm, which justifies the use of leverage score sampling to focus computation only where it matters.
Results and Impact
The researchers evaluated their method on a comprehensive suite of benchmarks, including Natural Language Understanding (GLUE, SQuAD), Machine Translation (WMT 14 En-De), and Image Classification (ImageNet-1k via ViT).
Their method drastically outperformed previous 4-bit baselines. For BERT-Large on the GLUE benchmark, it achieved an average score of 82.25, nearly matching the INT8 baseline (82.74) and far exceeding the standard 4-bit LSQ baseline (55.93).
Crucially, by sticking to standard INT4 instead of exotic formats, the algorithm leverages the existing Tensor Cores on modern NVIDIA GPUs. Their prototypical INT4 linear operator is up to 2.2x faster than the standard FP16 version. For sufficiently large models, the overall training process saw an average speedup of 17.8%, peaking at 35.1% for specific BERT-Large configurations.
Limitations and Future Work
While highly effective for Transformers, the current implementation does not yet support convolutional layers. Furthermore, while tested on BERT-Large, it remains an open question how well this scales to extreme models like GPT-3, where outliers may become even more problematic. Future engineering efforts, such as fusing quantization operators with non-linearities, could unlock even greater performance gains.
Summary updated