Abstract
Quantizing Large Language Models (LLMs) to 4-bit weights and activations (W4A4) is notoriously difficult due to "outlier channels"—specific feature dimensions with extreme values. We demonstrate that these outliers emerge early in training and propose a dual-pronged approach: using Quantization-Aware Training (QAT) to learn optimal clipping for inputs, combined with Kurtosis Regularization on outputs to prevent the model from "migrating" quantization difficulty into its weights. Our 1B parameter W4A4 model achieves a perplexity of 24.57 on C4, nearly matching the 16-bit baseline of 23.57.
Introduction
To deploy LLMs efficiently on modern hardware, low-precision integer arithmetic (INT4) is highly desirable. While weight quantization is relatively mature, activation quantization remains a significant hurdle. LLMs naturally develop "outlier channels" where a few dimensions exhibit values orders of magnitude larger than the rest. Standard quantization scales the entire range to accommodate these outliers, destroying the precision of the majority of values. Previous attempts to mitigate this often encountered a "whack-a-mole" problem: clipping activations caused the model to shift numerical complexity into the weights, making them impossible to quantize later.
Methodology
We propose two primary interventions during the pre-training phase to create "quantization-friendly" models:
- QAT with Learned Clipping: We treat quantization clipping bounds ($c^-$ and $c^+$) as learnable parameters. During training, activations are clipped and quantized in the forward pass, while gradients update the bounds in the backward pass, allowing the model to optimize the trade-off between clipping error and quantization noise.
- Kurtosis Regularization: This novel core technique penalizes the loss function based on the kurtosis—a statistical measure of "heavy-tailedness"—of a layer’s output. By discouraging extreme outliers, we prevent the "migration" effect where the model bypasses input clipping by inflating weight values.
- Custom CUDA Kernels: To maintain training throughput, we implemented custom kernels for H100 GPUs to handle the reduction steps required for gradient calculation, achieving 37,510 tokens/sec, roughly 90% of the 16-bit baseline speed.
Key Insights
Early Onset of Outliers
Our analysis reveals that outlier channels are not a byproduct of long-term convergence but emerge very early in the training process, typically within the first 10 billion tokens. This necessitates integrating quantization strategies into the training loop rather than applying them post-hoc.
The Migration Trap and Kurtosis Regularization
A critical finding is that applying QAT only to inputs leads the model to "cheat" by increasing the magnitude of corresponding weights to compensate for clipped activations. Kurtosis regularization acts as a safety valve, keeping the entire layer's distribution stable and ensuring weights remain quantizable.
Results
Our 1B parameter model trained with W4A4 achieved a perplexity of 24.57 on C4, remarkably close to the 16-bit baseline of 23.57. Crucially, without Kurtosis Regularization, weight quantization caused perplexity to explode; with it, the gap between 16-bit and 4-bit weights was minimal. Downstream task performance on benchmarks like HellaSwag and PIQA remained robust, demonstrating that the compressed models retain their reasoning capabilities.
Conclusion
By addressing the root cause of quantization difficulty—outlier channels—during training, we enable efficient W4A4 LLMs. This dual approach of learned clipping and kurtosis regularization prevents numerical instability from migrating between activations and weights. Future work will explore scaling these methods to 70B+ parameter models and applying similar regularization to attention mechanisms.
Summary updated