Lune

ACL Findings2025

Answer When Needed, Forget When Not: Language Models Pretend to Forget via In-Context Knowledge Unlearning

Shota Takashiro, Takeshi Kojima, Andrew Gambardella, Qi Cao, Yusuke Iwasawa, Yutaka Matsuo

Abstract

As large language models (LLMs) are applied across diverse domains, the ability to selectively unlearn specific information is becoming increasingly essential. For instance, LLMs are expected to selectively provide confidential information to authorized internal users, such as employees or trusted partners, while withholding it from external users, including the general public and unauthorized entities. Therefore, we propose a novel method termed "in-context knowledge unlearning", which enables the model to selectively forget information in test-time based on the query context.

Our method fine-tunes pre-trained LLMs to enable prompt unlearning of target knowledge within the context, while preserving unrelated information. Experiments on TOFU, AGE and RWKU datasets using Llama2-7B/13B and Mistral-7B models demonstrate that our method achieves up to 95% forget accuracy while retaining 80% of unrelated knowledge, significantly outperforming baselines in both indomain and out-of-domain scenarios. Further investigation of the model's internal behavior revealed that while fine-tuned LLMs generate correct predictions in the middle layers and preserve them up to the final layer. However, the decision to forget is made only at the last layer, i.e. "LLMs pretend to forget". Our findings offer valuable insight into the improvement of the robustness of the unlearning mechanisms in LLMs, laying a foundation for future research in the field. 1

Ask Lune

Ask anything. The answer quotes the paper.

Lune reads all of it and the papers around it, then shows you the passages behind every answer.

Questions to start from

Lune answers from

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

Get the answer

Free to start. No credit card required.

Cited by top-tier papers3

  1. Generating Project-Specific Test Cases with Requirement Validation IntentionBinhang Qi, Yun Lin, Xinyi Weng, Yuhuan Huang et al.ISSTA 2026 · 3 citations
  2. Code2Video: A Code-centric Paradigm for Educational Video CreationYanzhe Chen, Kevin Qinghong Lin, Mike Zheng ShouICML 2026
  3. Decoding-Unlearning: Fact Forgetting via Entropy-Guided InferenceJingwen Pu, Mingjun Shi, Xinrui Ren, Yizhe Wang et al.ACL 2026

Builds on8

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Deep Learning with Differential PrivacyMartín Abadi, Andy Chu, Ian J. Goodfellow, H. Brendan McMahan et al.CCS 2016 · 7,620 citations
  3. Locating and Editing Factual Associations in GPTKevin Meng, David Bau, Alex Andonian, Yonatan BelinkovNeurIPS 2022 · 3,415 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. In-Context Unlearning: Language Models as Few-Shot UnlearnersMartin Pawelczyk, Seth Neel, Himabindu LakkarajuICML 2024 · 217 citations
  2. Not Every Token Needs Forgetting: Selective Unlearning Balancing Forgetting and Utility in Large Language ModelsYixin Wan, Anil Ramakrishna, Kai-Wei Chang, Volkan Cevher et al.EMNLP Findings 2025
  3. Reveal and Release: Iterative LLM Unlearning with Self-generated DataLinxi Xie, Xin Teng, Shichang Ke, Hongyi Wen et al.EMNLP Findings 2025
  4. From Evasion to Concealment: Stealthy Knowledge Unlearning for LLMsTianle Gu, Kexin Huang, Ruilin Luo, Yuanqi Yao et al.ACL Findings 2025
  5. To Forget or Not? Towards Practical Knowledge Unlearning for Large Language ModelsBozhong Tian, Xiaozhuan Liang, Siyuan Cheng, Qingbin Liu et al.EMNLP Findings 2024 · 13 citations
Dusk over the sea between two cliffs drawn in fine vertical lines