ICLShield: Exploring and Mitigating In-Context Learning Backdoor Attacks
On the map: LLM safety and security → Backdoor and data poisoning attacks
Abstract (arXiv)
In-context learning (ICL) has demonstrated remarkable success in large language models (LLMs) due to its adaptability and parameter-free nature. However, it also introduces a critical vulnerability to backdoor attacks, where adversaries can manipulate LLM behaviors by simply poisoning a few ICL demonstrations. In this paper, we propose, for the first time, the dual-learning hypothesis, which posits that LLMs simultaneously learn both the task-relevant latent concepts and backdoor latent concepts within poisoned demonstrations, jointly influencing the probability of model outputs. Through theoretical analysis, we derive an upper bound for ICL backdoor effects, revealing that the vulnerability is dominated by the concept preference ratio between the task and the backdoor. Motivated by these findings, we propose ICLShield, a defense mechanism that dynamically adjusts the concept preference ratio. Our method encourages LLMs to select clean demonstrations during the ICL phase by leveraging confidence and similarity scores, effectively mitigating susceptibility to backdoor attacks. Extensive experiments across multiple LLMs and tasks demonstrate that our method achieves state-of-the-art defense effectiveness, significantly outperforming existing approaches (+26.02% on average). Furthermore, our method exhibits exceptional adaptability and defensive performance even for closed-source models (e.g., GPT-4).
Key facts. Cited by 9 papers in the map (data through 7 Oct 2026). Placed in Backdoor and data poisoning attacks, one of 12 directions in LLM safety and security. Builds on 54 of its 66 references that are in the map. First posted on arXiv 2 Jul 2025.
Builds on
54 of 66 references.
Closest ancestors · 13
Same direction, newest first
- 2024Adversarial Backdoor Defense in CLIP24 Sep
- 2024Revisiting Backdoor Attacks against Large Vision-Language Models from Domain Shift27 Jun
- 2024BEEAR: Embedding-based Adversarial Removal of Safety Backdoors in Instruction-tuned Language Models24 Jun
- 2024Unlearning Backdoor Threats: Enhancing Backdoor Defense in Multimodal Contrastive Learning via Local Token Unlearning24 Mar
- 2024BadEdit: Backdooring large language models by model editing20 Mar
- 2024Universal Vulnerabilities in Large Language Models: Backdoor Attacks for In-context Learning11 Jan
- 2023Pre-trained Trojan Attacks for Visual Recognition23 Dec
- 2023BadCLIP: Dual-Embedding Guided Backdoor Attack on Multimodal Contrastive Learning20 Nov
- 2023Test-time Backdoor Mitigation for Black-Box Large Language Models with Defensive Demonstrations16 Nov
- 2023Backdooring Instruction-Tuned Large Language Models with Virtual Prompt Injection31 Jul
- 2023Backdoor Attacks for In-Context Learning with Language Models27 Jul
- 2023Instructions as Backdoors: Backdoor Vulnerabilities of Instruction Tuning for Large Language Models24 May
Other references · 41
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023GPT-4 Technical Reportcited by 18,132
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2024The Llama 3 Herd of Modelscited by 14,192
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2021Training Verifiers to Solve Math Word Problemscited by 9,743
- 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,464
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 2,914
- 2015Character-level Convolutional Networks for Text Classificationcited by 2,293
- 2018CommonsenseQA: A Question Answering Challenge Targeting Commonsense Knowledgecited by 1,793
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,184
29 more
- 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,122
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
- 2022Transformers learn in-context by gradient descentcited by 714
- 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 711
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
- 2023Jailbreak and Guard Aligned Language Models with Only Few In-Context Demonstrationscited by 401
- 2021Neural Attention Distillation: Erasing Backdoor Triggers from Deep Neural Networkscited by 313
- 2021Anti-Backdoor Learning: Training Clean Models on Poisoned Datacited by 258
- 2023In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steeringcited by 240
- 2020ONION: A Simple and Effective Defense Against Textual Backdoor Attackscited by 231
- 2022Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-Optimizerscited by 204
- 2022Self-Adaptive In-Context Learning: An Information Compression Perspective for In-Context Example Selection and Orderingcited by 158
- 2023Large Language Models Are Latent Variable Models: Explaining and Finding Good Demonstrations for In-Context Learningcited by 149
- 2023Compositional Exemplars for In-context Learningcited by 143
- 2023Universal Jailbreak Backdoors from Poisoned Human Feedbackcited by 120
- 2022Structured Prompting: Scaling In-Context Learning to 1,000 Examplescited by 81
- 2024Let's Learn Step by Step: Enhancing In-Context Learning Ability with Curriculum Learningcited by 47
- 2023The Closeness of In-Context Learning and Weight Shifting for Softmax Regressioncited by 41
- 2024Language Models for Text Classification: Is In-Context Learning Enough?cited by 39
- 2023In-Context Learning for Text Classification with Many Labelscited by 35
- 2024Poisoned Forgery Face: Towards Backdoor Attacks on Face Forgery Detectioncited by 34
- 2024Compromising Embodied Agents with Contextual Backdoor Attackscited by 29
- 2024Towards Robust Physical-world Backdoor Attacks on Lane Detectioncited by 25
- 2023RobustMQ: Benchmarking Robustness of Quantized Modelscited by 19
- 2024Healthcare Copilot: Eliciting the Power of General LLMs for Medical Consultationcited by 17
- 2022Universal Backdoor Attacks Detection via Adaptive Adversarial Probecited by 16
- 2024Wordflow: Social Prompt Engineering for Large Language Modelscited by 9
- 2024What Makes In-context Learning Effective for Mathematical Reasoning: A Theoretical Analysiscited by 7
- 2024Fine-grained Controllable Text Generation through In-context Learning with Feedbackcited by 2
Built on by
Citing papers per year: 2025: 3; 2026: 6.
9 papers.
- 2025Rethinking Reasoning: A Survey on Reasoning-based Backdoors in LLMscited by 1
- 2026Distillation Traps and Guards: A Calibration Knob for LLM Distillabilitycited by 1
- 2025Towards Size-invariant Salient Object Detection: A Generic Evaluation and Optimization Approachcited by 0
- 2025SAID: Safety-Aware Intent Defense via Prefix Probing for Large Language Modelscited by 0
- 2026A Patch-based Cross-view Regularized Framework for Backdoor Defense in Multimodal Large Language Modelscited by 0
- 2026TimeGuard: Channel-wise Pool Training for Backdoor Defense in Time Series Forecastingcited by 0
- 2026Breadcrumbing Search Agentscited by 0
- 2026Support-Set Target Leakage in Relational Foundation Models during In-Context Learning: Impact, Detection, and Mitigationcited by 0
- 2026Support-Set Target Leakage in Relational Foundation Models during In-Context Learning: Model Dependence and Evaluation Reliabilitycited by 0
- 2026Support-Set Target Leakage in Relational Foundation Models during In-Context Learning: Model Dependence and Evaluation Reliability29 Sep 2026
- 2026Support-Set Target Leakage in Relational Foundation Models during In-Context Learning: Impact, Detection, and Mitigation28 Sep 2026
- 2026Breadcrumbing Search Agents5 Aug 2026
- 2026TimeGuard: Channel-wise Pool Training for Backdoor Defense in Time Series Forecasting21 May 2026
- 2026Distillation Traps and Guards: A Calibration Knob for LLM Distillability21 Apr 2026
- 2026A Patch-based Cross-view Regularized Framework for Backdoor Defense in Multimodal Large Language Models6 Apr 2026
- 2025SAID: Safety-Aware Intent Defense via Prefix Probing for Large Language Models23 Oct 2025
- 2025Rethinking Reasoning: A Survey on Reasoning-based Backdoors in LLMs9 Oct 2025
- 2025Towards Size-invariant Salient Object Detection: A Generic Evaluation and Optimization Approach19 Sep 2025