Large Language Models (LLMs) usually suffer from knowledge cutoff or fallacy issues, which means they are unaware of unseen events or generate text with incorrect facts owing to outdated/noisy data. To this end, many knowledge editing approaches for LLMs have emerged -- aiming to subtly inject/edit updated knowledge or adjust undesired behavior while minimizing the impact on unrelated inputs. Nevertheless, due to significant differences among various knowledge editing methods and the variations in task setups, there is no standard implementation framework available for the community, which hinders practitioners from applying knowledge editing to applications. To address these issues, we propose EasyEdit, an easy-to-use knowledge editing framework for LLMs. It supports various cutting-edge knowledge editing approaches and can be readily applied to many well-known LLMs such as T5, GPT-J, LlaMA, etc. Empirically, we report the knowledge editing results on LlaMA-2 with EasyEdit, demonstrating that knowledge editing surpasses traditional fine-tuning in terms of reliability and generalization. We have released the source code on GitHub, along with Google Colab tutorials and comprehensive documentation for beginners to get started. Besides, we present an online system for real-time knowledge editing, and a demo video.
翻译:大型语言模型(LLMs)常面临知识截断或谬误问题,即因使用过时/含噪数据而无法获知未见过的事件,或生成包含错误事实的文本。为此,学界涌现出多种面向LLMs的知识编辑方法——旨在小幅注入/更新修正后的知识或调整不当行为,同时最小化对无关输入的影响。然而,由于不同知识编辑方法间的显著差异以及任务设置的变化,当前社区尚未形成标准化的实现框架,这阻碍了从业者将知识编辑应用于实际场景。为解决上述问题,我们提出EasyEdit——一种面向LLMs的易用知识编辑框架。该框架支持多种前沿知识编辑方法,并可便捷应用于T5、GPT-J、LlaMA等众多知名LLMs。通过使用EasyEdit对LlaMA-2进行知识编辑实验,我们实证表明知识编辑在可靠性与泛化性方面均超越传统微调方法。目前已于GitHub发布源代码,并提供Google Colab教程及面向初学者的完整文档。此外,我们还展示了实时知识编辑在线系统及演示视频。