Quantization-Conditioned Backdoors (QCBs) cause large language models (LLMs) to exhibit malicious behavior after quantization while remaining benign at high precision. Existing defenses often rely on security-guided configuration selection or iterative optimization, but do not identify which quantization-induced changes should be repaired. We isolate module-local quantization effects from upstream drift by evaluating the high-precision and quantized versions of each module on identical states from the quantized inference trajectory, and formulate QCB defense as repairing the resulting same-state operator discrepancies. We propose ReQOR, a training-free defense that identifies the dominant directions of these discrepancies on benign calibration data and restores the full-precision computation along them in closed form, yielding a factorized residual adapter. ReQOR uses neither attack information nor gradient-based optimization and supports both full-span and low-rank repair. Experiments across four LLMs, three PGD-based QCB attacks, three malicious behaviors, and three quantization formats show substantial QCB mitigation while largely preserving benign utility. In additional experiments on a non-PGD outlier-injection attack, existing baselines largely fail, whereas ReQOR remains effective. Further analysis shows that dominant operator-discrepancy directions provide more effective and rank-efficient repair than rank-matched random, low-energy, or raw weight-error directions, while low-rank ReQOR reduces deployment memory overhead.
Figures & tables
Figure 1: Overview of ReQOR. Benign calibration trajectories are used to construct a repair subspace from same-state operator discrepancies, from which a factorized residual adapter is derived and deployed alongside the quantized backbone.
Method
Security-Guided Selection
Gradient Opt.
Intervention Target
Gaussian Perturbation
Yes
No
Global weights
FlipGuard
Yes
No
High-error weights
QVec
Yes
No
Parameter shift
QuantGuard
No
Yes
Rounding decisions
ReQOR
No
No
Operator-output subspace
Table 1: Comparison of LLM QCB defenses. Security-guided selection indicates whether security feedback, such as attack success rates, is used to select the final defense configuration.
ELQ
Q-Misalign
ACL
Utility
Method
Content Inj.
Over-ref.
Jailbreak
Content Inj.
Over-ref.
Jailbreak
Content Inj.
Over-ref.
Jailbreak
MMLU (%) ↑
Δ MMLU (pp)
TQA (%) ↑
Δ TQA (pp)
Qwen2.5-3B-Instruct
FP32
0.00
1.11
0.00
0.00
0.22
3.78
0.00
3.33
14.89
64.36
+3.66
52.32
+2.78
Quantized
22.00
21.11
82.00
17.78
14.00
82.89
76.44
33.56
88.22
60.70
0.00
49.54
0.00
Gaussian ( 10−3 )
0.00
3.11
0.00
0.00
0.45
3.55
0.00
3.11
0.22
60.19
-0.51
51.55
+2.01
Gaussian ( 10−4 )
2.00
12.22
0.00
0.00
0.45
9.11
0.00
8.00
33.11
61.79
+1.09
50.87
+1.33
Table 2: Defense performance and benign utility across four LLMs under three PGD-based QCB attacks (ELQ, Q-Misalign, and ACL). ASR, MMLU, and TQA are reported in percentages; utility changes are in percentage points (pp). Best results among defenses are shown in bold and second-best results are underlined. When multiple methods tie for the best result, all are bolded and no second-best result is marked.
Figure 2: Excess representation drift across representative QCB settings under INT8, NF4, and FP4. Positive values indicate drift beyond the corresponding clean quantization baseline.
Discrepancy-Space Intervention
Matched r=1
Setting
Base
Full
Top-32
Rand.-32
Bottom-32
Disc.-SVD
Weight-SVD
ACL / Inj. / Qwen2.5-3B
76.44
0.00
0.00
64.31
75.11
0.00
18.00
Q-Mis. / Refusal / Llama-3.2-3B
17.78
0.00
0.00
12.36
15.78
0.00
8.22
ELQ / Jailbreak / Gemma-2-2B
88.89
0.00
0.00
85.42
86.22
0.00
63.78
Table 4: Analysis of the operator-discrepancy repair space. ASR (%) is averaged over INT8, NF4, and FP4. Lower is better.
Figure 3: Sensitivity of ReQOR to calibration size and trajectory length on Qwen2.5-3B-Instruct under ELQ. Insets enlarge the 0 – 1.2% ASR range.
Setting
Repair
Dolly (3 subsets)
SODA
GSM8K
MBPP
ACL / Injection / Qwen2.5-3B
Rank-32
0.00±0.00
0.00
0.00
0.00
Full
0.00±0.00
0.00
0.00
0.00
ELQ / Jailbreak / Gemma-2-2B
Rank-32
0.00±0.00
0.00
0.00
0.00
Full
0.00±0.00
0.00
0.00
0.00
Q-Misalign / Refusal / Llama-3.2-3B
Rank-32
0.00±0.00
0.00
0.00
0.00
Full
0.00±0.00
0.00
0.00
0.00
Table 7: Sensitivity to calibration domains and sampling. ASR (%) averaged over INT8, NF4, and FP4. Dolly reports mean ± standard deviation across three disjoint subsets.
Appendix figures & tables15 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 4: Overview of a QCB, where deployment-time quantization activates malicious behavior that remains dormant in the high-precision model.
Method
XFTF
XQTF
XQgen
QERA-exact (Remark 1)
6.67
1.33
0.00
QERA-approx
44.67
43.33
42.67
EoRA
20.00
13.33
8.00
ReQOR
6.67
0.67
0.00
Appendix
Table 8: Matched-rank comparison on ELQ/Jailbreak/Gemma-2-2B/INT8. ASR (%) over 150 attack prompts; lower is better. All methods use r=1 . EoRA uses sequential eigenspace compensation with numerical-rank truncation.
Method
Target Q
Eval.
Defense
Content Injection
Over-Refusal
Jailbreak
MMLU (%) ↑
TQA (%) ↑
ASR ↓
MMLU (%) ↑
TQA (%) ↑
ASR ↓
MMLU (%) ↑
TQA (%) ↑
ASR ↓
clean
-
fp32
-
60.12
46.61
0
60.12
46.61
1.33
60.12
46.61
0
int8
59.81
46.12
0
59.81
46.12
2.67
59.81
46.12
0
nf4
58.14
45.74
0
58.14
45.74
3.33
58.14
45.74
0
fp4
55.40
44.14
0
55.40
44.14
3.33
55.40
44.14
0.67
ELQ
int8
fp32
-
59.33
49.56
0.67
59.24
48.85
2.67
58.86
41.05
0
Appendix
Table 9: Complete quantization-specific results for Qwen2.5-1.5B-Instruct. MMLU, TQA, and ASR are reported in percent (%).
Method
Target Q
Eval.
Defense
Content Injection
Over-Refusal
Jailbreak
MMLU (%) ↑
TQA (%) ↑
ASR ↓
MMLU (%) ↑
TQA (%) ↑
ASR ↓
MMLU (%) ↑
TQA (%) ↑
ASR ↓
clean
-
fp32
-
65.50
58.69
0
65.50
58.69
2
65.50
58.69
0
int8
64.67
56.39
0
64.67
56.39
0.67
64.67
56.39
0
nf4
64.34
57.14
0
64.34
57.14
0
64.34
57.14
0
fp4
59.01
55.64
0
59.01
55.64
0.67
59.01
55.64
0.67
ELQ
int8
fp32
-
64.62
54.46
0
65.05
54.26
0.67
64.69
46.88
0
Appendix
Table 10: Complete quantization-specific results for Qwen2.5-3B-Instruct. MMLU, TQA, and ASR are reported in percent (%).
Method
Target Q
Eval.
Defense
Content Injection
Over-Refusal
Jailbreak
MMLU (%) ↑
TQA (%) ↑
ASR ↓
MMLU (%) ↑
TQA (%) ↑
ASR ↓
MMLU (%) ↑
TQA (%) ↑
ASR ↓
clean
-
fp32
-
56.59
53.11
0
56.59
53.11
0
56.59
53.11
0.67
int8
56.64
53.32
0
56.64
53.32
0
56.64
53.32
0.67
nf4
56.01
53.77
0
56.01
53.77
0
56.01
53.77
0.67
fp4
55.23
52.40
0
55.23
52.40
0
55.23
52.40
1.33
ELQ
int8
fp32
-
52.26
51.61
2
52.09
47.21
2
52.07
47.48
0
Appendix
Table 11: Complete quantization-specific results for Gemma-2-2B-it. MMLU, TQA, and ASR are reported in percent (%).
Method
Target Q
Eval.
Defense
Content Injection
Over-Refusal
Jailbreak
MMLU (%) ↑
TQA (%) ↑
ASR ↓
MMLU (%) ↑
TQA (%) ↑
ASR ↓
MMLU (%) ↑
TQA (%) ↑
ASR ↓
clean
-
fp32
-
62.30
51.47
0
62.30
51.47
1.33
62.30
51.47
1.33
int8
61.84
51.65
0
61.84
51.65
0.67
61.84
51.65
1.33
nf4
59.82
50.40
0
59.82
50.40
0.67
59.82
50.40
1.33
fp4
59.75
50.26
0
59.75
50.26
0
59.75
50.26
2
ELQ
int8
fp32
-
59.23
52.48
0
59.83
50.51
0.67
60.19
42.31
0
Appendix
Table 12: Complete quantization-specific results for Llama-3.2-3B-Instruct. MMLU, TQA, and ASR are reported in percent (%).
Model / Behavior
Quant.
Attacked
Gaussian
QVec
QuantGuard
ReQOR-32
ReQOR-Full
Qwen2.5-3B / Content Injection
BF16
0.00
–
–
–
–
–
INT8
96.00
78.67
94.67
92.00
0.00
0.00
NF4
74.67
51.33
55.33
86.00
0.67
0.00
FP4 †
0.00
0.00
1.33
0.00
0.00
0.00
Llama-3.2-3B / Over-Refusal
BF16
0.00
–
–
–
–
–
INT8
60.00
56.67
68.00
73.33
0.00
0.67
Appendix
Table 13: Defense performance against outlier-injection attack ( Zhan et al., 2026 ) . All values are ASR (%); lower is better. BF16 denotes the attacked checkpoint before quantization. Gaussian uses σ=10−3 and QVec uses α=0.3 .
Model / Behavior
Quant.
Attacked
Gaussian
QVec
QuantGuard
ReQOR-32
ReQOR-Full
Qwen2.5-3B / Injection
BF16
60.78
–
–
–
–
–
INT8
60.29
59.65
60.25
60.41
60.33
60.53
NF4
59.40
58.62
57.46
59.29
60.38
60.24
FP4 †
54.66
49.76
52.91
52.17
59.41
59.35
Llama-3.2-3B / Refusal
BF16
59.92
–
–
–
–
–
INT8
59.66
57.51
60.06
59.66
59.74
59.39
Appendix
Table 14: Benign utility under outlier-injection attack ( Zhan et al., 2026 ) . (a) MMLU and (b) TruthfulQA-MC2 (%); higher is better. BF16 denotes the attacked checkpoint before quantization.
Setting
Quantization
Baseline
Bottom-32
Random-32
Top-32
Full
ACL / Content Injection / Qwen2.5-3B
INT8
75.33
75.33
72.93
0.00
0.00
ACL / Content Injection / Qwen2.5-3B
NF4
82.00
80.67
58.40
0.00
0.00
ACL / Content Injection / Qwen2.5-3B
FP4
72.00
69.33
61.60
0.00
0.00
Q-Misalign / Over-Refusal / Llama-3.2-3B
INT8
19.33
16.67
12.27
0.00
0.00
Q-Misalign / Over-Refusal / Llama-3.2-3B
NF4
15.33
15.33
12.13
0.00
0.00
Q-Misalign / Over-Refusal / Llama-3.2-3B
FP4
18.67
15.33
12.67
0.00
0.00
Appendix
Table 15: Quantization-specific results for the QCB-relevant operator subspace analysis. ASR (%) is reported separately for INT8, NF4, and FP4. Top-32, Bottom-32, and Random-32 have identical rank. Random-32 reports the mean over five independently sampled rank-32 subspaces for each quantization format.
Setting
Rank
Disc.-SVD
Weight-SVD
Gap
Adapter (MiB)
ACL / Injection / Qwen2.5-3B
1
0.00
18.00
18.00
3.57
2
0.00
20.44
20.44
7.14
4
0.00
0.22
0.22
14.28
8
0.00
0.00
0.00
28.55
16
0.00
0.00
0.00
57.10
32
0.00
0.00
0.00
114.20
Appendix
Table 16: Matched low-rank comparison between operator-discrepancy directions ( Disc.-SVD ) and dominant raw weight-error directions ( Weight-SVD ). ASR (%) is averaged over INT8, NF4, and FP4. Both methods use the same rank, residual parameterization, and adapter parameter budget. The gap is computed as Weight-SVD ASR minus Disc.-SVD ASR; larger positive values indicate a larger advantage for Disc.-SVD at the same rank.
Setting
Clean Rank
QCB Rank
RMS Ratio
Clean E@1
QCB E@1
Overlap@1
Overlap@8
Overlap@32
ACL / Injection / Qwen2.5-3B
676.30
675.40
1.21 ×
0.252
0.400
0.325
0.251
0.289
ELQ / Jailbreak / Gemma-2-2B
829.72
829.82
1.17 ×
0.224
0.321
0.321
0.322
0.314
Q-Misalign / Refusal / Llama-3.2-3B
848.56
845.30
1.15 ×
0.162
0.320
0.134
0.153
0.234
Appendix
Table 17: Comparison of operator-discrepancy geometry between genuinely clean and QCB-affected checkpoints. Values are averaged over INT8, NF4, and FP4. Rank denotes the mean numerical rank across modules, RMS Ratio denotes the QCB-to-clean RMS discrepancy magnitude, and E@1 denotes the fraction of discrepancy energy explained by the leading singular direction.
N
Avg. ASR (%) ↓
Mean Rank
Adapter (MiB) ↓
10
0.81
159
570
20
0.59
300
1,119
50
0.37
636
2,653
100
0.59
1,121
4,950
Appendix
Table 18: Detailed sensitivity results for the number of benign calibration prompts N with T=16 . ASR, numerical rank, and adapter size are averaged over three behaviors and three quantization formats.
T
Avg. ASR (%) ↓
Mean Rank
Adapter (MiB) ↓
4
0.89
198
711
8
0.37
357
1,378
16
0.37
636
2,653
32
0.52
1,142
5,033
Appendix
Table 19: Detailed sensitivity results for generation length T with N=50 . ASR, numerical rank, and adapter size are averaged over three behaviors and three quantization formats.
Setting
Repair
Dolly (3 subsets)
SODA
GSM8K
MBPP
ELQ / Injection / Qwen2.5-1.5B
Rank-32
1.11±0.44
1.78
2.00
5.33
Full
0.30±0.13
0.22
1.33
0.22
Q-Misalign / Jailbreak / Gemma-2-2B
Rank-32
5.56±0.22
4.67
10.22
10.89
Full
1.70±0.34
1.34
1.56
1.33
Appendix
Table 20: Calibration-domain and sampling sensitivity in two additional challenging QCB settings. ASR (%) is averaged over INT8, NF4, and FP4. Dolly reports mean ± standard deviation across three disjoint subsets.
Model
Method
MMLU ↑
TQA ↑
Qwen2.5-1.5B
Clean Quantized
57.77
45.33
Gaussian
57.80
46.83
QVec
57.62
45.18
FlipGuard
56.93
46.17
QuantGuard
57.81
45.60
ReQOR (full)
59.67
46.53
Appendix
Table 21: Benign utility when defenses are applied to clean, non-backdoored quantized models. MMLU and TruthfulQA (TQA) are averaged over INT8, NF4, and FP4 and reported in percentages. ReQOR uses full-span repair.
Model quantization is essential for the efficient deployment of Large Language Models (LLMs), but introduces a critical vulnerability: Quantization-Conditioned Backdoor (QCB) attacks. In these attacks, malicious behaviors remain dormant in full-precision models and activate only after specific quantization distortions, bypassing standard security audits. To mitigate this, we introduce FlipGuard, a proactive defense framework that selectively perturbs model weights prior to quantization. By breaking the adversary's precise alignment between weight patterns and quantization boundaries, FlipGuard suppresses backdoor activation without requiring access to training data or trigger samples. We further propose the Defense Effectiveness Ratio (DER), a unified metric to jointly evaluate security gains, utility preservation, and computational cost. Extensive experiments across seven LLMs (including StarCoder and LLaMA-family models) and three quantization schemes (INT8, FP4, NF4) demonstrate that FlipGuard effectively neutralizes QCBs across three scenarios, i.e., vulnerable code generation, content injection, and over-refusal, achieving high security with negligible performance degradation.
Aoying Zheng, Anqi Du, Zizhuang Deng +1
School of Cyber Science and Technology Shandong University · Suzhou Research Institute of Shandong University
Quantization is one of the default deployment paths for open-weight LLM agents, but it is not behavior-preserving: an adversary can release a full-precision checkpoint that passes audits yet misbehaves once quantized, termed as quantization-conditioned attack (QCA). Prior QCA work targets free-text generation, where harm is mediated by a human reader. In contrast, the agentic setting poses a more severe risk: the triggered payload is a structured function that can be executed without human oversight. We present the first study of QCA against LLM agents. We find that directly adapting prior backdoor-injection methods can produce malicious behavior after quantization, but substantially degrades benign utility, rendering the resulting attacks impractical. To understand the true upper bound of the threat, we propose AGENTQ, an attack framework that combines layer-banded LoRA injection with partial-PGD repair over a multi-codebook quantization-equivalence class. AGENTQ preserves normal agentic capability while concentrating malicious behavior in the quantized model. Across three trigger-action pairs and three codebooks (NF4, FP4, INT8), AGENTQ reaches up to 100% post-quantization attack success rate with minimal loss of benign utility, underscoring the need to make quantization-aware safety evaluation a standard requirement before open-weight agents are deployed.
LLM quantization has become essential for memory-efficient deployment. Recent work has shown that quantization schemes can pose critical security risks: an adversary may release a model that appears benign in full precision but exhibits malicious behavior once quantized by users. However, existing quantization-conditioned attacks have been limited to relatively simple quantization methods, where the attacker can estimate weight regions that remain invariant under the target quantization. Notably, prior attacks have consistently failed to compromise more popular and sophisticated schemes, limiting their practical impact. In this work, we introduce the first quantization-conditioned attack that consistently induces malicious behavior that can be triggered by a broad range of advanced quantization techniques, including AWQ, GPTQ, and GGUF I-quants. Our attack exploits a simple property shared by many modern quantization methods: large outliers can cause other weights to be rounded to zero. Consequently, by injecting outliers into specific weight blocks, an adversary can induce a targeted, predictable weight collapse in the model. This effect can be used to craft seemingly benign full-precision models that exhibit a wide range of malicious behaviors after quantization. Through extensive evaluation across three attack scenarios and LLMs, we show that our attack achieves high success rates against a broad range of quantization methods on which prior attacks fail. Our results demonstrate, for the first time, that the security risks of quantization are not restricted to simpler schemes but are broadly relevant across complex, widely-used quantization methods.