让大模型改知识不丢旧知识,一次修改提升36.7%效果
AlphaEdit: Null-Space Constrained Knowledge Editing for Language Models
- 编辑前将改动投影到知识不变空间,避免干扰原有知识
- 在多个模型上平均提升36.7%编辑效果,仅需一行代码
- 适合需要精准更新知识且不破坏原有能力的研究者
大语言模型常因错误或过时知识产生幻觉。为此,模型编辑方法应运而生,实现针对性知识更新。现有主流方法采用定位-编辑范式:先定位关键参数,再通过扰动进行修改。然而,该扰动不可避免地破坏模型原有知识,尤其在连续编辑场景中。为此,我们提出AlphaEdit,将扰动投影至被保留知识的零空间后再施加于参数。理论证明,此投影确保编辑后模型在查询原知识时输出不变,从而缓解破坏问题。在LLaMA3、GPT2-XL和GPT-J等模型上的实验表明,AlphaEdit使多数定位-编辑方法性能平均提升36.7%,且仅需添加一行投影代码。代码已开源:https://github.com/jianghoucheng/AlphaEdit。
原文摘要 · Abstract (English)
Large language models (LLMs) often exhibit hallucinations due to incorrect or outdated knowledge. Hence, model editing methods have emerged to enable targeted knowledge updates. To achieve this, a prevailing paradigm is the locating-then-editing approach, which first locates influential parameters and then edits them by introducing a perturbation. While effective, current studies have demonstrated that this perturbation inevitably disrupt the originally preserved knowledge within LLMs, especially in sequential editing scenarios. To address this, we introduce AlphaEdit, a novel solution that projects perturbation onto the null space of the preserved knowledge before applying it to the parameters. We theoretically prove that this projection ensures the output of post-edited LLMs remains unchanged when queried about the preserved knowledge, thereby mitigating the issue of disruption. Extensive experiments on various LLMs, including LLaMA3, GPT2-XL, and GPT-J, show that AlphaEdit boosts the performance of most locating-then-editing methods by an average of 36.7% with a single line of additional code for projection solely. Our code is available at: https://github.com/jianghoucheng/AlphaEdit.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。