arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.00382cs.CL
收藏

需要时回答,不需要时遗忘:语言模型通过上下文知识遗忘实现“假装遗忘”

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

The University of Tokyo(东京大学)

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

AI总结:

本文提出“上下文知识遗忘”方法,通过微调使 LLMs 在测试时根据查询上下文选择性遗忘目标知识,在多个数据集上实现高达 95% 的遗忘准确率并保留 80% 不相关知识,同时揭示模型仅在最后一层做出遗忘决策的“假装遗忘”现象。

摘要:

随着大语言模型(LLMs)被应用于各种领域,选择性遗忘特定信息的能力变得越来越重要。例如,LLMs 需要向授权内部用户(如员工或可信合作伙伴)选择性提供机密信息,同时对外部用户(包括公众和未授权实体)予以保留。因此,我们提出了一种名为“上下文知识遗忘”(in-context knowledge unlearning)的新方法,使模型能够在测试时根据查询上下文选择性地遗忘信息。我们的方法对预训练 LLMs 进行微调,使其能够在上下文中对目标知识进行提示式遗忘,同时保留不相关的信息。在 TOFU、AGE 和 RWKU 数据集上使用 Llama2-7B/13B 和 Mistral-7B 模型进行的实验表明,我们的方法实现了高达 95% 的遗忘准确率,同时保留了 80% 的不相关知识,在域内和域外场景下均显著优于基线方法。对模型内部行为的进一步研究发现,微调后的 LLMs 在中间层生成正确的预测,并一直保持到最后一层。然而,遗忘的决定仅在最后一层做出,即“LLMs 假装遗忘”。我们的发现为改进 LLMs 中遗忘机制的鲁棒性提供了有价值的见解,并为该领域未来的研究奠定了基础。

英文摘要:

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 in-domain 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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑