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

一种破坏 LLM 中记忆序列的轻量级方法

A Lightweight Method to Disrupt Memorized Sequences in LLM

UC San Diego(加州大学圣迭戈分校);MBZUAI(穆罕默德·本·扎耶德人工智能大学)

Parjanya Prajakta Prashant, Kaustubh Ponkshe, Babak Salimi

AI总结:

提出轻量级事后防御方法 TokenSwap,通过在大小模型间选择性交换 token 概率,有效降低 LLM 逐字记忆复现倾向且保持任务性能。

摘要:

随着语言模型规模扩大,它们在广泛任务上的性能显著提升,但逐字记忆并复述部分训练数据的倾向也随之增加。这种权衡带来了严重的法律、伦理和安全问题,尤其是在实际部署中。现有的缓解技术,如差分隐私或模型遗忘,通常需要重新训练或访问内部权重,这使得它们对大多数用户来说不切实际。在这项工作中,我们引入了 TokenSwap,这是一种轻量级的事后防御方法,专为用户只能访问 token 级别输出的现实场景而设计。我们的关键洞察是,虽然大型模型对于高任务性能是必要的,但小型模型(例如 DistilGPT-2)通常足以将流畅且符合语法的概率分配给常见的功能词——而且至关重要的是,它们的记忆要少得多。通过在模型之间选择性地交换 token 概率,TokenSwap 在保留大型模型能力的同时,降低了它们逐字复现的倾向。在 Pythia-6.9B 和 Llama-3-8B 上的评估显示,精确记忆率最高降低了 10 倍,且任务性能下降可忽略不计。我们的方法为缓解已部署 LLM 中的记忆生成提供了一种实用且易于访问的解决方案。

英文摘要:

As language models scale, their performance improves dramatically across a wide range of tasks, but so does their tendency to memorize and regurgitate parts of their training data verbatim. This tradeoff poses serious legal, ethical, and safety concerns, especially in real-world deployments. Existing mitigation techniques, such as differential privacy or model unlearning, often require retraining or access to internal weights making them impractical for most users. In this work, we introduce TokenSwap, a lightweight, post-hoc defense designed for realistic settings where the user can only access token-level outputs. Our key insight is that while large models are necessary for high task performance, small models (e.g., DistilGPT-2) are often sufficient to assign fluent, grammatically plausible probabilities to common function words - and crucially, they memorize far less. By selectively swapping token probabilities between models, TokenSwap preserves the capabilities of large models while reducing their propensity for verbatim reproduction. Evaluations on Pythia-6.9B and Llama-3-8B show up to a 10$\times$ drop in exact memorization with negligible task degradation. Our method offers a practical, accessible solution for mitigating memorized generation in deployed LLMs.

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

↑