Abstract
Quantization is a promising technique for reducing the bit-width of deep models to improve their runtime performance and storage efficiency, and thus becomes a fundamental step for deployment. In real-world scenarios, quantized models are often faced with adversarial attacks which cause the model to make incorrect inferences by introducing slight perturbations. However, recent studies have paid less attention to the impact of quantization on the model robustness. More surprisingly, existing studies on this topic even present inconsistent conclusions, which prompted our in-depth investigation. In this paper, we conduct a first-time analysis of the impact of the quantization pipeline components that can incorporate robust optimization under the settings of Post-Training Quantization and Quantization-Aware Training. Through our detailed analysis, we discovered that this inconsistency arises from the use of different pipelines in different studies, specifically regarding whether robust optimization is performed and at which quantization stage it occurs. Our research findings contribute insights into deploying more secure and robust quantized networks, assisting practitioners in reference for scenarios with high-security requirements and limited resources.
Introduction
As deep learning models are increasingly deployed on resource-constrained edge devices, quantization has become a standard practice to reduce memory footprint and latency. By converting 32-bit floating-point weights into lower-precision integers (e.g., 8-bit or 4-bit), significant efficiency gains are achieved. However, these models often operate in environments where security is paramount, making them targets for adversarial attacks: tiny, invisible perturbations to input data that force a model to make confident, wrong predictions.
The impact of quantization on adversarial robustness has been a subject of debate in the research community. Conflicting reports suggest that quantization can either act as a defense mechanism by "filtering" noise or exacerbate vulnerabilities by amplifying errors. This study resolves these contradictions by decomposing the quantization pipeline and identifying how specific design choices—such as initialization and training strategies—dictate the final model's robustness.
Methodology
The researchers analyzed the quantization process as a two-stage pipeline, focusing on the components that influence robust optimization.
1. Preparation Stage
This stage involves selecting the initial state of the model and the data used for quantization:
- FP Model Parameters: The starting point can be random weights, standard pre-trained (non-robust) weights, or weights from a model already optimized for robustness.
- Dataset Size: The study evaluates the impact of using the full dataset versus partial datasets for the quantization process.
2. Quantization Stage
The second stage involves the actual conversion and fine-tuning:
- Quantization Precision: Determining the bit-width for both weights and activations.
- Quantization Method: Comparing Post-Training Quantization (PTQ) and Quantization-Aware Training (QAT).
- Training Strategy: For QAT, three strategies were explored: Vanilla Training (clean data), Adversarial Training (attacked data), and Adversarial Transfer Learning (knowledge distillation from a robust teacher).
Experiments were conducted on the CIFAR-10 dataset using a ResNet20 architecture, providing a standard benchmark for evaluating these trade-offs.
Key Insights and Pipeline Analysis
The study reveals that the perceived impact of quantization on robustness is highly dependent on the specific pipeline configuration. This explains why previous studies reached seemingly contradictory conclusions.
The Role of Initialization and Fine-Tuning
A critical finding is the "Clean Fine-Tuning Trap." When a robustly pre-trained model is quantized using Vanilla QAT (standard clean data), it quickly loses its robustness (dropping to near 0.1%). The model prioritizes recovering clean accuracy at the expense of the adversarial defenses it previously possessed.
Activation vs. Weight Quantization
The research highlights that quantizing activations often has a more significant impact on robustness than quantizing weights, especially against weak attacks. For instance, 2-bit activation quantization was found to improve robustness by over 33% by effectively "clipping" small adversarial perturbations, acting as a natural filter.
Efficiency through Transfer Learning
While standard Adversarial Training during QAT is effective, it is computationally expensive, increasing training time by approximately 700%. Robust Transfer Learning (Adversarial Transfer Learning) emerged as a superior alternative. It allows a quantized "student" model to inherit robustness from a full-precision "teacher" model efficiently. In some cases, such as the A6W6 configuration, the quantized student (48.50% robustness) even outperformed its teacher (46.43%).
Conclusion
This investigation clarifies the complex relationship between quantization and adversarial robustness. The findings suggest that robustness is not an inherent property of quantized models but a result of deliberate pipeline choices. For practitioners, Robust Transfer Learning is recommended as an efficient and effective strategy for deploying secure models on edge devices, even when labeled data is limited. Future research should extend these findings to larger architectures and explore defenses against adaptive attacks tailored to quantization errors.
Summary updated