Nearest is Not Dearest: Towards Practical Defense Against Quantization-Conditioned Backdoor Attacks

Boheng Li, Yishuo Cai, Haowei Li, Feng Xue, Zhifeng Li +1 more
2/9/2026

No official code found. Best implementation: AntigoneRandy/QuantBackdoor_EFRAP (13 stars, Apache-2.0, last commit 2024-08-14).

Abstract

Model quantization is widely used to compress and ac-celerate deep neural networks. However, recent studies have revealed the feasibility of weaponizing model quan-tization via implanting quantization-conditioned backdoors (QCBs). These special backdoors stay dormant on released full-precision models but will come into effect after stan-dard quantization. Due to the peculiarity of QCBs, existing defenses have minor effects on reducing their threats or are even infeasible. In this paper, we conduct the first in-depth analysis of QCBs. We reveal that the activation of existing QCBs primarily stems from the nearest rounding operation and is closely related to the norms of neuron-wise truncation errors (i.e., the difference between the continuous full-precision weights and its quantized version). Motivated by these insights, we propose Error-guided Flipped Rounding with Activation Preservation (EFRAP), an effective and practical defense against QCBs. Specifically, EFRAP learns a non-nearest rounding strategy with neuron-wise er-ror norm and layer-wise activation preservation guidance, flipping the rounding strategies of neurons crucial for back-door effects but with minimal impact on clean accuracy. Ex-tensive evaluations on benchmark datasets demonstrate that our EFRAP can defeat state-of-the-art QCB attacks under various settings. Code is available here.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Official Implementation for "Nearest Is Not Dearest: Towards Practical Defense against Quantization-conditioned Backdoor Attacks" (CVPR 2024).

131Shell, PythonFeb 29, 20242 years agoApache-2.0

Similar Papers

Cite this paper

@article{li2026nearest,
  title  = {Nearest is Not Dearest: Towards Practical Defense Against Quantization-Conditioned Backdoor Attacks},
  author = {Boheng Li and Yishuo Cai and Haowei Li and Feng Xue and Zhifeng Li and Yiming Li},
  year   = {2026},
  eprint = {2405.12725},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2405.12725},
  journal = {CVPR 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.12725.svg)](https://codeofpaper.com/paper/2405.12725)

Discussion