Doc2X | 轻松转换多栏 PDF
支持多栏 PDF 转换为 Word、Markdown、HTML,并整合沉浸式翻译功能,为文档处理增效。
Doc2X | Effortless Multi-Column PDF Conversion
Convert multi-column PDFs to Word, Markdown, or HTML with immersive translation for enhanced document handling.
👉 开始使用 Doc2X | Start Using Doc2X
原文链接:https://arxiv.org/pdf/2405.14768
WISE: Rethinking the Knowledge Memory for Lifelong Model Editing of Large Language Models
WISE:重新思考终身模型编辑大型语言模型的知识记忆
Peng Wang 1 ∗ {}^{1 * } 1∗ Zexi L i 1 ∗ {\mathrm{ {Li}}}^{1 * } Li1∗ Ningyu Zhang 1 † {}^{1 \dagger } 1† Ziwen Xu 1 {}^{1} 1 Yunzhi Yao 1 {}^{1} 1 Yong Jiang 2 Pengjun Xie 2 Fei Huang 2 {}^{2}\;{\text{Pengjun Xie}}^{2}\;{\text{Fei Huang}}^{2}\; 2Pengjun Xie2Fei Huang2 Huajun Chen 1 † {}^{1 \dagger } 1†
王鹏 1 ∗ {}^{1 * } 1∗ 李泽 L i 1 ∗ {\mathrm{ {Li}}}^{1 * } Li1∗ 张宁宇 1 † {}^{1 \dagger } 1† 徐子文 1 {}^{1} 1 姚云志 1 {}^{1} 1 江勇 2 Pengjun Xie 2 Fei Huang 2 {}^{2}\;{\text{Pengjun Xie}}^{2}\;{\text{Fei Huang}}^{2}\; 2Pengjun Xie2Fei Huang2 陈华军 1 † {}^{1 \dagger } 1†
1 Zhejiang University 2 Alibaba Group
1 浙江大学 2 阿里巴巴集团
{peng2001,zexi.li,zhangningyu}@zju.edu.cn
{peng2001,zexi.li,zhangningyu}@zju.edu.cn
Abstract
摘要
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 (nonparametric 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 ‡ {}^{ \ddagger } ‡ .
大型语言模型(LLMs)需要知识更新以满足不断增长的世界事实并纠正幻觉响应,从而促进终身模型编辑的方法。更新知识存储在记忆中的位置是模型编辑中的一个基本问题。在本文中,我们发现无论是编辑长期记忆(直接模型参数)还是工作记忆(通过检索获得的神经网络激活/表示的非参数知识),都会导致在终身编辑设置中无法实现可靠性、泛化和局部性的三角关系。对于长期记忆,直接编辑参数会导致与无关的预训练知识或先前编辑的冲突(可靠性差和局部性差)。对于工作记忆,基于检索的激活很难使模型理解编辑并进行泛化(泛化性差)。因此,我们提出了WISE来弥合记忆之间的差距。在WISE中,我们设计了一种双参数记忆方案,包括用于预训练知识的主记忆和用于编辑知识的侧记忆。我们仅在侧记忆中编辑知识,并训练一个路由器来决定在给定查询时选择哪个记忆。对于持续编辑,我们设计了一种知识分片机制,其中不同的编辑集驻留在参数的不同子空间中,并随后无冲突地合并到共享记忆中。大量实验表明,WISE可以超越先前的模型编辑方法,并在终身模型编辑的问题回答、幻觉和分布外设置中克服不可能的三角关系,适用于流行的LLM架构,例如GPT、LLaMA和Mistral ‡ {}^{ \ddagger } ‡。
1 Introduction
1 引言
Large language models (LLMs) show emergent intelligence when scaling the number of parameters and data [1-4], which reveals the sparks of artificial general intelligence [5]. However, when deployed, LLMs still make mistakes [6], generating responses with hallucinations [7], bias [8], and factual decays [9]. On the other hand, the world’s knowledge is ever-growing, so the up-to-date knowledge is usually different from the one during LLMs’ pretraining [10]. Many such errors and emerging facts will arise sequentially in deployment, some of which have to be addressed timely and efficiently without waiting for retraining or finetuning [11, 12]. Also, retraining or finetuning is often too computationally expensive [ 13 , 10 ] \left\lbrack { {13},{10}}\right\rbrack [13,10] ,which is not sustainable for lifelong growing knowledge. Therefore, lifelong model editing [10] was proposed to remedy the continual knowledge updates and injections for LLMs in a cheap and timely manner.
大型语言模型(LLMs)在扩展参数数量和数据时展现出涌现的智能 [1-4],这揭示了人工通用智能的火花 [5]。然而,在部署时,LLMs 仍然会犯错误 [6],生成带有幻觉 [7]、偏见 [8] 和事实衰减 [9] 的响应。另一方面,世界知识不断增长,因此最新的知识通常与 LLMs 预训练时的知识不同 [10]。在部署过程中,许多此类错误和新出现的事实将依次出现,其中一些必须在不等待重新训练或微调的情况下及时有效地解决 [11, 12]。此外,重新训练或微调通常在计算上过于昂贵 [ 13 , 10 ] \left\lbrack { {13},{10}}\right\rbrack [13,10],这对于终身增长的知识来说不可持续。因此,终身模型编辑 [10] 被提出,以廉价且及时的方式修复 LLMs 的持续知识更新和注入。
-
Equal contribution.
-
同等贡献。
† Corresponding Author.
† 通讯作者。
‡ {}^{ \ddagger } ‡ Code is available at https://github.com/zjunlp/EasyEdit.
‡ {}^{ \ddagger } ‡ 代码可在 https://github.com/zjunlp/EasyEdit 获取。
An effective lifelong model editing approach should satisfy the following properties [ 14 , 15 , 11 , 16 \lbrack {14},{15},{11},{16} [14,15,11,16 , 17]: i) reliability, the model can remember both current and previous edits after sequential editing; ii) locality, model editing will not influence inherent pretrained knowledge which is irrelevant to the edited knowledge; iii) generalization, the model is not just merely memorizing the query-target pairs; instead, it should understand and generalize when given other forms of queries with the same knowledge. We compare existing model editing and continual learning methods on the three metrics in Figure 1 and find that it seems to be an impossible triangle-reliability, generalization, and locality can not be realized at the same time in the continual editing settings. We find that where the updated knowledge resides in memories affects editing performances, and previous methods can be generally divided into editing either long-term memory, e.g., ROME [18], MEMIT [19], and FT-EWC (Finetuning with Elastic Weight Consolidation [20], a continual learning method), or working memory, e.g., GRACE [10]. Note that the categorization of long-term and working memories is derived from human recognition [21, 22] and neuroscience [23] which has recently been adopted in the study of LLMs [24-27]. Model editing of long-term memory refers to directly editing the model parameters, which contain generalizable parametric knowledge [28, 24]. However, editing long-term memory will cause conflicts with previous pretrained knowledge, resulting in poor locality (e.g., ROME and FT-EWC in Figure 1). Working memory refers to the non-parametric knowledge of neural network activations/representations by retrieval, and it does not change the network parameters [24]; instead, it replaces the representations by retrieval at working (inference) time, like GRACE. GRACE’s working memory shows promising results in reliability and locality, but in our experiments, it shows poor generalization since retrieval-based representations can hardly make the model understand the edits and generalize to different queries. It reveals that long-term memory and working memory both have drawbacks for lifelong model editing, though there were some special memory designs for LLM architectures, like MemorryLLM [28], SPALM [27], and Memoria [25], they change the architectures and cannot be directly applied for different LLMs. Intuitively, there is a gap between editing working and long-term memories, thus, in this paper, we study:
一种有效的终身模型编辑方法应满足以下特性 [