Executive Summary
QuantAttack is a novel adversarial attack targeting the computational efficiency of Vision Transformers (ViTs). By injecting "synthetic outliers" into input images, the attack forces dynamically quantized models to switch from efficient 8-bit calculations to resource-heavy 16-bit precision. This significantly increases memory usage, latency, and energy consumption while maintaining high classification accuracy to remain stealthy.
The Vulnerability of Dynamic Quantization
As Deep Neural Networks (DNNs) grow, quantization—representing weights and activations with fewer bits—is essential for edge deployment. Dynamic quantization (e.g., LLM.int8()) maintains accuracy by identifying high-magnitude "outliers" and processing them in higher precision. However, this creates an "availability" gap: an adversary can craft inputs to trigger worst-case computational scenarios, shifting from traditional integrity attacks to those that "clog" the system.
Methodology: QuantAttack
QuantAttack utilizes a modified Projected Gradient Descent (PGD) optimization with a dual-component loss function:
- Quantization Loss ($\mathcal{L}_{quant}$): Identifies top-K values in hidden layers and pushes them toward a target value exceeding the quantization threshold ($\tau$), forcing 16-bit precision hardware usage.
- Classification Loss ($\mathcal{L}_{cls}$): Ensures the model predicts the correct class, keeping the attack stealthy and difficult for anomaly detectors to identify.
The attack was tested in single-image, class-universal, and universal variants across architectures like ViT-Base and DeiT-Base, as well as multi-modal models like OWLv2 and Whisper.
Key Insights
- Normalization Gatekeepers: Layer Normalization ($f_{LN}$) often suppresses outliers in early layers. Consequently, later layers, particularly Feed-Forward Networks, are the primary targets for generating synthetic outliers.
- Batch Poisoning: In shared ML environments, a single malicious image can slow down an entire batch. Because dynamic quantization often processes entire columns in high precision if one outlier is detected, one "heavy" image forces increased computation for every other image in that batch.
- Stealth-Efficiency Trade-off: Attackers can trigger a full Denial-of-Service (DoS) attack, increasing GPU memory usage by up to 70% if they forego stealth (i.e., allowing visible noise).
Quantitative Impact
On ViT models, single-image perturbations caused a 1681% increase in outlier multiplications, resulting in a 17.2% increase in GPU memory usage, a 9% increase in processing time, and a 7% increase in energy consumption.
As illustrated in the figure above, the relative impact of the attack is most pronounced at smaller batch sizes. While increasing batch size can "dilute" the percentage overhead, the absolute resource strain remains significant across all tested configurations.
Conclusion and Future Work
QuantAttack demonstrates that the data-dependent nature of dynamic quantization introduces significant availability risks. While countermeasures like limiting high-precision operations or increasing batch sizes exist, they often involve trade-offs in accuracy or performance. Future research will extend these findings to Large Language Models (LLMs), where dynamic quantization is a standard industry practice.
Summary updated