Lune

ICML2024Top-tier venue

In-Context Unlearning: Language Models as Few-Shot Unlearners

Martin Pawelczyk, Seth Neel, Himabindu Lakkaraju

Abstract

Machine unlearning, the study of efficiently removing the impact of specific training instances on a model, has garnered increased attention in recent years due to regulatory guidelines such as the Right to be Forgotten. Achieving precise unlearning typically involves fully retraining the model and is computationally infeasible in case of very large models such as Large Language Models (LLMs). To this end, recent work has proposed several algorithms which approximate the removal of training data without retraining the model. These algorithms crucially rely on access to the model parameters in order to update them, an assumption that may not hold in practice due to computational constraints or having only query access to the LLMs. In this work, we propose a new class of unlearning methods for LLMs called ``In-Context Unlearning.'' This method unlearns instances from the model by simply providing specific kinds of inputs in context, without the need to update model parameters. To unlearn specific training instances, we present these instances to the LLMs at inference time along with labels that differ from their ground truth. Our experimental results demonstrate that in-context unlearning performs on par with, or in some cases outperforms other state-of-the-art methods that require access to model parameters, effectively removing the influence of specific instances on the model while preserving test accuracy.

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.

75 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Large Language Model Unlearning via Embedding-Corrupted Prompts cites Large Language Model Unlearning
  • Large Language Model Unlearning via Embedding-Corrupted Prompts cites The WMDP Benchmark: Measuring and Reducing Malicious Use with Unlearning
  • Large Language Model Unlearning via Embedding-Corrupted Prompts cites Membership Inference Attacks From First Principles
  • Large Language Model Unlearning via Embedding-Corrupted Prompts cites Language Models are Few-Shot Learners
  • Large Language Model Unlearning cites Membership Inference Attacks Against Machine Learning Models
  • Rethinking LLM Memorization through the Lens of Adversarial Compression cites Membership Inference Attacks Against Machine Learning Models
  • Rethinking LLM Memorization through the Lens of Adversarial Compression cites Membership Inference Attacks From First Principles
  • Simplicity Prevails: Rethinking Negative Preference Optimization for LLM Unlearning cites Large Language Model Unlearning via Embedding-Corrupted Prompts
  • Simplicity Prevails: Rethinking Negative Preference Optimization for LLM Unlearning cites Large Language Model Unlearning
  • Simplicity Prevails: Rethinking Negative Preference Optimization for LLM Unlearning cites Rethinking LLM Memorization through the Lens of Adversarial Compression
  • Simplicity Prevails: Rethinking Negative Preference Optimization for LLM Unlearning cites The WMDP Benchmark: Measuring and Reducing Malicious Use with Unlearning
  • The WMDP Benchmark: Measuring and Reducing Malicious Use with Unlearning cites Large Language Model Unlearning
  • Membership Inference Attacks From First Principles cites Membership Inference Attacks Against Machine Learning Models
  • Rethinking the Role of Demonstrations: What Makes In-Context Learning Work? cites Language Models are Few-Shot Learners
  • What Can Transformers Learn In-Context? A Case Study of Simple Function Classes cites Language Models are Few-Shot Learners
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers75

  1. The WMDP Benchmark: Measuring and Reducing Malicious Use with UnlearningNathaniel Li, Alexander Pan, Anjali Gopal, Summer Yue et al.ICML 2024 · 390 citations
  2. Large Language Model UnlearningYuanshun Yao, Xiaojun Xu, Yang LiuNeurIPS 2024 · 365 citations
  3. Simplicity Prevails: Rethinking Negative Preference Optimization for LLM UnlearningChongyu Fan, Jiancheng Liu, Licong Lin, Jinghan Jia et al.NeurIPS 2025 · 182 citations
  4. Large Language Model Unlearning via Embedding-Corrupted PromptsChris Yuhao Liu, Yaxuan Wang, Jeffrey Flanigan, Yang LiuNeurIPS 2024 · 138 citations
  5. Rethinking LLM Memorization through the Lens of Adversarial CompressionAvi Schwarzschild, Zhili Feng, Pratyush Maini, Zachary C. Lipton et al.NeurIPS 2024 · 120 citations

Builds on24

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Membership Inference Attacks Against Machine Learning ModelsReza Shokri, Marco Stronati, Congzheng Song, Vitaly ShmatikovS&P 2017 · 5,137 citations
  3. Membership Inference Attacks From First PrinciplesNicholas Carlini, Steve Chien, Milad Nasr, Shuang Song et al.S&P 2022 · 1,049 citations
  4. What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 citations
  5. Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe et al.EMNLP 2022 · 634 citations

Related papers

  1. Fast Exact Unlearning for In-Context Learning Data for LLMsAndrei Ioan Muresanu, Anvith Thudi, Michael R. Zhang, Nicolas PapernotICML 2025
  2. Towards Safe Machine Unlearning: A Paradigm that Mitigates Performance DegradationShanshan Ye, Jie Lu, Guangquan ZhangWWW 2025 · 13 citations
  3. Answer When Needed, Forget When Not: Language Models Pretend to Forget via In-Context Knowledge UnlearningShota Takashiro, Takeshi Kojima, Andrew Gambardella, Qi Cao et al.ACL Findings 2025 · 2 citations
  4. On the Necessity of Auditable Algorithmic Definitions for Machine UnlearningAnvith Thudi, Hengrui Jia, Ilia Shumailov, Nicolas PapernotUSENIX Security 2022
  5. Machine Unlearning of Pre-trained Large Language ModelsJin Yao, Eli Chien, Minxin Du, Xinyao Niu et al.ACL 2024
Dusk over the sea between two cliffs drawn in fine vertical lines