RobustMQ: Benchmarking Robustness of Quantized Models

Yisong Xiao, Aishan Liu, Tianyuan Zhang, Haotong Qin, Jinyang Guo, Xianglong Liu

Abstract

Quantization has emerged as an essential technique for deploying deep neural networks (DNNs) on devices with limited resources. However, quantized models exhibit vulnerabilities when exposed to various noises in real-world applications. Despite the importance of evaluating the impact of quantization on robustness, existing research on this topic is limited and often disregards established principles of robustness evaluation, resulting in incomplete and inconclusive findings. To address this gap, we thoroughly evaluated the robustness of quantized models against various noises (adversarial attacks, natural corruptions, and systematic noises) on ImageNet. The comprehensive evaluation results empirically provide valuable insights into the robustness of quantized models in various scenarios, for example: (1) quantized models exhibit higher adversarial robustness than their floating-point counterparts, but are more vulnerable to natural corruptions and systematic noises; (2) in general, increasing the quantization bit-width results in a decrease in adversarial robustness, an increase in natural robustness, and an increase in systematic robustness; (3) among corruption methods, impulse noise and glass blur are the most harmful to quantized models, while brightness has the least impact; (4) among systematic noises, the nearest neighbor interpolation has the highest impact, while bilinear interpolation, cubic interpolation, and area interpolation are the three least harmful. Our research contributes to advancing the robust quantization of models and their deployment in real-world scenarios.

Introduction

Deep Neural Networks (DNNs) are notoriously resource-hungry. To run them on smartphones or embedded devices, engineers use quantization—mapping high-precision 32-bit floating-point numbers to low-bit integers (like 4-bit or even 2-bit). While we know this saves memory and power, we don't fully understand how it affects a model's "toughness" or robustness.

Previous studies on quantized model robustness were often small-scale, used inconsistent metrics, or ignored "systematic noise"—the subtle errors introduced by different hardware decoders or image-resizing libraries. The authors introduce RobustMQ to fill this gap, providing a standardized, large-scale evaluation of how quantization impacts a model's ability to handle the messy reality of the physical world.

Methodology and Datasets

The researchers built a massive evaluation framework centered on Quantization-Aware Training (QAT), where models are trained to anticipate the precision loss. They tested:

  • Three Quantization Methods: DoReFa, PACT, and LSQ.
  • Four Architectures: ResNet18, ResNet50, RegNetX600M, and MobileNetV2.
  • Four Bit-widths: 2, 4, 6, and 8 bits.

They evaluated these models against three categories of "noise" using specialized variants of the ImageNet dataset:

  1. Adversarial Attacks: Deliberate, pixel-perfect perturbations (FGSM, PGD, and AutoAttack).
  2. Natural Corruptions (ImageNet-C): 15 types of real-world distortions including weather (fog, snow), blur, and digital noise.
  3. Systematic Noises (ImageNet-S): Discrepancies caused by using different software libraries (OpenCV vs. Pillow) or different mathematical algorithms for resizing images.

Key Insights

  • The Adversarial Paradox: Counter-intuitively, lower-bit models often show higher adversarial robustness than their full-precision counterparts. For example, a 2-bit ResNet18 can be more resistant to a PGD attack than a standard 32-bit model. This suggests that the "roughness" or discretization of quantized weights acts as a natural defense, making it harder for attackers to find the precise gradient path needed to fool the model.
  • The Fragility Trade-off: There is no free lunch. While quantization helps against targeted attacks, it hurts against random noise. As bit-width decreases, the model becomes much more sensitive to "natural" issues like impulse noise or glass blur.
  • The "Nearest Neighbor" Trap: For engineers deploying these models, the paper offers a very practical warning: Nearest neighbor interpolation is the most harmful way to resize images for quantized models. Using bilinear or cubic interpolation provides much better stability.
  • Methodological Strengths: The Learned Step-size Quantization (LSQ) method generally emerged as the most robust choice for ResNet architectures, while PACT performed better on more modern, lightweight architectures like RegNet.

Key Results

The researchers found that while clean accuracy stays relatively stable down to 4 bits, robustness metrics swing wildly.

Clean accuracy of quantized vs FP models
  • Adversarial Gains: In a worst-case scenario with small perturbations, a 2-bit ResNet18 (DoReFa) achieved a robustness score of 5.55%, compared to just 1.30% for the 32-bit floating-point version.
  • Natural and Systematic Fragility: Under natural corruptions, that same 2-bit model saw its performance drop significantly compared to the floating-point model. Furthermore, 2-bit models were found to be roughly 3.43 times more unstable than floating-point models when switching between different image decoders.
Worst-case adversarial robustness results

Conclusion and Future Work

RobustMQ highlights a critical trade-off in model compression: making models smaller can make them more resistant to adversarial attacks but more fragile to natural and systematic noise. Future work will likely focus on developing "robust-by-design" quantization methods that can protect against both malicious attacks and messy real-world noise simultaneously, as well as exploring the robustness profiles of Post-Training Quantization (PTQ).

Summary updated

BibTeX
@article{xiao2023robustmq,
  author = {Yisong Xiao and Aishan Liu and Tianyuan Zhang and Haotong Qin and Jinyang Guo and Xianglong Liu},
  title = {{RobustMQ: Benchmarking Robustness of Quantized Models}},
  journal = {Vis. Intell.},
  year = {2023},
  doi = {10.1007/s44267-023-00031-w},
}
Figure