DAFN et: Dynamic Auxiliary Fusion for Sequential Model Editing in Large Language Models (2024)

Abstract: Recently, while large language models (LLMs) have demonstrated impressive results, they still suffer from hallucination, i.e., the generation of false information. Model editing is the task of fixing factual mistakes in LLMs; yet, most previous works treat it as a one-time task, paying little attention to ever-emerging mistakes generated by LLMs. We address the task of sequential model editing (SME) that aims to rectify mistakes continuously. A Dynamic Auxiliary Fusion Network (DAFNet) is designed to enhance the semantic interaction among the factual knowledge within the entire sequence, preventing catastrophic forgetting during the editing process of multiple knowledge triples.Specifically, (1) for semantic fusion within a relation triple, we aggregate the intra-editing attention flow into auto-regressive self-attention with token-level granularity in LLMs. We further leverage multi-layer diagonal inter-editing attention flow to update the weighted representations of the entire sequence-level granularity. (2) Considering that auxiliary parameters are required to store the knowledge for sequential editing, we construct a new dataset named DAFSet, fulfilling recent, popular, long-tail and robust properties to enhance the generality of sequential editing. Experiments show DAFNet significantly outperforms strong baselines in single-turn and sequential editing. The usage of DAFSet also consistently improves the performance of other auxiliary network-based methods in various scenarios.

## introduction transformer-based models, particularly llms @xcite @xcite have become backbones of modern nlp and delivered promising results in various downstream tasks @xcite @xcite . however, llms still produce undesirable outputs occasionally @xcite . the cost of such mistakes is non-negligible and exhibits an inclination to generate hallucinations @xcite , resulting in seemingly plausible yet factually unsupported contents. to alleviate these problems, there has been growing interest in integrating knowledge into llms through model editing @xcite @xcite . it updates the knowledge stored in relevant parameters in llms without fine-tuning the whole model. in the literature, previous model editing methods foot_0 can be divided into two categories, including single-turn editing and sequential editing. (1) single-turn editing edits one or a batch of knowledge triples at a time via modifying the original parameters of llms based on metalearning @xcite and locate-then-edit methods @xcite @xcite . these works struggle to handle factual knowledge that is continuously updated in real-world scenarios. (2) sequential model editing (sme) based approaches learn the updated knowledge via adding extra modules @xcite @xcite . the editing process of parameters is not achieved through back-propagation, but instead through weights independently calculated by extra modules associated with each fact. however, these methods do not take into account the effects of mutual semantic influence between these sequentially input facts. another overlooked problem is that extra parameters are randomly initialized and can not provide a good starting point to cover the editing properties @xcite of the testing data. 3 as shown in figure 1 , previous model editing methods edit the sequential facts independently similar to single-turn editing in sme scenario. thus, subsequent llms need to wait for previous llms to finish editing before they can be edited. in this paper, we propose a dynamic auxiliary fusion network named dafnet to explicitly capture the correlation among the input sequential triples for the update of knowledgeable parameters in llms. in addition, an auxiliary dataset named dafset for learning the meta-edit weights is constructed to compensate for the learning gap between extra cold-start parameters and testing properties in the training stage. to our knowledge, this is currently the first comprehensive training set in model editing 4 . specifically, we introduce the above two main contributions as follows: dafnet: unlike previous methods that update parameters independently, we aggregate the representations of facts into intra-and inter-editing auto-regressive flows. the intra-editing attention flow gathers each token-level fact representation auto-repressively via assigning different semantic weights to tokens, decomposing the llms' high-dimensional outputs to two low-rank representations as editing signal. the inter-editing attention flow obtains interactive representations of sentence-level sequential inputs through multilayer auto-regressive iterative diagonal attention between facts. finally, our designed loss based on the desired editing properties is leveraged to train the auxiliary network. dafset: in previous works (cao et al., 2021; 3 the post-edit model should satisfy the following properties: reliability, generality and locality @xcite . 4 previous public datasets are used for testing editing ability of llms directly @xcite @xcite . @xcite , weights of the original auxiliary network are usually randomly initialized and then combined with llms in multitask training. therefore, the lack of training set for existing editing methods causes the inconsistency with the distributional characteristics of the final editing target solely by editing the facts @xcite . the goal of constructing our auxiliary dataset is to learn auxiliary meta-weights to compensate for the bias caused by random weight distributions. dafset is designed to include four different properties (i.e., recency, popularity, long-tailness and robustness) based on the test editing properties. we collect data for these properties via subject frequency and output likelihood in various domains to make the learned auxiliary weights equipped with more generalized editing abilities. ## related work in this section, we briefly overview the related works of model editing for llms in four aspects. ## preliminaries of sme in this section, we provide a brief introduction to sme for llms. a model @xmath0: @xmath1. then, given a model f and an edit example pair (x e , y e ) that f (x e ) ̸ = y e , a model editor (me) outputs a post-edit model f ′ . ## the dafnet model in this section, we formally introduce our dafnet model, with an overall architecture shown in figure 3 . in dafnet, to obtain rich semantic representation for each knowledge triple, we perform a tokenlevel granularity fusion modeling by intra-editing attention flow in section 5.2. next, we leverage the auto-regressive modeling process to naturally capture the semantic interaction among sequential facts by inter-editing attention flow in section 5.3. ## experiments in this section, we extensively evaluate the proposed method and compare it with strong baselines. due to space limitation, we describe experimental settings including datasets, baselines and implementation details in appendix a. ## conclusion in this paper, we propose a dynamic auxiliary fusion model (dafnet) for sequential editing, including the intra-editing and inter-editing attention flow modules. to obtain better meta weights for updating llms' original weights in the auxiliary network, we further propose the dafset dataset to enhance the editing ability of llms. experimental results show that our model achieves state-of-theart results over the strong baselines.