[Paper Review] Oscillation-free Quantization for Low-bit Vision Transformers
This paper proposes Oscillation-free Quantization (OFQ) for low-bit Vision Transformers, addressing weight oscillation in quantization-aware training caused by learnable scaling factors and query-key co-oscillation. By introducing statistical weight quantization (StatsQ), confidence-guided annealing (CGA), and query-key reparameterization (QKR), OFQ stabilizes training and achieves state-of-the-art accuracy—improving 2-bit DeiT-T/S and Swin-T by 9.88%, 7.72%, and 4.64% respectively over prior methods.
Weight oscillation is an undesirable side effect of quantization-aware training, in which quantized weights frequently jump between two quantized levels, resulting in training instability and a sub-optimal final model. We discover that the learnable scaling factor, a widely-used $ extit{de facto}$ setting in quantization aggravates weight oscillation. In this study, we investigate the connection between the learnable scaling factor and quantized weight oscillation and use ViT as a case driver to illustrate the findings and remedies. In addition, we also found that the interdependence between quantized weights in $ extit{query}$ and $ extit{key}$ of a self-attention layer makes ViT vulnerable to oscillation. We, therefore, propose three techniques accordingly: statistical weight quantization ($ m StatsQ$) to improve quantization robustness compared to the prevalent learnable-scale-based method; confidence-guided annealing ($ m CGA$) that freezes the weights with $ extit{high confidence}$ and calms the oscillating weights; and $ extit{query}$-$ extit{key}$ reparameterization ($ m QKR$) to resolve the query-key intertwined oscillation and mitigate the resulting gradient misestimation. Extensive experiments demonstrate that these proposed techniques successfully abate weight oscillation and consistently achieve substantial accuracy improvement on ImageNet. Specifically, our 2-bit DeiT-T/DeiT-S algorithms outperform the previous state-of-the-art by 9.8% and 7.7%, respectively. Code and models are available at: https://github.com/nbasyl/OFQ.
Motivation & Objective
- Investigate the root cause of training instability in low-bit quantization-aware training (QAT) for Vision Transformers (ViT).
- Identify that learnable scaling factors and query-key weight co-oscillation are primary drivers of weight oscillation.
- Develop a robust, oscillation-free quantization framework to improve accuracy and convergence in low-bit ViT models.
- Achieve state-of-the-art performance on ImageNet with minimal bit-widths, including 3-bit models matching full-precision accuracy.
- Ensure generalizability and stability across different ViT architectures (DeiT, Swin) and bit-widths (2–4 bits).
Proposed method
- Proposes statistical weight quantization (StatsQ), replacing learnable scaling factors with statistics-based scaling derived from weight distributions to reduce oscillation.
- Introduces confidence-guided annealing (CGA), which freezes weights with high confidence and selectively updates oscillating weights using a boundary range threshold.
- Designs query-key reparameterization (QKR) to decouple the mutual influence between quantized query and key weights, mitigating gradient misestimation.
- Combines StatsQ, CGA, and QKR into a unified framework that stabilizes training and enables convergence to oscillation-free models.
- Employs a dynamic boundary range in CGA to balance optimization speed and effectiveness, with empirical selection based on average gradient magnitude.
- Uses a trajectory analysis of scaling factors to validate the effectiveness of CGA in suppressing oscillation over training.
Experimental results
Research questions
- RQ1Why does the use of learnable scaling factors in quantization-aware training lead to weight oscillation in Vision Transformers?
- RQ2How does the interdependence between quantized query and key weights in self-attention layers exacerbate oscillation during training?
- RQ3Can statistical scaling based on weight statistics outperform learnable scaling in reducing oscillation and improving model accuracy?
- RQ4To what extent can confidence-guided annealing stabilize training and eliminate oscillation in low-bit ViT quantization?
- RQ5Does query-key reparameterization effectively decouple the negative mutual influence between quantized query and key weights?
Key findings
- The learnable scaling factor significantly exacerbates weight oscillation due to noisy gradient updates and threshold instability.
- Statistical weight quantization (StatsQ) reduces oscillation and improves accuracy by 6.3% in 2-bit DeiT-S compared to the baseline LSQ.
- Confidence-guided annealing (CGA) with a boundary range of 0.005 achieves the best performance, improving accuracy by 0.72% over other settings.
- The combination of StatsQ, CGA, and QKR achieves a 7.72% accuracy gain on 2-bit DeiT-S over the previous SOTA, with 2-bit DeiT-T improving by 9.88%.
- 3-bit DeiT-T and DeiT-S with OFQ achieve accuracy comparable to full-precision models, demonstrating the effectiveness of low-bit quantization with oscillation control.
- In the 4-bit setting, OFQ still outperforms full-precision models by 3.24%, 1.2%, and 0.68% on DeiT-T, DeiT-S, and Swin-T, respectively.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.