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 will be released at https://github.com/zjunlp/EasyEdit.
翻译:大语言模型(LLMs)需要知识更新以适应不断增长的世界事实并修正幻觉响应,这推动了终身模型编辑方法的发展。更新后的知识存储于何处是模型编辑的一个基本问题。本文发现,无论是编辑长期记忆(直接修改模型参数)还是工作记忆(通过检索获取神经网络激活/表示的非参数知识),都会导致一个“不可能三角”——在终身编辑设置中,可靠性、泛化性和局部性无法同时实现。对于长期记忆,直接编辑参数会与无关的预训练知识或先前编辑产生冲突(导致可靠性差和局部性差);对于工作记忆,基于检索的激活机制难以使模型理解编辑内容并实现泛化(导致泛化性差)。为此,我们提出WISE以弥合记忆间的鸿沟。在WISE中,我们设计了一种双参数记忆方案,包含存储预训练知识的主记忆和存储编辑知识的侧记忆。我们仅编辑侧记忆中的知识,并训练一个路由器来决定给定查询时应当访问哪个记忆。对于持续编辑,我们设计了一种知识分片机制:不同的编辑集合存储于参数的不同子空间中,随后被合并至共享记忆且互不冲突。大量实验表明,在问答、幻觉和分布外场景的终身模型编辑任务中,WISE能够超越先前的模型编辑方法,并在GPT、LLaMA、Mistral等主流LLM架构上克服“不可能三角”问题。代码将在https://github.com/zjunlp/EasyEdit 发布。