[Paper Review] Sharpness-aware Quantization for Deep Neural Networks
This paper proposes Sharpness-Aware Quantization (SAQ), a novel method that jointly optimizes model quantization and loss landscape smoothing via a unified formulation of quantization noise and adversarial perturbations. SAQ improves generalization in low-bit quantized models—achieving state-of-the-art performance, including a 1.2% Top-1 accuracy gain on 4-bit ViT-B/16 and a 0.9% gain on 4-bit ResNet-50 for ImageNet—while maintaining training efficiency comparable to standard optimizers like AdamW.
Network quantization is a dominant paradigm of model compression. However, the abrupt changes in quantized weights during training often lead to severe loss fluctuations and result in a sharp loss landscape, making the gradients unstable and thus degrading the performance. Recently, Sharpness-Aware Minimization (SAM) has been proposed to smooth the loss landscape and improve the generalization performance of the models. Nevertheless, directly applying SAM to the quantized models can lead to perturbation mismatch or diminishment issues, resulting in suboptimal performance. In this paper, we propose a novel method, dubbed Sharpness-Aware Quantization (SAQ), to explore the effect of SAM in model compression, particularly quantization for the first time. Specifically, we first provide a unified view of quantization and SAM by treating them as introducing quantization noises and adversarial perturbations to the model weights, respectively. According to whether the noise and perturbation terms depend on each other, SAQ can be formulated into three cases, which are analyzed and compared comprehensively. Furthermore, by introducing an efficient training strategy, SAQ only incurs a little additional training overhead compared with the default optimizer (e.g., SGD or AdamW). Extensive experiments on both convolutional neural networks and Transformers across various datasets (i.e., ImageNet, CIFAR-10/100, Oxford Flowers-102, Oxford-IIIT Pets) show that SAQ improves the generalization performance of the quantized models, yielding the SOTA results in uniform quantization. For example, on ImageNet, SAQ outperforms AdamW by 1.2% on the Top-1 accuracy for 4-bit ViT-B/16. Our 4-bit ResNet-50 surpasses the previous SOTA method by 0.9% on the Top-1 accuracy.
Motivation & Objective
- To address the instability and performance degradation in low-precision quantized models caused by sharp loss landscapes due to discrete weight updates.
- To explore the integration of Sharpness-Aware Minimization (SAM) with network quantization, a problem previously unaddressed in model compression.
- To develop a unified framework that treats quantization and adversarial perturbations as noise sources on model weights, enabling systematic analysis of their interplay.
- To design an efficient training strategy that minimizes additional computational cost while preserving the benefits of SAM in quantized settings.
- To empirically validate SAQ across diverse architectures (CNNs and Transformers) and datasets, demonstrating consistent performance gains in both standard and transfer learning settings.
Proposed method
- Formulate quantization and SAM as introducing quantization noise and adversarial perturbations to model weights, respectively, enabling a unified view of their interaction.
- Define three cases of SAQ based on the dependency between quantization noise and adversarial perturbations: independent, dependent, and hybrid, with theoretical and empirical comparison.
- Introduce an efficient training strategy that reduces the computational overhead of computing adversarial perturbations by reusing gradient information, achieving training speed comparable to SGD or AdamW.
- Apply SAQ during end-to-end training of quantized models, where both weight quantization and perturbation-based sharpness minimization are jointly optimized.
- Use a two-step optimization loop: first compute the perturbation that maximizes loss within a radius, then update weights to minimize the perturbed loss, adapted to the quantized weight space.
- Implement the method with standard optimizers (e.g., AdamW) and apply it to both convolutional networks and Vision Transformers across multiple benchmarks.
Experimental results
Research questions
- RQ1Can Sharpness-Aware Minimization (SAM) be effectively applied to quantized neural networks, and what challenges arise from the interaction between quantization and adversarial perturbations?
- RQ2How do the dependencies between quantization noise and adversarial perturbations affect the generalization performance of quantized models?
- RQ3What is the optimal formulation of SAQ—i.e., which of the three derived cases (independent, dependent, hybrid) yields the best trade-off between performance and training efficiency?
- RQ4Can SAQ achieve state-of-the-art performance in uniform quantization while incurring only minimal additional training cost?
- RQ5Does jointly optimizing for loss landscape flatness and quantization lead to better generalization and transfer learning performance compared to sequential approaches like SAM followed by quantization?
Key findings
- On ImageNet, SAQ achieves a 1.2% Top-1 accuracy gain over AdamW for 4-bit ViT-B/16, demonstrating state-of-the-art performance in uniform quantization.
- For 4-bit ResNet-50, SAQ surpasses the previous SOTA method by 0.9% in Top-1 accuracy, confirming its effectiveness on convolutional architectures.
- In transfer learning, SAQ improves Top-1 accuracy by 1.0% on Oxford-IIIT Pets and 0.7% on CIFAR-100 compared to SGD-trained quantized models.
- The efficient training strategy reduces SAQ's training time to within 11% of SGD, making it scalable to large models despite the added perturbation computation.
- SAQ outperforms the sequential approach of applying SAM to full-precision models followed by quantization (SAM → SGD) by 0.4% on Top-1 accuracy for 2-bit ResNet-18, proving the benefit of joint optimization.
- Comprehensive ablation shows that the hybrid case of SAQ, where perturbations depend on quantization noise, yields the best performance, highlighting the importance of modeling their interaction.
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.