TL;DR
This paper identifies "weight oscillation"—where quantized weights flip-flop between discrete levels during training—as a major barrier to high-performance low-bit Vision Transformers (ViTs). By replacing learnable scaling factors with statistical ones, decoupling query-key interactions, and using a novel annealing strategy to freeze stable weights, the authors achieve massive accuracy gains, including a 9.8% improvement for 2-bit DeiT-T on ImageNet.
What Problem Does This Paper Address?
Quantization-Aware Training (QAT) is the gold standard for shrinking massive models like Vision Transformers (ViTs) into low-bit formats (e.g., 2-bit or 3-bit) for edge deployment. However, these models often suffer a significant accuracy drop compared to their full-precision counterparts.
The authors pinpoint weight oscillation as the primary culprit. During training, weights near the quantization threshold frequently jump back and forth between levels. This instability prevents the model from converging to a good local optimum. While previous research explored this in CNNs, this paper reveals that ViTs are uniquely vulnerable due to two factors:
- Learnable Scaling Factors: The popular LSQ (Learned Step Size Quantization) method actually exacerbates oscillation because outlier weights can wildly shift the quantization threshold, dragging stable weights into the "oscillation zone."
- Query-Key Interdependence: In self-attention layers, the gradients for Query weights depend on Key weights (and vice versa), creating a feedback loop that intensifies oscillation.
Methods
The authors propose three complementary techniques to achieve "Oscillation-Free Quantization" (OFQ):
- Statistical Weight Quantization (StatsQ): Instead of treating the quantization scaling factor ($\alpha$) as a learnable parameter prone to noisy gradients, StatsQ calculates it analytically based on the maximum information entropy theory. This results in a much smoother training trajectory.
- Confidence-Guided Annealing (CGA): The authors observed that oscillating weights are "position-agnostic"—they aren't specific weights, but rather any weights that happen to be near a threshold. CGA fine-tunes the model by freezing "high-confidence" weights (those far from thresholds) and only allowing "low-confidence" weights to update until they eventually settle and are frozen too.
- Query-Key Reparameterization (QKR): To break the oscillation loop in self-attention, QKR reorders the matrix multiplications. By mathematically decoupling the interaction between quantized Query and Key weights during the backward pass, it produces more accurate gradient estimates.
Datasets
The proposed methods were evaluated on the ImageNet-1K classification dataset, a standard benchmark for computer vision. The authors tested three popular architectures:
- DeiT-tiny (DeiT-T)
- DeiT-small (DeiT-S)
- Swin-tiny (Swin-T)
Key Insights and Ideas
- The Vicious Cycle of Learnable Scales: Figure 1 illustrates how a single outlier weight can drive the learnable scaling factor to fluctuate, which in turn causes weights that were previously stable to start oscillating around the new threshold.
- Proximity is the Problem: The authors found a clear anti-correlation between a weight's distance to the quantization threshold and how often its gradient direction flips. The closer a weight is to the "edge," the more unstable it becomes.
- Freezing the "Sure Things": Unlike prior work that tried to freeze oscillating weights, the authors found it much more effective to freeze the stable weights first. This provides "fixed anchors" that allow the remaining unstable weights to find their optimal levels more easily.
- Bit-width Sensitivity: Oscillation is significantly more detrimental at ultra-low bit-widths (2-bit) than at higher resolutions (4-bit), where the higher density of quantization levels naturally mitigates the impact of jumps.
Key Results
The OFQ framework consistently outperformed the previous state-of-the-art (SoTA) across various architectures and bit-widths:
- 2-bit Quantization:
- DeiT-T: Achieved 64.33% Top-1 accuracy, a 9.88% jump over previous SoTA.
- DeiT-S: Achieved 75.72% Top-1 accuracy, a 7.72% improvement.
- Swin-T: Achieved 78.52% Top-1 accuracy, a 4.64% improvement.
- 3-bit Quantization: For the first time, 3-bit DeiT models achieved accuracy comparable to their full-precision (32-bit) counterparts. For example, 3-bit DeiT-S reached 79.57% (vs. 79.9% full-precision).
Limitations and Future Work
While highly effective for ViTs, the authors note that the specific "intertwined oscillation" addressed by QKR is unique to the self-attention mechanism. Future work is needed to investigate whether similar structural bottlenecks exist in other types of Deep Neural Networks (DNNs) and to test the generalizability of these methods across more diverse applications beyond image classification.
Summary updated