As backdoor attacks become more stealthy and robust, they reveal critical weaknesses in current defense strategies: detection methods often rely on coarse-grained feature statistics, and purification methods typically require full retraining or additional clean models. To address these challenges, we propose DUP (Detection-guided Unlearning for Purification), a unified framework that integrates backdoor detection with unlearning-based purification. The detector captures feature-level anomalies by jointly leveraging class-agnostic distances and inter-layer transitions. These deviations are integrated through a weighted scheme to identify poisoned inputs, enabling more fine-grained analysis. Based on the detection results, we purify the model through a parameter-efficient unlearning mechanism that avoids full retraining and does not require any external clean model. Specifically, we innovatively repurpose knowledge distillation to guide the student model toward increasing its output divergence from the teacher on detected poisoned samples, effectively forcing it to unlearn the backdoor behavior. Extensive experiments across diverse attack methods and language model architectures demonstrate that DUP achieves superior defense performance in detection accuracy and purification efficacy. Our code is available at https://github.com/ManHu2025/DUP.
Figures & tables
Figure 1: Visualization of feature distributions under the BadNets attack on SST-2, extracted from BERT’s Layer 1 ( left ) and Layer 5 ( right ).
Figure 2: The workflow of the DUP framework. The detection module ( top half ) measures anomalies in intermediate features from two complementary perspectives, while the purification module ( bottom half ) employs Lunlearn for backdoor removal.
Attack
Defense
BERT
BART
LLaMA 3B
Qwen 3B
AUC
FAR
FRR
AUC
FAR
FRR
AUC
FAR
FRR
AUC
FAR
FRR
BadNets
STRIP
52.37
85.97
11.48
51.75
89.91
9.88
54.78
80.70
13.73
52.86
86.95
9.39
DAN
90.97
40.68
5.49
83.64
71.93
4.01
62.21
88.82
5.60
64.66
87.61
6.10
NAS
99.14
0.32
5.49
94.64
80.92
4.61
87.62
82.57
5.33
94.21
83.22
4.89
MS
100
0.00
5.44
99.27
0.22
8.95
94.39
32.13
7.58
98.29
0.44
7.36
AddSent
STRIP
53.95
87.17
11.53
50.44
91.23
7.74
51.63
90.57
8.68
54.38
84.54
11.53
Table 1: Backdoor detection performance of MS and baselines on the SST-2 dataset. Metrics are reported in percentages (AUC, FAR, and FRR), and the best results are highlighted in bold .
Dataset
Metric
STRIP
DAN
NAS
MS
SST-2
AUC ↑
52.49
73.89
92.12
96.85
FAR ↓
88.66
77.47
52.65
10.04
FRR ↓
9.70
5.05
5.00
6.74
YELP
AUC ↑
53.20
86.06
97.94
99.10
FAR ↓
86.08
44.73
9.03
2.60
FRR ↓
10.55
7.14
5.66
6.33
Table 2: Average backdoor detection performance (in percentage) of our MS and baselines across four attack types (BadNets, AddSent, Stylebkd, and Synbkd) and four backdoored models (BERT, BART, LLaMA 3B, and Qwen 3B).
Models
Setting
BERT
BART
LLaMA 3B
BadNets
first half
88.10
58.53
51.31
last half
99.84
81.15
90.16
all
99.56
74.73
80.01
top-k
100
99.27
94.39
AddSent
first half
99.15
53.05
68.89
last half
99.92
97.41
96.33
Table 3: Backdoor detection performance (AUC in percentage) of MS with different layer selection strategy on SST-2.
Models
Setting
BERT
BART
LLaMA 3B
BadNets
w/o ss
99.90
85.71
95.61
w/ ss
100
99.27
94.39
AddSent
w/o ss
99.97
98.69
98.21
w/ ss
99.98
98.96
97.93
Stylebkd
w/o ss
88.09
99.76
99.42
w/ ss
88.14
99.78
99.44
Table 4: Backdoor detection performance (AUC in percentage) of MS with and without spectral signatures ( w/ ss and w/o ss ) across different models on the SST-2 dataset.
Attack
Defense
BERT
BART
LLaMA 3B
Qwen 3B
CACC ↑
ASR ↓
CACC ↑
ASR ↓
CACC ↑
ASR ↓
CACC ↑
ASR ↓
BadNets
ONION
81.27
38.93
85.06
30.26
86.49
23.25
85.34
26.32
BadActs
82.40
37.83
-
-
-
-
-
-
TG
85.28
32.46
83.25
34.54
89.07
48.57
61.07
90.46
DUP
88.96
1.64
91.27
3.84
91.98
1.43
91.21
0.22
AddSent
ONION
85.56
93.75
89.07
94.85
87.70
83.99
86.27
73.46
Table 5: Comparison of purification performance (CACC and ASR in percentage) between DUP and baseline defenses across four attack types and four model architectures on the SST-2 dataset. BadActs is implemented only for BERT.
Figure 3: The impact of different loss components on the purification performance of DUP on BERT (SST-2).
Figure 4: Impact of λasr and λacc on purification performance of DUP on BERT (SST-2). Left: Varying λasr with fixed λacc . Right: Varying λacc with fixed λasr .
Attack
Setting
CACC ↑
ASR ↓
BadNets
w/o reg
88.96
1.64
w/ reg
89.62
3.51
AddSent
w/o reg
90.17
0.22
w/ reg
89.62
0
Stylebkd
w/o reg
90.06
5.81
w/ reg
90.94
12.28
Table 6: Purification performance (in percentage) of DUP with and without feature-level regularization ( reg ) adaptive attacks on BERT (SST-2).
Appendix figures & tables7 assets
Supplementary material from the paper’s appendix.
Appendix
Datasets
Task
Class
Split (Train/Dev/Test)
Avg. Len.
SST-2
Sentiment Analysis
Positive /Negative
6.9K:0.8K:1.8K
19.21
YELP
Sentiment Analysis
Positive /Negative
14K:3K:3K
29.71
AG’s News
News Topic Classification
World /Sports/Business/SciTech
108K:12K:7.6K
31.06
Appendix
Table 7: Statistics of the benchmark datasets used in our experiments. The target class is marked in bold .
Dataset
Attack
BERT-base
BART-base
LLaMA 3B
Qwen 3B
CACC
ASR
CACC
ASR
CACC
ASR
CACC
ASR
SST-2
BadNets
90.72%
100%
90.12%
100%
94.95%
99.89%
94.23%
100%
AddSent
90.28%
100%
93.08%
100%
94.12%
100%
95.66%
100%
Stylebkd
89.90%
81.69%
92.97%
99.78%
94.84%
99.89%
95.28%
99.56%
Synbkd
90.39%
89.69%
91.93%
96.71%
91.76%
99.34%
93.85%
96.49%
YELP
BadNets
95.54%
100%
96.04%
99.93%
97.10%
99.80%
96.63%
100%
Appendix
Table 8: The performances of different attacks in terms of ASR and CACC in percentage.
Attack
Defense
BERT
BART
LLaMA 3B
Qwen 3B
AUC
FAR
FRR
AUC
FAR
FRR
AUC
FAR
FRR
AUC
FAR
FRR
BadNets
STRIP
53.73
83.28
11.83
53.14
84.34
10.16
53.20
83.21
13.96
54.70
82.95
13.36
DAN
93.51
37.64
7.03
77.29
61.89
7.40
66.69
85.08
7.20
75.40
79.08
6.96
NAS
98.49
0.00
5.23
96.07
30.58
4.73
88.21
83.34
5.93
97.43
2.27
6.10
MS
98.10
0.00
6.30
97.54
9.06
5.03
95.62
18.12
6.23
99.62
0.07
6.53
AddSent
STRIP
52.41
85.54
10.83
53.58
84.81
11.00
51.42
94.54
5.26
49.36
93.14
5.43
Appendix
Table 9: Backdoor detection performance (in percentage) of MS and baselines on YELP. Best results are bolded .
Attack
Defense
BERT
BART
LLaMA 3B
Qwen 3B
AUC
FAR
FRR
AUC
FAR
FRR
AUC
FAR
FRR
AUC
FAR
FRR
BadNets
STRIP
53.14
82.42
14.12
52.44
82.89
14.05
52.21
85.35
12.07
53.81
78.49
18.07
DAN
86.86
70.93
4.87
99.76
0.00
5.33
87.46
32.90
4.75
86.37
36.98
5.33
NAS
95.19
29.65
4.91
80.08
83.25
4.75
92.12
77.14
4.82
95.85
32.90
4.62
MS
93.74
39.54
4.25
99.97
0.00
5.01
99.90
0.00
5.00
98.91
0.26
4.46
AddSent
STRIP
50.78
88.09
10.00
53.11
80.19
15.41
51.75
88.25
10.12
52.73
84.68
13.11
Appendix
Table 10: Backdoor detection performance (in percentage) of MS and baselines on AG’s News. Best results are bolded .
Figure 5: Impact of varying k on the detection performance of PLMs ( left ) and LLMs ( right ) on the SST-2 dataset.
Figure 6: Impact of varying α on the detection performance of PLMs ( left ) and LLMs ( right ) on the SST-2 dataset.
Figure 7: Impact of clean samples on the detection performance of PLMs ( left ) and LLMs ( right ) on the SST-2 dataset.
Multimodal Diffusion Language Models (MDLMs) have recently emerged as a competitive alternative to their autoregressive counterparts. Yet their vulnerability to backdoor attacks remains largely unexplored. In this work, we show that well-established data-poisoning pipelines can successfully implant backdoors into MDLMs, enabling attackers to manipulate model behavior via specific triggers while maintaining normal performance on clean inputs. However, defense strategies effective to these models are yet to emerge. To bridge this gap, we introduce a backdoor defense framework for MDLMs named DiSP (Diffusion Self-Purification). DiSP is driven by a key observation: selectively masking certain vision tokens at inference time can neutralize a backdoored model's trigger-induced behaviors and restore normal functionality. Building on this, we purify the poisoned dataset using the compromised model itself, then fine-tune the model on the purified data to recover it to a clean one. Given such a specific design, DiSP can remove backdoors without requiring any auxiliary models or clean reference data. Extensive experiments demonstrate that our approach effectively mitigates backdoor effects, reducing the attack success rate (ASR) from over 90% to typically under 5%, while maintaining model performance on benign tasks.
Large language models remain vulnerable to jailbreak backdoor attacks, where adversaries poison safety alignment data to embed hidden triggers that bypass safety mechanisms. Existing defenses often require comprehensive attack information or multiple triggered examples, making them impractical when defenders only observe a single reported failure case without knowing whether it stems from a backdoor attack or a natural alignment bug. This paper presents Patcher, a post-hoc defense framework that repairs backdoored language models using only a single reported failure case and the model parameters. Patcher operates in two stages. First, it localizes backdoor triggers by computing response-conditioned gradient-based saliency scores and applying adaptive clustering to separate triggers from benign context. Second, it patches the model through a constrained fine-tuning objective that breaks the trigger-response association while preserving benign-task utility and robustness to non-triggered jailbreak attacks through KL-divergence constraints. We conduct extensive evaluations across multiple backdoor attack strategies and demonstrate that Patcher successfully localizes triggers and neutralizes backdoors while maintaining model utility. We further show robustness against adaptive attacks designed to evade our defense. This work represents a significant step toward practical defenses against training-time attacks in deployed language models.
Anjun Gao, Yueyang Quan, Yufei Xia +2
University of Louisville · University of North Texas
Despite the strong multimodal performance, large vision-language models (LVLMs) are vulnerable during fine-tuning to backdoor attacks, where adversaries insert trigger-embedded samples into the training data to implant behaviors that can be maliciously activated at test time. Existing defenses typically rely on retraining backdoored parameters (e.g., adapters or LoRA modules) with clean data, which is computationally expensive and often degrades model performance. In this work, we provide a new mechanistic understanding of backdoor behaviors in LVLMs: the trigger does not influence prediction through low-level visual patterns, but through abnormal cross-modal attention redistribution, where trigger-bearing visual tokens steal attention away from the textual context - a phenomenon we term attention stealing. Motivated by this, we propose CleanSight, a training-free, plug-and-play defense that operates purely at test time. CleanSight (i) detects poisoned inputs based on the relative visual-text attention ratio in selected cross-modal fusion layers, and (ii) purifies the input by selectively pruning the suspicious high-attention visual tokens to neutralize the backdoor activation. Extensive experiments show that CleanSight significantly outperforms existing pixel-based purification defenses across diverse datasets and backdoor attack types, while preserving the model's utility on both clean and poisoned samples.
Zhifang Zhang, Bojun Yang, Shuo He +5
University of Queensland · Southeast University · Nanyang Technological University +1