InstructEdit: Instruction-based Knowledge Editing for Large Language Models
Ningyu Zhang, Bozhong Tian, Siyuan Cheng, Xiaozhuan Liang, Yi Hu, Kouying Xue, Yanjie Gou, Xi Chen, Huajun Chen
TL;DR
This work tackles the challenge of editing knowledge in large language models across multiple tasks without sacrificing overall performance. It introduces InstructEdit, an instruction-guided unified editor built on a meta-learning (hypernetwork) editing framework to learn task-aware editing directions conditioned on natural-language instructions. Through multi-task datasets (CounterFact, Recent, ConvSent) and a hold-out ZsRE evaluation, InstructEdit achieves notable gains in reliability and strong OOD generalization, outperforming baselines on unseen instructions and hold-out tasks. Gradient analysis suggests instructions help steer optimization directions, promoting discriminative editing areas and better generalization as task diversity increases. The work provides practical insights on data balancing, instruction design, and the potential for scalable, instruction-based editing in real-world LLM deployment.
Abstract
Knowledge editing for large language models can offer an efficient solution to alter a model's behavior without negatively impacting the overall performance. However, the current approaches encounter issues with limited generalizability across tasks, necessitating one distinct editor for each task, significantly hindering the broader applications. To address this, we take the first step to analyze the multi-task generalization issue in knowledge editing. Specifically, we develop an instruction-based editing technique, termed InstructEdit, which facilitates the editor's adaptation to various task performances simultaneously using simple instructions. With only one unified editor for each LLM, we empirically demonstrate that InstructEdit can improve the editor's control, leading to an average 14.86% increase in Reliability in multi-task editing setting. Furthermore, experiments involving holdout unseen task illustrate that InstructEdit consistently surpass previous strong baselines. To further investigate the underlying mechanisms of instruction-based knowledge editing, we analyze the principal components of the editing gradient directions, which unveils that instructions can help control optimization direction with stronger OOD generalization. Code and datasets are available in https://github.com/zjunlp/EasyEdit.
