arXiv:2505.13312cs.CL2025-05被引 16

让大模型生成时自动屏蔽敏感内容,不损失原有能力。

GUARD: Generation-time LLM Unlearning via Adaptive Restriction and Detection

  • 生成阶段动态检测并过滤敏感词,不依赖微调。
  • 在哈利·波特版权数据集上遗忘效果达98.7%,通用能力下降不足1%。
  • 适合需要安全可控的AI应用,如客服、内容审核场景。

大型语言模型虽能记忆海量知识,但选择性遗忘对确保部署安全至关重要。现有方法需通过微调实现遗忘,易损害模型整体性能。本文提出生成时遗忘框架GUARD,通过提示分类器识别遗忘目标并提取禁用词,在生成过程中结合词面与语义匹配动态惩罚和过滤候选词,防止泄露遗忘内容。在哈利·波特版权数据集、MUSE基准及TOFU实体遗忘任务上的实验表明,GUARD在多种任务中均实现强遗忘效果(最高达98.7%),同时通用能力下降不足1%,实现了遗忘与实用性的良好平衡。

原文摘要 · Abstract (English)

Large Language Models (LLMs) have demonstrated strong capabilities in memorizing vast amounts of knowledge across diverse domains. However, the ability to selectively forget specific knowledge is critical for ensuring the safety and compliance of deployed models. Existing unlearning efforts typically fine-tune the model with resources such as forget data, retain data, and a calibration model. These additional gradient steps blur the decision boundary between forget and retain knowledge, making unlearning often at the expense of overall performance. To avoid the negative impact of fine-tuning, it would be better to unlearn solely at inference time by safely guarding the model against generating responses related to the forget target, without destroying the fluency of text generation. In this work, we propose Generation-time Unlearning via Adaptive Restriction and Detection (GUARD), a framework that enables dynamic unlearning during LLM generation. Specifically, we first employ a prompt classifier to detect unlearning targets and extract the corresponding forbidden token. We then dynamically penalize and filter candidate tokens during generation using a combination of token matching and semantic matching, effectively preventing the model from leaking the forgotten content. Experimental results on copyright content unlearning tasks over the Harry Potter dataset and the MUSE benchmark, as well as entity unlearning tasks on the TOFU dataset, demonstrate that GUARD achieves strong forget quality across various tasks while causing almost no degradation to the LLM's general capabilities, striking an excellent trade-off between forgetting and utility.

大模型遗忘机制生成控制安全合规

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。