TL;DR
Researchers have discovered that the massive activation outliers hindering Transformer quantization are actually a learned "workaround" for the model trying to perform a "no-op" (doing nothing). By introducing two simple architectural tweaks—clipped softmax and gated attention—they allow models to achieve exact zeros in attention matrices, eliminating outliers at the source and enabling seamless INT8 quantization without losing accuracy.
The Quantization Problem
Quantization—the process of converting high-precision floating-point numbers (FP16/32) into low-bit integers (like INT8)—is the "holy grail" for deploying large language models on edge devices. It drastically slashes memory usage and accelerates compute. However, Transformers are notoriously difficult to quantize because of outliers: specific activation values that are orders of magnitude larger than the rest.
When a model has a few "giant" numbers among thousands of "tiny" ones, a standard quantizer faces a lose-lose choice: either clip the giants (destroying the model’s logic) or stretch the quantization grid to include them (destroying the precision for all other values). Previous solutions were mostly post-training "band-aids," such as using higher bit-widths for problematic channels or complex fine-tuning. This paper asks a more fundamental question: Why do these outliers exist in the first place, and can we design them out of the architecture?
The Root Cause: The "No-Op" Hypothesis
The authors trace the outliers back to the softmax function in the attention mechanism. In a standard Transformer, an attention head that doesn't find anything useful to update still has to output something because the softmax function never outputs an exact zero.
To effectively "do nothing" (a no-op), the model performs mathematical gymnastics: it pushes the input to the softmax to be extremely large so that the resulting probability for a "dummy" token (like a period or a [SEP] token) is nearly 1, and others are nearly 0.
Because $e^x$ never reaches zero, the only way for a softmax to represent a "no-update" is for the difference between inputs to approach infinity. The network is essentially "overheating" its activations just to try and turn a switch off. These extreme inputs manifest as massive outliers in the Feed-Forward Network (FFN) outputs, heavily concentrated on specific dummy tokens and specific channels.
Architectural Solutions
To fix this structural flaw, the authors propose two independent solutions that allow the model to represent "nothingness" without generating massive gradients:
- Clipped Softmax: A modified softmax that stretches the output range slightly and clips it to $[0, 1]$. This allows the function to reach an exact zero or one with finite input values, removing the pressure to grow infinitely large activations.
- Gated Attention: They add a small, learnable "gate" (a sigmoid-activated linear layer) to each attention head. This acts as a "dimmer switch," allowing the head to explicitly zero out its own contribution to the residual stream without abusing the softmax function.
Key Results and Performance
The authors validated their approach across Language Modeling (BERT, OPT up to 1.3B parameters) and Computer Vision (ViT-S/16). The results for INT8 (W8A8) quantization are striking:
- Outlier Reduction: By changing the architecture to allow for "no-ops," the "Max Infinity Norm" (the magnitude of the largest outlier) in BERT dropped from 735 in the vanilla model to just 21.5 with Clipped Softmax.
- BERT Quantization: A vanilla BERT model's perplexity explodes from 4.49 (FP16) to 1294 (INT8) due to outliers. With Clipped Softmax, the INT8 perplexity is 4.52—virtually identical to the high-precision original.
- OPT-1.3B Quantization: Using gated attention, the authors quantized a 1.3 billion parameter model to INT8 with a perplexity of 29.95, compared to a massive 989.6 for the vanilla version.
- Performance Bonus: Surprisingly, helping the model "do nothing" more efficiently often improved the original floating-point performance, suggesting that standard Transformers waste capacity fighting their own activation functions.
Limitations and Future Work
The primary limitation of this approach is that it requires training from scratch or significant fine-tuning. Because these are architectural changes, you cannot simply apply them post-hoc to an existing pre-trained model. Additionally, both methods introduce a new hyperparameter (clipping threshold for softmax or bias initialization for gates) that requires some tuning. Finally, while tested up to 1.3B parameters, the behavior of these modifications in "frontier" models (100B+ parameters) remains an open question for future research.
Summary updated