Model Editing Harms General Abilities of Large Language Models: Regularization to the Rescue (2024)

Abstract: Model editing is a technique that edits the large language models (LLMs) with updated knowledge to alleviate hallucinations without resource-intensive retraining. While current model editing methods can effectively modify a model’s behavior within a specific area of interest, they often overlook the potential unintended side effects on the general abilities of LLMs such as reasoning, natural language inference, and question answering. In this paper, we raise concerns that model editing’s improvements on factuality may come at the cost of a significant degradation of the model’s general abilities. We systematically analyze the side effects by evaluating four popular editing methods on three LLMs across eight representative tasks. Our extensive empirical experiments show that it is challenging for current editing methods to simultaneously improve factuality of LLMs and maintain their general abilities. Our analysis reveals that the side effects are caused by model editing altering the original model weights excessively, leading to overfitting to the edited facts. To mitigate this, a method named RECT is proposed to regularize the edit update weights by imposing constraints on their complexity based on the RElative Change in weighT. Evaluation results show that RECT can significantly mitigate the side effects of editing while still maintaining over 94% editing performance.

## introduction as real-world knowledge is dynamically increasing and updating, existing large language models (llms) need to constantly incorporate the inherit knowledge and up-to-date information for lifelong learning. despite continual training, llms inevitably manifest hallucinations caused by missing, false or outdated knowledge embedded in figure 1 : demonstration of model editing and its impact on the general abilities of llms. although the factuality of the model has been improved, the general abilities of llms, such as question answering, dialogue, named entity recognition, sentiment analysis, have been substantially impaired after editing. f θ / f θe denotes the models before / after editing. at present, the assessment of editing methods typically involves evaluation along three critical dimensions @xcite . first, reliability ensures the edited model can accurately recall the specific edited fact. second, generalization validates the adaptability of the edited model by assessing the model's ability to recall the fact under diverse paraphrase prompts. finally, locality checks if the edited model's output for unrelated inputs remains consistent after editing. these multifaceted criteria collectively contribute to a nuanced understanding of the effectiveness and robustness of editing methods. in this paper, we put forward a critical concern regarding the overall robustness and adaptability of edited models. as shown in figure 1 , while model editing methods have demonstrated improved factuality, it may come at the significant cost of the general abilities of llms such as summarization, question answering (qa), natural language inference. we argue that improving model factuality must be balanced with the need to maintain effectiveness across a range of abilities. in light of the above issues, we systematically study if model editing hurts the general abilities of llms. this work studies model editing in the single-versus sequential-editing and instanceversus batch-editing settings. the edited models are evaluated on a variety of downstream tasks to see if there are any side effects on performance before and after editing. extensive empirical experiments are conducted on four popular editing methods: kn @xcite , mend @xcite , rome @xcite , and memit @xcite applied to three representative llms: gpt-2 xl (1.5b) @xcite , llama-1 (7b) @xcite , and llama-2 (7b) @xcite . eight representative tasks including reasoning @xcite , natural language inference @xcite , open-domain qa @xcite , closed-domain qa @xcite , dialogue @xcite , summarization @xcite , named entity recognition @xcite , and sentiment analysis @xcite are employed to understand the impact of model editing on the general abilities of llms. experimental results show that existing llms are not robust to weight perturbations, and editing even a few parameters can significantly affect their general abilities. strikingly, with a single pass of editing involving less than 1% parameters, llama-1 (7b) exhibited a drastic performance degradation to nearly 0 on all the tasks we tried. these results demonstrate that current editing algorithms struggle to work effectively in tandem with llms to simultaneously improve model factuality and maintain general abilities. furthermore, our analysis of the causes of side effects reveals that current model editing methods change the original model weights too much, resulting in overfitting to new editing facts. the accumulation of overfitting across multiple edits can amplify the negative impact on the general abilities of llms. as a result, the edited model can recall new editing facts well but fails to generalize to various downstream tasks. to this end, we design a regularization method named rect (relative change in weight) to prevent overfitting. basically, this regularization discourages overly complex editing updates that are more likely to overfit. specifically, the top-k% elements in an edit update weight that change the most according to relative change in weights are considered as the principal editing information and keep their original values. while for the remaining elements in this edit update weight, they are treated as minor contributions to editing and set to zero for regularization. evaluation results show that the edited models regularized by rect can effectively mitigate the side effects of editing while still maintaining over 94% editing performance in summary, we demonstrate that although model editing is effective in updating parametric knowledge in a resource-efficient and targetspecific way, current methods still have significant flaws in preserving the general abilities of llms. existing research on model editing excessively pursued altering a model's behavior under specific knowledge while overlooked the premise of not compromising general abilities. this paper points out the urgent shortcomings in model editing and proposes a regularization method to prevent overfitting across multiple edits to rescue the general abilities, calling for follow-up research efforts on trustworthy and robust model editing. ## related work many studies have investigated model editing, including memory-based, meta-learning, and locatethen-edit @xcite . memory-based methods do not modify model weights but store the editing facts with an external memory @xcite . @xcite stored edits in a base model and learned to reason over them to adjust its predictions as needed. the latter two classes of methods are developed to directly modify the internal parameters of models, which is the focus of this paper. on the one hand, meta-learning methods train a hypernetwork to get gradient changes to update model parameters @xcite . @xcite utilized a hypernetwork to predict parameter shift at test time. @xcite learned to transform the finetuning gradient into a low-rank decomposition of the gradient. on the other hand, locate-then-edit methods first locate knowledge neurons in llms that exhibit a positive correlation with a knowledge expression, and then modify them accordingly @xcite @xcite . in particular, @xcite computed the contribution of each neurons to a certain knowledge, then updated or erased knowledge by modifying these neurons with the embedding vectors of facts. @xcite located multi-layer perceptron (mlp) storing factual knowledge, and then edited such knowledge by injecting new key-value pair in the mlp module. besides, some works investigate the evaluation paradigm for model editing @xcite @xcite @xcite @xcite . for example, @xcite introduced the ripple effects of editing, suggesting that editing a particular fact implies that many other facts need to be updated. additionally, recent works have also applied editing in various domains, such as changing model personality @xcite , editing multimodal models @xcite , protecting users privacy @xcite , etc. a main difference between this work and previous related studies should be highlighted. these approaches target at designing editing algorithms to improve or evaluation paradigms to assess the editing performance. in contrast, this study rethinks model editing and explores if current editing methods inadvertently cause the potential side effects on the underlying general abilities of llms. the contemporaneous work @xcite presents a similar finding that model editing at scale leads to catastrophic forgetting, but no mitigation method is proposed. to the best of our knowledge, this paper makes the first call for attention to side effects on a variety of tasks beyond editing performance by presenting a systematical evaluation of four editing methods on three llms covering eight tasks. besides, we also analyze the causes of side effects, and propose a regularization method to prevent editing overfitting. ## preliminary model editing involves modifying the memorized facts contained in lms without retraining to better suit specific tasks or requirements. various kinds of complex learned beliefs such as logical, spatial, or numerical knowledge are expected to be edited. in this paper, we study editing factual knowledge in the form of (subject s, relation r, object o), e.g., (@xmath0, @xmath1, @xmath2. an lm is expected to recall a memory and predict the next token(s) representing o given a natural language prompt p(s, r) such as "the president of the united states is". editing a fact is to insert a new knowledge triple (s, r, o * ) in place of the current one (s, r, o), where these two triples share the same subject and relation. an editing operation is represented as @xmath3, r, o, o * ) for brevity. given a set of editing facts @xmath4, e 2 , . . .} and a model f , model editing involves learning a function k that yields an edited lm f * : k(f, e) = f * . to evaluate the effectiveness of editing methods, previous works focus on evaluation along three dimensions @xcite @xcite . first and foremost is reliability, aiming to ascertain the ability of the edited model to accurately recall the specific editing facts. the second dimension generalization seeks to validate the adaptability of the edited model by assessing its ability to recall the editing facts under diverse paraphrase prompts. the last dimension locality (a.k.a., specificity) is employed to verify the stability of the edited model by examining whether its output for unrelated inputs remains consistent after editing. due to limited space, readers can refer to appendix a for more detailed explanations and examples of the evaluation metrics. ## conclusion model updating technology has been catalyzing the continuous iteration of advanced and trustworthy llms. this paper studies model editing and for the first time raises concerns whether model editing has any side effects on the general abilities of llms. the systematical evaluation reveals that current methods unintentionally hurt the general abilities of llms no matter in instance-or batchediting, and single-or sequential-editing. our analysis of the causes reveals that model editing results in overfitting to the editing facts, and the accumulation of overfitting across multiple edits can amplify the negative impact. the proposed rect regularization method has been proven to effectively prevent overfitting of new editing facts, thus preserving both the editing and general downstream task performance.