Editing Large Language Models: Problems, Methods, and Opportunities (2023)

Abstract: Despite the ability to train capable LLMs, the methodology for maintaining their relevancy and rectifying errors remains elusive. To this end, the past few years have witnessed a surge in techniques for editing LLMs, the objective of which is to alter the behavior of LLMs efficiently within a specific domain without negatively impacting performance across other inputs. This paper embarks on a deep exploration of the problems, methods, and opportunities related to model editing for LLMs. In particular, we provide an exhaustive overview of the task definition and challenges associated with model editing, along with an in-depth empirical analysis of the most progressive methods currently at our disposal. We also build a new benchmark dataset to facilitate a more robust evaluation and pinpoint enduring issues intrinsic to existing techniques. Our objective is to provide valuable insights into the effectiveness and feasibility of each editing technique, thereby assisting the community in making informed decisions on the selection of the most appropriate method for a specific task or context.

## introduction large language models (llms) have demonstrated a remarkable capacity for understanding and generating human-like text @xcite @xcite @xcite . despite the proficiency in training llms, the strategies for ensuring their relevance and fixing their bugs remain unclear. ideally, as the world's state evolves, we aim to update llms in a way that sidesteps the computational burden associated with training a wholly new model. as shown in figure 1 , to address this issue, the concept of model editing has been proposed ( @xcite , enabling data-efficient alterations to the behavior of models, specifically within a designated realm of interest, while ensuring no adverse impact on other inputs. currently, numerous works on model editing for llms @xcite @xcite @xcite have made strides in various editing tasks and settings. as illustrated in figure 2 , these works manipulate the model's output for specific cases by either integrating an auxiliary network with the original unchanged model or altering the model parameters responsible for the undesirable output. despite the wide range of model editing techniques present in the literature, a comprehensive comparative analysis, assessing these methods in uniform experimental conditions, is notably lacking. this absence of direct comparison impairs our ability to discern the relative merits and demerits of each approach, consequently hindering our comprehension of their adaptability across different problem domains. to confront this issue, the present study endeavors to establish a standard problem definition accompanied by a meticulous appraisal of these methods ( §2, §3). we conduct experiments under regulated conditions, fostering an impartial comparison of their respective strengths and weaknesses ( §4). we initially use two popular model editing datasets, zsre @xcite and coun-terfact @xcite , and two structurally different language models, t5 @xcite (encoder-decoder) and gpt-j @xcite ) (decoder only), as our base models. we also evaluate the performance of larger models, opt-13b @xcite and gpt-neox-20b @xcite . beyond basic edit settings, we assess performance for batch and sequential editing. while we observe that current methods have demonstrated considerable capacity in factual model editing tasks, we reconsider the current evaluation and create a more encompassing evaluation dataset ( §5): portability (robust generalization capabilities), locality (side effect), and efficiency (time and memory usage). we find current model editing methods are somewhat limited on these levels, thereby constraining their practical application, and deserve more research in the future. through systematic evaluation, we aim to provide valuable insights on each model editing technique's effectiveness, aiding researchers in choosing the appropriate method for specific tasks. by systematically evaluating their performance, we aim to impart valuable insights into the effectiveness and feasibility of each model editing technique, ultimately assisting the research community in making informed decisions when selecting a method for a specific task or context. it's also noticeable, through the creation of a more encompassing evaluation dataset (s5), that existing approaches fall short in some terms. ## problems definition model editing, as elucidated by @xcite , aims to adjust an initial base model's (f θ , θ signifies the model's parameters) behavior on the particular edit descriptor (x e , y e ) efficiently without influencing the model behavior on other samples. the ultimate goal is to create an edited model, denoted f θe . which succinctly encapsulates the intended modifications in the model's performance specifically, the basic model f θ is represented by a function f : @xmath0. given an edit descriptor comprising the edit input x e and edit label y e such that f θ (x e ) ̸ = y e , the post-edit model f θe is designed to produce the expected output, where f θe (x e ) = y e . the model editing process generally impacts the predictions for a broad set of inputs that are closely associated with the edit example. this collection of inputs is called the editing scope. a successful edit should adjust the model's behavior for examples within the editing scope while leaving its performance for out-of-scope examples unaltered. the in-scope i(x e , y e ) usually encompasses x e along with its equivalence neighborhood n (x e , y e ), which includes related input/output pairs. in contrast, the out-of-scope o(x e , y e ) consists of inputs that are unrelated to the edit example. the post-edit model f e should satisfy the following three properties: reliability, generalization, and locality. reliability previous works @xcite @xcite define a reliable edit when the post-edit model f θe gives the target answer for the case (x e , y e ) to be edited. the reliability is measured as the average accuracy of the edit case: generalization the post-edit model f θe should also edit the equivalent neighbour n (x e , y e ) (e.g., rephrased sentences). it is evaluated by the average accuracy of the model f θe on examples drawn uniformly from the equivalence neighborhood: locality also noted as specificity in some work. editing should be implemented locally, which means the post-edit model f θe should not change the output of the irrelevant examples in the out-ofscope o(x e , y e ). hence, the locality is evaluated by the rate at which the post-edit model f θe 's predictions are unchanged as the pre-edit f θ model: ## preliminary experiments considering the abundance of studies and datasets centered on factual knowledge, we use it as our primary comparison foundation. our initial controlled experiments, conducted using two prominent factual knowledge datasets ( ## comprehensive study considering the above points, we contend that previous evaluation metrics may not fully assess model editing capabilities. therefore, we propose more comprehensive evaluations regarding portability, locality, and efficiency. ## conclusion we systematically analyze methods for editing large language models (llms). we aim to help researchers better understand existing editing techniques by examining their features, strengths, and limitations. our analysis shows much room for improvement, especially in terms of portability, locality, and efficiency. improved llm editing could help better align them with the changing needs and values of users. we hope that our work spurs progress on open issues and further research.