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,一个易用的大型语言模型知识编辑框架。该框架支持多种前沿知识编辑方法,并可便捷应用于T5、GPT-J、LlaMA等诸多知名LLMs。通过实证研究,我们基于EasyEdit报告了LlaMA-2上的知识编辑结果,表明知识编辑在可靠性和泛化性方面均优于传统微调方法。我们已在GitHub开源代码,并为初学者提供了Google Colab教程与完整文档。此外,我们还搭建了支持实时知识编辑的在线系统,并提供了演示视频。