Quantization Backdoors to Deep Learning Models

Hua Ma, Huming Qiu, Yansong Gao, Zhi Zhang, Alsharif Abuadbba, Anmin Fu, Said F. Al-Sarawi, Derek Abbott

TL;DR

This paper reveals a novel security vulnerability where standard deep learning model quantization techniques, like those in TensorFlow Lite and PyTorch Mobile, can unintentionally activate dormant backdoors. This means models that appear secure in their high-precision form can become malicious after quantization for edge devices, posing a significant threat to the deployment of AI on resource-constrained platforms.

What Problem Does This Paper Address?

Deep learning (DL) models are increasingly being deployed on edge devices like IoT sensors and smartphones due to their low latency and privacy benefits. However, these devices have limited computational power and memory, making it difficult to run large, high-precision (e.g., 32-bit floating-point) DL models. Model quantization, which reduces model precision (e.g., to 8-bit integers), is a common solution to enable deployment on these devices while largely preserving accuracy. The problem this paper addresses is whether this essential quantization process, particularly post-training quantization (PTQ) offered by commercial frameworks, introduces new security vulnerabilities. Specifically, the authors investigate if a model that is seemingly free of backdoors in its full-precision form can become vulnerable after quantization.

Methods

The core of the paper's contribution lies in demonstrating a "Post-Training Quantization (PQ) backdoor attack." The attack involves a two-step process:

  1. Backdoor Injection (Dormant): An attacker first trains a full-precision DL model with a "dormant" backdoor. This backdoor is designed to have no discernible effect on the model's accuracy or behavior when presented with normal inputs or even inputs with a trigger. Crucially, this dormant backdoor is engineered to evade standard backdoor detection methods applied to the full-precision model.
  2. Backdoor Activation (Quantization): The victim user, unaware of the dormant backdoor, then applies standard post-training quantization (using frameworks like TensorFlow Lite or PyTorch Mobile) to convert the full-precision model into a low-precision format (e.g., int-8). The paper shows that the quantization process itself, specifically the truncation errors introduced when converting floating-point numbers to integers, "wakes up" the dormant backdoor. This activated backdoor then reliably misclassifies inputs containing a specific trigger into an attacker-defined target class, while still performing normally on clean inputs.

To achieve this, the authors developed a sophisticated fine-tuning strategy to first remove explicit backdoor behavior from the full-precision model (making it appear clean) and then preserve the backdoor's potential to be activated by quantization. They also developed an emulator to accelerate the slow integer-only inference required for training the quantized models on standard x86 machines.

Datasets

The authors used three widely-used datasets for their experiments:

  • MNIST: A dataset of handwritten digits.
  • CIFAR-10: A dataset of 10 object categories.
  • GTSRB (German Traffic Sign Recognition Benchmark): A dataset for traffic sign classification.

These datasets were chosen to evaluate the generality of their attack across different types of image classification tasks.

Key Insights and Ideas

  • Quantization as an Attack Vector: The most significant insight is that the process of model quantization, intended for efficiency, can inadvertently serve as an attack vector to activate hidden backdoors. This is a novel vulnerability not previously explored.
  • Dormant Backdoors Evade Detection: Backdoors can be designed to be completely undetectable in their full-precision form, even by state-of-the-art detection methods. This highlights a critical gap in current security practices.
  • Truncation Errors as the Key: The paper identifies the inherent truncation errors in the quantization process as the mechanism that activates the dormant backdoor. This is a fundamental property of quantization that can be exploited.
  • Cross-Platform Vulnerability: The attack is demonstrated to be effective on both TensorFlow Lite (a product-ready framework) and PyTorch Mobile (a beta framework), indicating a broad applicability across popular deployment tools.
  • Stealthy Threat: The PQ backdoor is particularly stealthy because the full-precision model appears clean, and the activation only occurs after the user performs a standard, expected operation (quantization).

Key Results

  • High Attack Success Rate (ASR): The PQ backdoor attack consistently achieved an attack success rate close to 100% on quantized models when presented with trigger inputs.
  • Preserved Clean Data Accuracy (CDA): The quantized models maintained a clean data accuracy comparable to their original full-precision counterparts, making them appear legitimate.
  • Evasion of Defenses: Standard backdoor detection methods (Neural Cleanse, STRIP, ABS, MNTD) failed to detect the dormant backdoor in the full-precision model. While some defenses could detect the activated backdoor in the quantized model, others (like ABS and MNTD) were found to be non-robust and also failed to detect the quantized backdoor.
  • Generality: The attack was demonstrated across three popular model architectures (VGG16, ResNet18, ResNet50) and three diverse datasets (MNIST, CIFAR10, GTSRB).
  • Practicality: The attack was shown to be effective on both TensorFlow Lite and PyTorch Mobile, two major frameworks for on-device DL.

Limitations and Future Work

  • Emulator Dependency: The authors developed a float-32 emulator to speed up the training of the PQ backdoor on x86 machines, as native integer-only inference is slow. While effective, this highlights a practical challenge for attackers needing to perform this training.
  • Source-Specific Backdoors: While the paper demonstrates the PQ backdoor's effectiveness against source-agnostic attacks, it also briefly explores how it can be combined with source-specific backdoor variants to further evade detection. This suggests avenues for more sophisticated attacks.
  • Backdoor Removal: The paper briefly discusses potential backdoor removal methods, but notes that existing techniques often require significant computational resources or DL expertise, which contradicts the threat model of a typical end-user. They suggest injecting Gaussian noise into the full-precision model as a potential lightweight preventative defense.
  • Other Tasks: The current work focuses on image classification. The authors suggest that other tasks like image segmentation, object detection, and audio/text processing could also be vulnerable.
  • Model Size: Larger models are hypothesized to be more vulnerable to concealed dormant backdoors.

Summary updated

BibTeX
@article{ma2024quantization,
  author = {Hua Ma and Huming Qiu and Yansong Gao and Zhi Zhang and Alsharif Abuadbba and Anmin Fu and Said F. Al-Sarawi and Derek Abbott},
  title = {{Quantization Backdoors to Deep Learning Models}},
  journal = {IEEE Trans. Dependable Secur. Comput.},
  year = {2024},
  url = {https://openreview.net/forum?id=7Dtpe0Slbh},
}
Figure