Trigger-Invariant Contrastive Unlearning for Backdoor Removal
Organizations: School of Computing Utah State University
Abstract
Backdoor attacks pose a severe threat to modern NLP models by embedding hidden triggers that induce malicious behavior at inference time. Recent unlearning methods such as gradient ascent (GA) attempt to remove backdoors by maximizing the loss on poisoned samples; however, these methods can suffer from a critical limitation: they may shift the trigger's influence to other classes rather than eliminating it. In this work, we propose Trigger-Invariant Contrastive Unlearning (TICU), a framework for mitigating textual backdoor behavior by enforcing prediction and representation invariance to trigger insertion. TICU constructs clean and trigger-inserted counterfactual pairs, then fine-tunes the model so that both inputs produce consistent output distributions and aligned hidden representations. To preserve clean-task performance, TICU also retains the supervised classification loss on clean data and constrains parameter drift from the original model. Extensive experiments across multiple datasets, model architectures, and attack settings show that TICU improves triggered accuracy and reduces trigger-induced prediction shifts compared with existing baselines, while maintaining competitive label-flipping performance and limiting clean-task degradation.
Figures & tables
| Dataset | #Classes | #Train | #Test | Avg. Length |
|---|---|---|---|---|
| SST-2 | 2 | 6,920 | 1,821 | 19.2 |
| HSOL | 2 | 5,823 | 2,485 | 13.2 |
| AG News | 4 | 8,000 | 1,000 | 37.1 |
| Model | Total | Trainable | Training |
|---|---|---|---|
| BERT-base | 110M | 110M | Full |
| DistilBERT-base | 66M | 66M | Full |
| LLaMA-2 7B | 6.63B | 20.0M | LoRA (0.30%) |
| Mistral 7B | 7.13B | 21.0M | LoRA (0.29%) |
| Qwen2 7B | 7.09B | 20.2M | LoRA (0.28%) |
| Model | Dataset | Attack | TICU | Best Baseline | RT | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ACC | LFR | TACC | TACC | Method | ACC | LFR | TACC | TACC | TACC | |||
| Llama2 | SST-2 | BadNet | 94.01 0.36 | 9.87 0.31 | 93.25 0.04 | 2.87 0.19 | NPO | 96.04 0.25 | 7.24 3.20 | 95.02 1.83 | 1.10 1.53 | 96.12 0.30 |
| AddSent | 94.18 0.17 | 8.99 0.25 | 91.98 0.15 | 1.96 0.22 | RGA | 94.95 0.11 | 7.78 2.74 | 91.23 1.13 | 2.71 0.39 | 93.94 0.79 | ||
| HiddenKiller | 94.18 0.41 | 19.96 0.53 | 79.35 0.38 | 0.36 0.08 | NPO | 96.66 0.23 | 5.96 2.29 | 66.89 13.86 | 12.10 14.02 | 78.99 0.26 | ||
| AG | BadNet | 90.60 0.49 | 9.33 0.27 | 90.40 0.08 | 0.70 0.11 | NPO | 91.43 0.35 | 9.82 0.56 | 89.93 0.55 | 0.50 0.17 | 89.70 0.85 | |
| AddSent | 90.80 0.25 | 9.20 0.33 | 91.00 0.05 | 0.73 0.12 | RGA | 89.40 0.62 | 12.80 1.44 | 86.93 1.11 | 3.33 0.85 | 90.27 0.95 | ||
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Dataset | Attack | ACC | LFR | TACC |
|---|---|---|---|---|---|
| Llama2 | SST-2 | BadNet | 95.66 | 91.34 | 54.20 |
| AddSent | 96.16 | 99.12 | 50.36 | ||
| HiddenKiller | 95.17 | 93.09 | 53.21 | ||
| AG | BadNet | 89.70 | 84.80 | 36.20 | |
| AddSent | 90.20 | 95.07 | 28.70 | ||
| HiddenKiller | 91.50 | 99.20 | 25.60 |
Backdoor Defense in LLMs
Backdoor defense in large language models detects, removes, or contains trigger-activated behavior while preserving ordinary capabilities.
See all 50 papers