Defending Pre-trained Language Models as Few-shot Learners against Backdoor Attacks
Zhaohan Xi, Tianyu Du, Changjiang Li, Ren Pang, Shouling Ji, Jinghui Chen, Fenglong Ma, Ting Wang
Abstract
Pre-trained language models (PLMs) have demonstrated remarkable performance as few-shot learners. However, their security risks under such settings are largely unexplored. In this work, we conduct a pilot study showing that PLMs as fewshot learners are highly vulnerable to backdoor attacks while existing defenses are inadequate due to the unique challenges of few-shot scenarios. To address such challenges, we advocate MDP, a novel lightweight, pluggable, and effective defense for PLMs as few-shot learners. Specifically, MDP leverages the gap between the masking-sensitivity of poisoned and clean samples: with reference to the limited few-shot data as distributional anchors, it compares the representations of given samples under varying masking and identifies poisoned samples as ones with significant variations. We show analytically that MDP creates an interesting dilemma for the attacker to choose between attack effectiveness and detection evasiveness. The empirical evaluation using benchmark datasets and representative attacks validates the efficacy of MDP. Code available at https://github.com/z haohan-xi/PLM-prompt-defense .
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
9 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Differentiable Prompt Makes Pre-trained Language Models Better Few-shot Learners cites Unsupervised Data Augmentation for Consistency Training
- Differentiable Prompt Makes Pre-trained Language Models Better Few-shot Learners cites Language Models are Few-Shot Learners
- BadPrompt: Backdoor Attacks on Continuous Prompts cites Differentiable Prompt Makes Pre-trained Language Models Better Few-shot Learners
- BadPrompt: Backdoor Attacks on Continuous Prompts cites Language Models are Few-Shot Learners
- BadPrompt: Backdoor Attacks on Continuous Prompts cites Weight Poisoning Attacks on Pretrained Models
- Language Models are Few-Shot Learners cites Unsupervised Data Augmentation for Consistency Training
- PR-Attack: Coordinated Prompt-RAG Attacks on Retrieval-Augmented Generation in Large Language Models via Bilevel Optimization cites BadPrompt: Backdoor Attacks on Continuous Prompts
- PR-Attack: Coordinated Prompt-RAG Attacks on Retrieval-Augmented Generation in Large Language Models via Bilevel Optimization cites Weight Poisoning Attacks on Pretrained Models
Cited by top-tier papers9
- CleanGen: Mitigating Backdoor Attacks for Generation Tasks in Large Language ModelsYuetai Li, Zhangchen Xu, Fengqing Jiang, Luyao Niu et al.EMNLP 2024 · 7 citations
- PR-Attack: Coordinated Prompt-RAG Attacks on Retrieval-Augmented Generation in Large Language Models via Bilevel OptimizationYang Jiao, Xiaodong Wang, Kai YangSIGIR 2025 · 6 citations
- BeDKD: Backdoor Defense Based on Directional Mapping Module and Adversarial Knowledge DistillationZhengxian Wu, Juan Wen, Wanli Peng, Yinghan Zhou et al.AAAI 2026 · 2 citations
- Watch the Watchers! On the Security Risks of Robustness-Enhancing Diffusion ModelsChangjiang Li, Ren Pang, Bochuan Cao, Jinghui Chen et al.USENIX Security 2025
- TrojanDec: Data-free Detection of Trojan Inputs in Self-supervised LearningYupei Liu, Yanting Wang, Jinyuan JiaAAAI 2025
Builds on15
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Unsupervised Data Augmentation for Consistency TrainingQizhe Xie, Zihang Dai, Eduard H. Hovy, Thang Luong et al.NeurIPS 2020 · 2,774 citations
- Weight Poisoning Attacks on Pretrained ModelsKeita Kurita, Paul Michel, Graham NeubigACL 2020 · 312 citations
- Differentiable Prompt Makes Pre-trained Language Models Better Few-shot LearnersNingyu Zhang, Luoqiu Li, Xiang Chen, Shumin Deng et al.ICLR 2022 · 205 citations
- BadPrompt: Backdoor Attacks on Continuous PromptsXiangrui Cai, Haidong Xu, Sihan Xu, Ying Zhang et al.NeurIPS 2022 · 103 citations
Related papers
- PKAD: Pretrained Knowledge is All You Need to Detect and Mitigate Textual Backdoor AttacksYu Chen, Qi Cao, Kaike Zhang, Xuchao Liu et al.EMNLP Findings 2024
- Moderate-fitting as a Natural Backdoor Defender for Pre-trained Language ModelsBiru Zhu, Yujia Qin, Ganqu Cui, Yangyi Chen et al.NeurIPS 2022 · 29 citations
- LT-Defense: Searching-free Backdoor Defense via Exploiting the Long-tailed EffectYixiao Xu, Binxing Fang, Mohan Li, Keke Tang et al.NeurIPS 2024 · 7 citations
- Maximum Entropy Loss, the Silver Bullet Targeting Backdoor Attacks in Pre-trained Language ModelsZhengxiao Liu, Bowen Shen, Zheng Lin, Fali Wang et al.ACL Findings 2023 · 8 citations
- Merging Triggers, Breaking Backdoors: Defensive Poisoning for Instruction-Tuned Language ModelsSan Kim, Gary LeeACL 2026
