[论文解读] WISE: Rethinking the Knowledge Memory for Lifelong Model Editing of Large Language Models
WISE 提出了一种双参数记忆机制,将预训练知识(主内存)与编辑知识(侧内存)分离,通过路由器将查询路由至合适的内存。该方法通过知识切分与跨编辑的参数合并,在 LLaMA、GPT 和 Mistral 模型上实现了更优的可靠性、局部性和泛化能力,从而克服了‘不可能三角’问题,实现了持续模型编辑的突破。
Large language models (LLMs) need knowledge updates to meet the ever-growing world facts and correct the hallucinated responses, facilitating the methods of lifelong model editing. Where the updated knowledge resides in memories is a fundamental question for model editing. In this paper, we find that editing either long-term memory (direct model parameters) or working memory (non-parametric knowledge of neural network activations/representations by retrieval) will result in an impossible triangle -- reliability, generalization, and locality can not be realized together in the lifelong editing settings. For long-term memory, directly editing the parameters will cause conflicts with irrelevant pretrained knowledge or previous edits (poor reliability and locality). For working memory, retrieval-based activations can hardly make the model understand the edits and generalize (poor generalization). Therefore, we propose WISE to bridge the gap between memories. In WISE, we design a dual parametric memory scheme, which consists of the main memory for the pretrained knowledge and a side memory for the edited knowledge. We only edit the knowledge in the side memory and train a router to decide which memory to go through when given a query. For continual editing, we devise a knowledge-sharding mechanism where different sets of edits reside in distinct subspaces of parameters, and are subsequently merged into a shared memory without conflicts. Extensive experiments show that WISE can outperform previous model editing methods and overcome the impossible triangle under lifelong model editing of question answering, hallucination, and out-of-distribution settings across trending LLM architectures, e.g., GPT, LLaMA, and Mistral. Code is available at https://github.com/zjunlp/EasyEdit.
研究动机与目标
- 为解决在有效持续模型编辑中,更新知识应存储于何处这一根本性挑战。
- 克服大语言模型持续编辑中的‘不可能三角’问题——即可靠性、局部性和泛化能力之间的权衡。
- 设计一种记忆机制,在保留预训练知识的同时,实现高效且无冲突的多轮更新。
- 通过结构化记忆层级中的参数化知识,实现对记忆查询-目标对之外的泛化能力。
- 在无需修改模型架构的前提下,支持多种大语言模型架构的持续编辑。
提出的方法
- WISE 引入双参数记忆机制:主内存用于存储预训练知识,侧内存用于存储编辑知识,且仅更新侧内存。
- 训练一个路由器网络,根据语义相似性和编辑相关性,动态将输入查询路由至合适的内存。
- 在持续编辑中,WISE 采用知识切分机制,将每次编辑隔离在参数空间的独立子空间中,以防止干扰。
- 编辑完成后,通过受 TIES-Merging 启发的方法将子空间合并至共享内存,以保持模型一致性和性能。
- 侧内存通过编辑特定数据进行微调训练,而路由器与主模型联合优化,以确保路由准确性。
- 该方法避免直接修改主模型的参数,从而保留预训练知识,并实现高局部性。
实验结果
研究问题
- RQ1是否双记忆架构通过分离预训练知识与编辑知识,能够克服仅修改长期记忆或工作记忆所带来的局限性?
- RQ2如何在持续编辑中同时实现可靠性、局部性和泛化能力?
- RQ3知识切分与参数合并能否实现无冲突的多轮持续编辑?
- RQ4基于路由器的记忆路由机制是否能提升对记忆查询-目标对之外的泛化能力?
- RQ5该方法是否可在无需架构修改的前提下,适用于 GPT、LLaMA 和 Mistral 等多种大语言模型架构?
主要发现
- 在 ZsRE 基准上进行 100 次连续编辑时,WISE 在可靠性、局部性和泛化能力三项指标上均优于现有方法(包括 ROME、FT-EWC、GRACE 和 DEFER)。
- 在 LLaMA-2-7B 上,WISE 在三项指标上均达到最高性能,证明其成功解决了持续编辑中的‘不可能三角’问题。
- 基于路由器的路由机制实现了主内存与侧内存之间的准确且动态的选择,提升了编辑局部性并减少了干扰。
- 知识切分有效防止了不同编辑之间的冲突,使多个编辑可被存储并合并,且性能无下降。
- 该方法能泛化至记忆查询-目标对之外的样本,在分布外和改写查询上均表现出色。
- 大量实验证实,WISE 在多种大语言模型架构(包括 GPT、LLaMA 和 Mistral)上均表现优异,且仅需极少的架构修改。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。