In-Context Learning Can Re-learn Forbidden Tasks
On the map: LLM safety and security → Safety alignment, refusal and guardrails
Abstract (arXiv)
Despite significant investment into safety training, large language models (LLMs) deployed in the real world still suffer from numerous vulnerabilities. One perspective on LLM safety training is that it algorithmically forbids the model from answering toxic or harmful queries. To assess the effectiveness of safety training, in this work, we study forbidden tasks, i.e., tasks the model is designed to refuse to answer. Specifically, we investigate whether in-context learning (ICL) can be used to re-learn forbidden tasks despite the explicit fine-tuning of the model to refuse them. We first examine a toy example of refusing sentiment classification to demonstrate the problem. Then, we use ICL on a model fine-tuned to refuse to summarise made-up news articles. Finally, we investigate whether ICL can undo safety training, which could represent a major security risk. For the safety task, we look at Vicuna-7B, Starling-7B, and Llama2-7B. We show that the attack works out-of-the-box on Starling-7B and Vicuna-7B but fails on Llama2-7B. Finally, we propose an ICL attack that uses the chat template tokens like a prompt injection attack to achieve a better attack success rate on Vicuna-7B and Starling-7B. Trigger Warning: the appendix contains LLM-generated text with violence, suicide, and misinformation.
Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Placed in Safety alignment, refusal and guardrails, one of 12 directions in LLM safety and security. Builds on 20 of its 31 references that are in the map. First posted on arXiv 8 Feb 2024.
Builds on
20 of 31 references.
Closest ancestors · 1
Same direction, newest first
Other references · 19
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2017Proximal Policy Optimization Algorithmscited by 15,215
- 2021Training Verifiers to Solve Math Word Problemscited by 10,109
- 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,170
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
- 2013Intriguing properties of neural networkscited by 5,155
- 2022Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedbackcited by 3,720
- 2023QLoRA: Efficient Finetuning of Quantized LLMscited by 3,418
- 2023Tree of Thoughts: Deliberate Problem Solving with Large Language Modelscited by 3,211
- 2016Towards Evaluating the Robustness of Neural Networkscited by 2,998
- 2016Concrete Problems in AI Safetycited by 1,642
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
7 more
- 2021A General Language Assistant as a Laboratory for Alignmentcited by 1,055
- 2021Show Your Work: Scratchpads for Intermediate Computation with Language Modelscited by 886
- 2018Threat of Adversarial Attacks on Deep Learning in Computer Vision: A Surveycited by 460
- 2023Jailbreak and Guard Aligned Language Models with Only Few In-Context Demonstrationscited by 431
- 2023Shadow Alignment: The Ease of Subverting Safely-Aligned Language Modelscited by 297
- 2022Predictability and Surprise in Large Generative Modelscited by 210
- 2022Why Should Adversarial Perturbations be Imperceptible? Rethink the Research Paradigm in Adversarial NLPcited by 102
Built on by
Citing papers per year: 2024: 4; 2025: 1.
5 papers.
- 2024Efficient Adversarial Training in LLMs with Continuous Attackscited by 113
- 2024Mechanistic Unlearning: Robust Knowledge Unlearning and Editing via Mechanistic Localizationcited by 35
- 2024XC-Cache: Cross-Attending to Cached Context for Efficient LLM Inferencecited by 12
- 2025Prompt Attacks Reveal Superficial Knowledge Removal in Unlearning Methodscited by 5
- 2024Risk Sources and Risk Management Measures in Support of Standards for General-Purpose AI Systemscited by 2
- 2025Prompt Attacks Reveal Superficial Knowledge Removal in Unlearning Methods11 Jun 2025
- 2024Risk Sources and Risk Management Measures in Support of Standards for General-Purpose AI Systems30 Oct 2024
- 2024Mechanistic Unlearning: Robust Knowledge Unlearning and Editing via Mechanistic Localization16 Oct 2024
- 2024Efficient Adversarial Training in LLMs with Continuous Attacks24 May 2024
- 2024XC-Cache: Cross-Attending to Cached Context for Efficient LLM Inference23 Apr 2024
Similar, not cited
Close in wording, no citation either way
- 2024Data Poisoning for In-context Learning
- 2026Safety Paradox: How Enhanced Safety Awareness Leaves LLMs Vulnerable to Posterior Attack
- 2024Refuse Whenever You Feel Unsafe: Improving Safety in LLMs via Decoupled Refusal Training
- 2025Safety Pretraining: Toward the Next Generation of Safe AI
- 2024LLMs know their vulnerabilities: Uncover Safety Gaps through Natural Distribution Shifts
- 2024ToolSword: Unveiling Safety Issues of Large Language Models in Tool Learning Across Three Stages
- 2025ICLShield: Exploring and Mitigating In-Context Learning Backdoor Attacks
- 2024Universal Vulnerabilities in Large Language Models: Backdoor Attacks for In-context Learning