A Survey on Knowledge Editing of Neural Networks
Deep neural networks are becoming increasingly pervasive in academia and
industry, matching and surpassing human performance on a wide variety of fields
and related tasks. However, just as humans, even the largest artificial neural
networks make mistakes, and once-correct predictions can become invalid as the
world progresses in time. Augmenting datasets with samples that account for
mistakes or up-to-date information has become a common workaround in practical
applications. However, the well-known phenomenon of catastrophic forgetting
poses a challenge in achieving precise changes in the implicitly memorized
knowledge of neural network parameters, often requiring a full model
re-training to achieve desired behaviors. That is expensive, unreliable, and
incompatible with the current trend of large self-supervised pre-training,
making it necessary to find more efficient and effective methods for adapting
neural network models to changing data. To address this need, knowledge editing
is emerging as a novel area of research that aims to enable reliable,
data-efficient, and fast changes to a pre-trained target model, without
affecting model behaviors on previously learned tasks. In this survey, we
provide a brief review of this recent artificial intelligence field of
research. We first introduce the problem of editing neural networks, formalize
it in a common framework and differentiate it from more notorious branches of
research such as continuous learning. Next, we provide a review of the most
relevant knowledge editing approaches and datasets proposed so far, grouping
works under four different families: regularization techniques, meta-learning,
direct model editing, and architectural strategies. Finally, we outline some
intersections with other fields of research and potential directions for future
works.
Vittorio Mazzia, Alessandro Pedrani, Andrea Caciolai, Kay Rottmann, Davide Bernardi
# A Survey on Knowledge Editing of Neural Networks

###### Abstract

Deep neural networks are becoming increasingly pervasive in academia and industry, matching and surpassing human performance on a wide variety of fields and related tasks. However, just as humans, even the largest artificial neural networks make mistakes, and once-correct predictions can become invalid as the world progresses in time. Augmenting datasets with samples that account for mistakes or up-to-date information has become a common workaround in practical applications. However, the well-known phenomenon of catastrophic forgetting poses a challenge in achieving precise changes in the implicitly memorized knowledge of neural network parameters, often requiring a full model re-training to achieve desired behaviors. That is expensive, unreliable, and incompatible with the current trend of large self-supervised pre-training, making it necessary to find more efficient and effective methods for adapting neural network models to changing data. To address this need, knowledge editing is emerging as a novel area of research that aims to enable reliable, data-efficient, and fast changes to a pre-trained target model, without affecting model behaviors on previously learned tasks. In this survey, we provide a brief review of this recent artificial intelligence field of research. We first introduce the problem of editing neural networks, formalize it in a common framework and differentiate it from more notorious branches of research such as continuous learning. Next, we provide a review of the most relevant knowledge editing approaches and datasets proposed so far, grouping works under four different families: regularization techniques, meta-learning, direct model editing, and architectural strategies. Finally, we outline some intersections with other fields of research and potential directions for future works.

Knowledge Editing Model Editing Neural Networks Editing Continual Learning

## 1 Introduction

In stark contrast to artificial neural networks (ANN), (Cichon and Gan, 2015), humans and other animals seem capable of learning and editing their knowledge continuously. Indeed, literature studies indicate that the mammalian brain could prevent catastrophic forgetting (Ratcliff, 1990) by safeguarding previously acquired knowledge, thereby reducing the plasticity of a proportion of synapses and ensuring their long-term stability (Benna and Fusi, 2016; Yang et al., 2009; Cichon and Gan, 2015). On the contrary, ANNs not only struggle to learn new tasks in a sequential fashion (Kirkpatrick et al., 2017), but also edit acquired knowledge on the same data distribution and task (Huang et al., 2023). Indeed, unlike conventional knowledge base systems that explicitly store knowledge, neural models implicitly memorize facts and tasks in their parameters, making it difficult to directly access and interpret their computation and memories (Voita et al., 2019; Belinkov and Glass, 2019). Making even minor modifications can lead to a decrease in performance on previously learnt tasks, or even cause the entire computation to fail due to the well-documented issue of catastrophic forgetting (Ratcliff, 1990). Therefore, modifying their acquired knowledge is a challenging problem.
Just as humans, ANNs make mistakes and as we trust them with increasingly important decisions, the cost of such mistakes grows ever higher (Sinitsin et al., 2020). Therefore, given that mistakes are inevitable, it is crucial for deep learning practitioners to possess the ability to adjust model behaviors by promptly correcting errors as they surface. Currently, practical applications employing deep learning techniques have been relying on different workarounds to tackle this problem. In particular, a full re-training using datasets augmented with samples that account for the mistakes or up-to-date information is a common choice (Sinitsin et al., 2020). The endeavor needed for fine-tuning atop pre-trained models (Sarzynska-Wawer et al., 2021; Devlin et al., 2018; Oquab et al., 2023; Weiss et al., 2016) is frequently substantiated by the diminished dataset size and computational resources needed. On the other hand, this is not always true and manually curated, deterministic mechanisms that overrule model predictions on problematic samples can be the preferred choice (Sinitsin et al., 2020). However, while being simple, this second approach is fully localized and not robust to factor of variations of the input space (e.g., different viewpoint of the same object in computer vision or paraphrasing in natural language processing tasks). Furthermore, while these workarounds may provide a temporary solution, they can be expensive, unreliable, and incompatible with the current trend of large neural models (Zhao et al., 2023; Chen et al., 2022). Indeed, these large networks are typically deployed as static artifacts, whose behavior is difficult to modify during deployment without a costly full re-training (Lazaridou et al., 2021). Thus, in all those cases, in order to adapt to changes in the environment, or to address instances of underfitting or overfitting in the original training data, it is desirable to have the ability to quickly make targeted updates to the model's behavior after it has been deployed (De Cao et al., 2021).

To address this need, _knowledge editing_ methods have been recently proposed to efficiently change a model's behaviors without affecting previous performance on the same task (Sinitsin et al., 2020). These approaches take inspiration from several fields of artificial intelligence research and range from simple fine-tuning with regularization methods (Zhu et al., 2020) to meta-learning techniques that adopt hypernetwork models to learn how to update parameters (De Cao et al., 2021; Mitchell et al., 2022). Due to its recent appearance in the literature, (Sinitsin et al., 2020), the field still lacks accordance in the taxonomy, naming convention, datasets, and target applications. Indeed, most of the works have been motivated by large language models (LLMs), (Zhao et al., 2023; Brown et al., 2020; Soltan et al., 2022), focusing mostly on tasks such as question answering (QA), (Levy et al., 2017), machine translation (MT) (De Cao et al., 2021), or even simpler NLP problems (Thorne et al., 2018). However, it is also possible to find applications of knowledge editing to computer vision problems (Sinitsin et al., 2020). Furthermore, its potential scope is poised to expand across diverse machine learning domains, encompassing areas such as medicine (Shehab et al., 2022) robotics (Soori et al., 2023), and precision agriculture (Sharma et al., 2020) in the future.

### Organization of the survey

The objective of this survey is to provide a comprehensive review of existing literature on knowledge editing, formalizing the task and providing a categorization of the approaches into distinct families. To our knowledge, this is the first work to undertake such an effort, and we hope that it will facilitate future research in this increasingly important area of study. Indeed, the need for more formalization and organizational structure can already be seen by a recent study (Yao et al., 2023), which attempts to benchmark and compare some knowledge editing methodologies specifically for LLMs editing.

The rest of the survey is organized as follows. Section 2 introduces the problem of knowledge editing, using previous works to formalize it under a common definition. Section 3 explores the tasks and datasets that are most commonly considered when solving the knowledge editing problem. Section 4 provides an overview of the most relevant knowledge editing approaches in the literature, identifying four distinct families: _regularization techniques_, _meta-learning_, _direct model editing_, and _architectural strategies_. Finally, Section 5 concludes the survey by discussing some intersection with knowledge editing and other fields of research, and outlining some possible future risks.

## 2 Overview

This section begins by presenting an introduction to the concept of _knowledge editing_, which is also referred to as _model editing_ in the literature. First, we review various definitions and interpretations of knowledge editing proposed by different works. Next, we establish a common definition of knowledge editing that generalizes to all existing works in the field.

### Background

The concept of knowledge editing was first introduced in (Sinitsin et al., 2020), which formalizes it as the task of correcting a model's mistake on a _specific sample_ while preserving the model's overall behavior, akin to continuous
learning. Indeed, as specified by the authors, "The problem of efficient neural network patching differs from continual learning, (...) [because] is not sequential in nature. However, correction (...) of mislabeled samples must not affect its behavior on other samples, which is close to overcoming [the] catastrophic forgetting task." Therefore, (Sinisin et al., 2020) define the problem as performing individual edits _reliably_ and _efficiently_, not _sequentially_, and on the same task learned by the target model without affecting its overall behavior (i.e., being _local_ to the edit). Concurrently, authors of (Zhu et al., 2020) worked specifically on the task of modifying memories in Transformer models (Vaswani et al., 2017), providing their own definition of knowledge editing. They expand the scope of the problem to a subset of knowledge, i.e., a _batch of edits_. Similarly, several other studies have also formalized the problem of model editing following similar steps to Zhu et al. (2020). For instance, works by Mitchell et al. (2022), Meng et al. (2022), and Mitchell et al. (2022) have defined the task as the process of performing individual or batch edits on a target model trained for a specific task. These studies emphasize the importance of ensuring that edits are resilient to factors of variation, i.e., that they are generalizable. While injecting individual changes is already a challenging and interesting task for the scientific community, multiple simultaneous general model edits represent a more realistic scenario that deserves further exploration.

More recently, Hartvigsen et al. (2022) and Huang et al. (2023) argued that the conventional "one-mistake-fixing scenario" does not accurately reflect the complexity of real-world knowledge editing challenges. As such, they proposed to extend the scope of knowledge editing to a sequential problem to facilitate the development of more practical editing methods. While their proposal only accounts for subsequent individual edits, considering multiple simultaneous and sequential edits represents a more general case where the number of edits varies at each step. Nevertheless, it is crucial to highlight that while the new definition of knowledge editing acknowledges a sequential process, differing from continuous learning, its scope remains limited to the modification of knowledge of the initially learned task by the model. On the contrary, continuous learning operates without such constraints, researching for methodologies that allow the model to expand to new tasks and adapt dynamically to completely new information.

### The knowledge editing problem

To introduce the problem of knowledge editing, it is possible to leverage the terminology used to define a "well posed learning problem" (Mitchell et al., 2007): an algorithm is said to learn from experience \(E\) with respect to some class of tasks \(T\) and performance measure \(P\), if its performance at tasks in \(T\), as measured by \(P\), improves with experience \(E\). Then, we can say that knowledge editing is the problem of modifying the algorithm such that, given a representative set \(S\) of instances of tasks in \(T\), and a subset \(S_{e}\subseteq S\) of _edit_ instances, its performance on \(S_{e}\) improves as measured by \(P\), while performance on all the other instances \(S\setminus S_{e}\) remains unchanged.

Figure 1: The knowledge editing problem has been firstly proposed as the task of modifying a model based on a set of individual pairs of edits, in a non-sequential manner (a), (Sinisin et al., 2020). Successive works extended the problem to batch of edits (b), sequential individual edits (c), and sequential batch of edits. Evaluation metrics are similar to all cases, as described in Section 2.5.
More practically, we can define the problem of knowledge as _"the task of modifying a model based on a set of individual or batch edits, \(S_{e}\), pertaining to the same task known by the model, either in a sequential or non-sequential manner. The objective is to update the model's knowledge representation without significantly altering its original behavior or performance over \(S\) and being robust to different factor of variations of the edits."_

More formally, let \(\mathbb{X}\), \(\mathbb{Y}\) be an input and output space, respectively. Let \(f_{0}\) be a function that maps an input \(x\in\mathbb{X}\) to an output \(y\in\mathbb{Y}\), parametrized by \(\theta_{0}\in\Theta\), then

\[f_{0}\in\mathbb{F}\coloneqq\left(\mathbb{X}\times\Theta\right)^{\mathbb{Y}} \tag{1}\]

We use the subscript zero to indicate that this is the _starting model_, i.e. the model we want to edit. We define an _edit pair_ as an input-output pair \((x_{e},y_{e})\in\mathbb{X}\times\mathbb{Y}\), such that \(f_{0}(x_{e})\neq y_{e}\). Then, in its simplest form, given an individual edit example pair \((x_{e},y_{e})\), a knowledge editing (KE) methodology can be defined as follows

\[\text{KE}:\mathbb{F}\times\mathbb{X}\times\mathbb{Y}\rightarrow\mathbb{F} \tag{2}\]

i.e. a function that takes in input the starting model \(f_{0}\) and the edit pair \((x_{e},y_{e})\) to produce an _edited model_\(f_{e}\). If the edited model is such that \(f_{e}(x_{e})=y_{e}\), then we say that the edit was successful. A KE approach can realize the transformation from \(f_{0}\) to \(f_{e}\) in different ways, and we identify four families of possible realizations: regularization, meta-learning, direct model editing and architectural strategies. We delve into more details into each of these families in section 4.

### Taxonomy of edits

Often, it is interesting to edit a model applying multiple edits at once, a sequence of edits, or sequences of batches of edits.

The definition in eq. (2) has been given for the simplest case, that we call a _single non-successive_ edit: we only want to change the model for one edit pair. Conversely, for multiple successive edits we can formally define a list of edit requests as:

\[\mathcal{E}=\{(x_{e},y_{e})^{(i)}\ \ \text{s.t.}\ \ \forall i,j\ x_{e}^{i}=x_{e}^{j} \Rightarrow y_{e}^{i}=y_{e}^{j}\} \tag{3}\]

where the logical constraint ensures that there are no conflicting requests, as suggested by (Meng et al., 2022). Individual edits can also be grouped together and form \(N\) batches of successive edits each with \(B_{e}^{(i)}\) edit pairs, such as

\[\mathcal{B}_{e}^{(i)}=\{(x_{e},y_{e})^{0},\cdots,(x_{e},y_{e})^{B}\}^{(i)}\ \ \text{s.t.}\ \ \mathcal{E}=\bigcup_{i=1}^{N}\mathcal{B}_{e}^{(i)}. \tag{4}\]

The difference between successive individual or batch of edits is that some KE methodologies can ingest an entire \(\mathcal{B}_{e}^{(i)}\) and produce the resulting \(f_{e}\) implementing all the given edits, while other methodologies can only consider one individual sample in sequence at a time. In both cases (a sequence of individual edits is trivially a sequence of single-item batch edits), successive edits assume to work with a starting model \(f_{t-1}\) and apply the \(t\)-th change as

\[f_{t}=\text{KE}(f_{t-1},\mathcal{B}_{e}^{(i)}) \tag{5}\]

proceeding iteratively, using \(f_{t}\) as a starting model for the next edit. Figure 1 summarizes the four types of edits. Finally, as for individual edits, after every change, \(f_{e}\) should not only satisfy \(f_{e}(x_{e})=y_{e}\), but a series of other properties as discussed in the next section.

### Editing properties

Based on the specific task learned by function \(f\), various properties can be specifically designed. However, at a fundamental level, following (Sinitsin et al., 2020; Huang et al., 2023), knowledge editing should aim at satisfying four properties, that we define below.

**Property 1**: _Reliability_: Given an edit pair \((x_{e},y_{e})\), the edited model \(f_{e}\) should output desired edit:

\[f_{e}(x_{e})=y_{e}. \tag{6}\]

**Property 2**: _Generality_: The edited model \(f_{e}\) should be able to generalize to _similar_ examples to the edit pair. This can be formalized by defining an _equivalence neighborhood_\(N(x_{e})\subset\mathbb{X}\) and requiring that the edited model \(f_{e}\) satisfies:

\[f_{e}(\tilde{x}_{e})=y_{e}\qquad\forall\ x_{e}\in N(x_{e}). \tag{7}\]
**Property 3**: _Locality_: The edited model \(f_{e}\) should not alter the output of examples that are not similar to the edit pair. This can be formalized by defining a _locality set_

\[L(x_{e})=\{(x_{loc},y_{loc})\in\mathbb{X}\times\mathbb{Y}\ \ \text{s.t.}\ \ x_{loc} \notin N(x_{e})\wedge f_{0}(x_{loc})=y_{loc}\} \tag{8}\]

and require that the edited model \(f_{e}\) satisfies:

\[f_{e}(x_{loc})=y_{loc}\qquad\forall\ (x_{loc},y_{loc})\in L(x_{e}). \tag{9}\]

**Property 4**: _Efficiency_: The proposed knowledge editing methodology should aim to achieve efficient editing, characterized by low compute and space complexity.

It is worth noting that some works in the literature have defined these same properties, or a subset of them, with different names and notations. Specifically, reliability may also be referred to as _efficacy_, locality as _specificity_, and generality as _paraphrase_, (Meng et al., 2022; De Cao et al., 2021). Moreover, as previously mentioned, depending on the specific field of application, other properties and related evaluation metrics can arise, such as _fluency_ and _consistency_(Meng et al., 2022) when editing Language Models. Finally, the last property, namely efficiency, tends to be disregarded in academic literature. However, it is one of the main reasons KE is appealing over a simpler re-training of the base model. Furthermore, it plays a pivotal role in performing comparative analyses with baseline models and showcasing the ability of a particular methodology to modify a neural network with a substantial number of parameters. We encourage future works to consider (at least) all four properties when measuring the effectiveness of a proposed KE methodology.

### Evaluation metrics

Given a knowledge editing algorithm KE, a list of edit requests \(\mathcal{E}\), a starting model \(f_{0}\) and a test set \(\mathcal{D}_{test}\), it is possible to measure the extent to which the properties above hold. We consider working with \(N\) batches of successive edits, each comprised of \(B\) individual edits, without loss of generality (as mentioned above, if \(N=1\), we have successive individual edits). Moreover, if the KE methodology is unable to process all \(B\) edits concurrently, it can apply each edit individually in a non-sequential manner.

Following (Huang et al., 2023), we represent with \(I\) the indicator function, and define the following metrics.

**Success Rate**: (SR): It is used to evaluate reliability, and it is simply the proportion of edits for which the methodology succeeds in changing the knowledge of a starting model \(f_{t}\).

\[\text{SR}=\frac{1}{N}\frac{1}{B}\sum_{n=1}^{N}\sum_{b=1}^{B}I(f_{n,B}(x_{e;n,b })=y_{e;n,b})\ \ \ \text{s.t.}\ \bigcup_{n=1}^{N}\bigcup_{b=1}^{B}(x_{e},y_{e})_{n,b}=\mathcal{E} \tag{10}\]

In the case of non-sequential individual edits, \(f_{n,B}=f_{n,b}\). Moreover, Eq. 10 provides an overall value after \(N\) successive edits, but it can be of interest to measure SR every \(n\) edits, tracking changes over the sequence.

**Generalization Rate**: (GR): It is used to evaluate generality, testing the post-edit model \(f_{e}\), on the equivalence neighborhood set \(N(x_{e;n,b},y_{e;n,b})\), where \((x_{e;n,b},y_{e;n,b})\) is the \(n\)-th batch, \(b\)-th edit pair. GR can be written as,

\[\text{GR}=\frac{1}{N}\frac{1}{B}\frac{1}{N_{b}}\sum_{n=1}^{N}\sum_{b=1}^{B} \sum_{i=1}^{N_{b}}I(f_{n,B}(\tilde{x}_{e;n,b,i})=\tilde{y}_{e;n,b,i})\ \ \ \text{s.t.}\ \forall n,b\ \bigcup_{i=1}^{N_{b}}(\tilde{x}_{e},\tilde{y}_{e})_{n,b,i}\subseteq N(x_{e},y_{e})_{n,b} \tag{11}\]

where \(N_{b}\) is the number of equivalent samples of the \(b\)-th edit pair. Following (Mitchell et al., 2022), we can also define **Edit Success** (ES) to summarize both SR and GR. It can be computed as the average accuracy of the edited model \(f_{e}\) on the edit input(s), as well as inputs drawn from the equivalence neighborhood(s), that is,

\[\text{ES}=\frac{1}{N}\frac{1}{B}\sum_{n=1}^{N}\sum_{b=1}^{B}\left(I(f_{n,B}(x_ {e;n,b})=y_{e;n,b})+\sum_{i=1}^{N_{b}}\frac{1}{N_{b}}I(f_{n,B}(x_{e;n,b,i})=y_ {e;n,b,i})\right) \tag{12}\]

where the same conditions for SR and GR hold and have been omitted for brevity.

**Drawdown**: (DD): It is used to evaluate locality, and it is defined as the performance degradation of the edited model over \(\mathcal{D}_{test}\). It is computed using the final edited model, \(f_{N}\), that in case of successive edits is the result of \(N\) steps.

\[\text{DD}=1-\frac{\sum_{(x,y)\in\mathcal{D}_{test}}I(f_{N}(x)=y)}{\sum_{(x,y) \in\mathcal{D}_{test}}I(f_{0}(x)=y)} \tag{13}\]

Finally, as suggested by (Huang et al., 2023) in the case of multiple successive edits, it is also important to evaluate SR and GR using the final model \(f_{N}\), in order to assess how past edits are retained. Therefore, it is possible to define three additional metrics **Success Retain Rate** (SRR), **Generalization Retain Rate** (GRR), and **Edit Success Retain** (ESR), simply using in Eq. 10 and 11, \(f_{N}\) instead of \(f_{n,B}\).
## 3 Tasks and Datasets

The formalization of the knowledge editing problem provided in the previous section is general and many applications of knowledge editing to different tasks encompassing various fields can be formulated within that framework. The brief but rich history of the field has so far seen applications mainly to two broad fields: Computer Vision and Natural Language Processing. Indeed Sinitsin et al. (2020) provide experimental results on image classification and machine translation, and almost all the works come after (and even before (Garnelo et al., 2018; Kirkpatrick et al., 2017)) demonstrate the effectiveness of their proposed approaches in one or more applications in these two fields.

Even though the knowledge editing framework can be defined independently of the target domain and task, each specific application has its unique challenges and intricacies, which we explore in this section. Section 3.1 covers the most common tasks in the Computer Vision domain, as well as the datasets on which the tasks are usually addressed, and how the knowledge editing problem can be instantiated in this context. Section 3.2 provides a similar overview for applications to the Natural Language Processing domain. Finally, Section 3.3 describes tasks and datasets that do not strictly fit in any of the two domains above.

### Computer Vision

Computer Vision is a broad field with a long history, which generally attempts to extract meaningful representations from visual media to derive an understanding of the represented scenes (Szeliski, 2022). Over the last years deep learning methods have been shown to outperform previous state-of-the-art techniques in several applications in the field (Voulodimos et al., 2018), and while more "traditional" techniques are still relevant for some applications, neural networks-based approaches have become the de facto standard for many others (O'Mahony et al., 2020). Due to the importance and breadth of the field, and the relevance of neural networks therein, knowledge editing literature has found fertile grounds in Computer Vision, and has so far gravitated towards two primary tasks: Image Classification and Image Completion. A number of datasets are customarily used to test approaches to solve these tasks. They vary in terms of number of examples, classes and channels, as well as resolution of the representative images; table 1 provides an overview of the most commonly used ones.

Image ClassificationThe task of image classification is straightforward, we wish to label a complete image (or predetermined portion) with its most likely semantic category, e.g., horse, cat, or car Szeliski (2022). In this context, an example is an image and its semantic label. The image, of predefined dimension (or resolution), is encoded as a 3D tensor \(x^{(i)}\in\mathbb{R}^{W\times H\times C}\), where \(W\) is the width of the image, \(H\) the height of the image, and \(C\) the number of channels, depending on whether the image is grayscale (1) or RGB (3) or something else (e.g. RGBD (Firman, 2016) with an additional depth channel). The editing task is then often formulated by artificially corrupting a subset of either the images or the labels. The latter is the more prevalent, and usually involves training models on a subset of a dataset and subsequently introducing random label shuffling within a withheld set to create an edit set \(\{(x^{(i)}_{e},y^{(i)}_{e})_{i=1}^{N}\}\), where originally \(y^{(i)}\neq y^{(i)}_{e}\). Other works, such as Sotoudeh and Thakur (2021), introduce e.g. motion blur or fog (Mu and Gilmer, 2019) to corrupt a subset of the images, creating an edit set where originally \(x^{(i)}\neq x^{(i)}_{e}\).

Several datasets support knowledge editing experiments for this task, and a distinction is often made among "toy" and "large-scale" datasets. Widely acknowledged datasets such as MNIST (LeCun et al., 2010) and CIFAR-10 (Krizhevsky, 2009) are frequently employed for experimentation, and belong to the former category. The well-known MNIST dataset comprises 7,000 grayscale examples, each consisting of \(28\times 28\) images representing handwritten digits ranging from 0 to 9, with balanced support for each of the 10 classes. Similarly, the CIFAR-10 (Krizhevsky et al., 2009) dataset encompasses 60,000 examples of \(32\times 32\) RGB images divided across 10 balanced semantic classes, like airplanes and dogs. CIFAR-100 extends its diversity with 600,000 examples of \(32\times 32\) color images, distributed across 100 classes. While these datasets are occasionally considered as simplified instances for classification (Sinitsin et al., 2020; Lee et al., 2019), they serve as fundamental examples for understanding knowledge editing dynamics. For more challenging and realistic scenarios, researchers turn to larger scale datasets, of which the most popular is surely the extensive ImageNet Database (Deng et al., 2009), which now encompasses over 10 million labeled images, spanning more than 20,000 object categories. Specifically, studies such as (Sinitsin et al., 2020) and (Lee et al., 2019) delve into datasets derived from the ImageNet Large Scale Visual Recognition Challenges (ILSVRC) (Russakovsky et al., 2015). To further accentuate the complexity, (Sinitsin et al., 2020) introduces a highly challenging configuration, leveraging the Natural Adversarial Examples (NAE) dataset (Hendrycks et al., 2021), consisting of \(7500\) natural images notorious for their arduous classification nature, where pre-trained models exhibit correct prediction rates of less than \(1\%\) for NAEs.

Image InpaintingImage inpainting, also known as image completion, is the task of reconstructing missing regions in an image (Szeliski, 2022). The problem is formalized as a regression over functions mapping pixel coordinates within
\([0,1]^{2}\) to pixel values in \([0,1]\) (grayscale) or \([0,1]^{2}\) to pixel values in \([0,1]^{3}\) (RGB). This task has so far received less attention from the knowledge editing community (Garnelo et al., 2018), leveraging datasets that encompass both the MNIST dataset, once again serving as a rudimentary example, and the CelebFaces Attributes Dataset (CelebA) (Liu et al., 2015) for more challenging scenarios. The CelebA dataset presents a more demanding scenario, offering over 200,000 celebrity images, each accompanied by 40 attribute annotations, making it a challenging and comprehensive dataset for exploration.

### Natural Language Processing

Natural Language Processing (NLP) is also a broad field, concerned with giving computers the ability to process and understand human language (Eisenstein, 2019). Like in computer vision, in recent years researchers and practitioners in the field have leveraged the power of neural network with many outstanding results (Otter et al., 2020; Soltan et al., 2022; FitzGerald et al., 2022). With the recent paradigm shift from supervised learning to pre-training followed by fine-tuning (Wang et al., 2022), and the trend towards larger and larger models (Zhao et al., 2023), the ability to perform a cheap edit of a model instead of an expensive fine-tuning has motivated an intense interest from the knowledge editing community. Undoubtedly, within the NLP realm, the most widely targeted tasks for knowledge editing are Fact Checking when dealing with classification, and (closed book) Question Answering for language generation. Some recent works also explore open Text Generation, editing of factual relations with had hoc datasets and also Document Classification. Table 2 provides an overview of the datasets commonly used for those tasks.

Fact checkingFact-checking is the task of assessing whether claims made in written or spoken language are true, often addressed as a binary classification task (Guo et al., 2022). In this setting, examples are natural language claims coupled with binary labels, even though sometimes a third netural option is available. The claim \(x^{(i)}\) is encoded with some tokenization scheme (or pre-trained word embedding) as a sequence of integers (or semantic vectors), while the label \(y^{(i)}\) can take one of two values, positive or negative (optionally a third, aforementioned neutral value). One can then have a neural network predict this value with an explicit classification layer, or alternatively a language model producing special tokens (e.g. _True/False_ or _Supports/Refutes_) for the considered truth values, when prompted with the claim under consideration. The Fact Checking task has been considered particularly appealing for the knowledge editing community (De Cao et al., 2021; Mitchell et al., 2022, 2022; Huang et al., 2023) for at least a couple of reasons. First, the recent phenomenal success of language models also highlighted their proneness to generate reasonable but factually wrong natural language text (Ortega et al., 2021; Ji et al., 2023). This degrades the system performance and fails to meet user expectations in many real-world scenarios, leading to a great interest in the ability to mitigate these hallucinations. Furthermore, reasonable edit sets are fairly easy to obtain, e.g. randomly flipping the labels of claims from pre-existing datasets from Support to Refutes and vice-versa. The most widely used datasets for this task are FEVER (Thorne et al., 2018) and VitaminC (Schuster et al., 2021). Both of them are extracted from Wikipedia and annotated by human experts, to arrive at (_evidence_, _wikipage_, _claim_, _label_) tuples. In both cases, the label can be _Supports_, _Refutes_ or _Not Enough Info_ depending on whether the evidence supports or not the claim. To construct proper editing datasets \(\{(x^{(i)}_{e},y^{(i)}_{e})_{i=1}^{N}\}\) out of them, De Cao et al. (2021) (for FEVER) and Mitchell et al. (2022) (for VitaminC) grouped facts based on the same pages, augmented each fact \(x^{(i)}_{e}\) with some rephrases \(\bar{x}^{(i)}_{e}\), to assess generality, and randomly flipped the label \(y^{(i)}_{e}\neq y^{(i)}\) in each group.

Question AnsweringThe task of training a model to provide a correct natural language answer to a given question is referred to as question answering; more specifically, _closed-book_ question answering is restricted to the case when

\begin{table}
\begin{tabular}{l c c c c c} \hline \hline
**Dataset** & **Tasks** & **\# Examples** & **\# Classes** & **\# Channels** & **Resolution** \\ \hline MNIST & Classification, Inpainting & 70k & 10 & 1 & 28x28 \\ CIFAR-10 & Classification & 60k & 10 & 3 & 32x32 \\ CIFAR-100 & Classification & 600k & 100 & 3 & 32x32 \\ ILSVRC & Classification & 1.2 M & 1000+ & 3 & 224x224 + \\ ILSVRC & Classification & 1.2 M & 1000+ & 3 & 224x224 + \\ NAE & Classification & 7.5k & 200+ & 3 & 224x224 + \\ CelebA & Inpainting & 200k & - & 3 & 178x218 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Most important datasets used in Computer Vision for Knowledge editing. MNIST, CIFAR-10, CIFAR-100 are generally regarded as “toy” datasets while ILSVRC, NAE, CelebA as more challenging testbeds.
the model is only fed with the question, and not a selection of possible answers, or supporting corpus from which an answer can be extracted (Roberts et al., 2020). In this case, both the input \(x\) and the target label \(y\) are natural language sequences, and we test the extent to which the model parameters implicitly store the required knowledge to provide correct answers. The most widely adopted dataset is surely the zero-shot Relation Extraction dataset (zsRE) (Levy et al., 2017), used in particular by Zhu et al. (2020); De Cao et al. (2021); Mitchell et al. (2022, 2022); Meng et al. (2022, 2022); Huang et al. (2023); Hartvigsen et al. (2022). This task and dataset are particularly appealing for knowledge editing. Indeed, Question Answering can benefit greatly from Knowledge Editing, as pipelines that solve the task usually leverage factual knowledge to answer questions; in the case of neural networks, this knowledge is implicitly stored in the networks' parameters, and it is unclear how to tweak these parameters to correct wrong or undesired answers, especially as the networks grow bigger in size. Meng et al. (2022) hypothesize that this factual knowledge takes the form of _(relation, subject, object)_ triples, with intermediate layers acting as key-value storage units. This formalization lends itself nicely to the definition of an editing objective, rather than directly the open-ended natural language generation task. Furthermore, Levy et al. (2017) demonstrates that it is possible to reduce relation extraction to the problem of answering simple reading comprehension questions and provided in their dataset multiple templates for each relation. For example, the triple (_occupation, \(s\), \(o\)_) can be naturally extracted answering one of the following: _What did \(s\) do for a living?_, _What is \(s\)'s job? What is the profession of \(s\)?_. The subject \(s\) can then be modified to create editing examples. Beside zsRE, knowledge editing of models solving Question Answering has been studied leveraging also on additional datasets such as t-REX (Elsahar et al., 2018) and Natural Questions (NQ) (Kwiatkowski et al., 2019). Finally as a more challenging flavor of the same task with added counterfactual informations (Meng et al., 2022) introduced a new dataset called CounterFact.

Further NLP tasksBeside the two popular tasks outlined above, Mitchell et al. (2022) tested editing text generation from autoregressive GTP-like models on a special version of WikiText-103 (Merity et al., 2016), where they considering as prompts (\(x_{e}\)) passages sampled from WikiText itself and as edit targets (\(y_{e}\)) 10-token samples from a pre-trained distitiGPT-2 model. This was for them a valid challenging editing setup since for their target model for editing a greedy 10-token prediction agrees with these edit targets for \(<1\%\) of examples they extracted. Finally, more recently Hartvigsen et al. (2022) tested their methodology on a novel task for knowledge editing using the SCOTUS dataset from Chalkidis et al. (2022). The classification task is to categorize U.S. Supreme Court documents over multiple decades into \(11\) topics. What makes this task interesting is that, over time, categorization rules change, so that label distributions shift. We note how this is off the shelf particularly realistic for knowledge editing as much of the world knowledge memorized by networks evolves over time just like those labels shifts in the dataset and the target of knowledge editing can be seen as keeping updated such world knowledge.

### Other Applications

Even though the majority of works in the knowledge editing literature has focused on the Computer Vision and Natural Language Processing fields, as described above, the general nature of the editing problem yielded interesting results also in other fields, and will likely yield more in more diverse fields and applications in the years to come. Among these, to the best of our knowledge the most notable examples are applications in safety-critical scenarios, and to graph neural networks, and in the following we briefly review works from both.

Safety-critical SystemsSafety-critical systems are those systems whose failure may lead to consequences that are determined to be unacceptable, such as significant damage to properties, the environment, or people (Knight, 2002). Deep neural networks have grown in popularity over the past decade and are now being used in safety-critical domains

\begin{table}
\begin{tabular}{l l l l l} \hline \hline
**Dataset** & **Tasks** & **Format** & **\# Examples** & **\# Classes** \\ \hline FEVER & Fact Checking & (evidence, wikipage, claim, label) & 420k & 3 \\ VitaminC & Fact Checking & (evidence, wikipage, claim, label) & 450k & 3 \\ zsRE & Question Answering & (subject, relation, object) & 120M & - \\ T-REx & Question Answering & (subject, relation, object) & 11M & - \\ NQ & Question Answering & (question, answer) & 320k & - \\ CounterFact & Question Answering & (subject, relation, true object, false object) & 22k & - \\ Wikitext & Text Generation & tokens & 100M & - \\ SCOTUS & Document Classification & (date, text, label) & 9.2k & 11 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Most important datasets for knowledge editing used in NLP. We report characteristics of the original datasets even though often for knowledge editing ad hoc version, preprocessed to make editing meaningful are used.
such as self-driving cars (Gupta et al., 2021), healthcare (Tekkesin et al., 2019) and aviation (Sridhar, 2020). Clearly, in such critical scenarios being able to find and correct unsafe neural network behavior becomes a crucial objective. This has motivated a line of research within the Knowledge Editing community, that so far has only touched the aviation domain, specifically the aircraft collision avoidance problem. The systems currently employed provide safety guarantees at the cost of being poorly data efficient, and efforts have been made to integrate neural networks into the pipeline (Julian and Kochenderfer, 2019). As a consequence, a number of subsequent works (Sotoudeh and Thakur, 2021; Fu and Li, 2021; Liang et al., 2023) from the knowledge editing community have proposed approaches for fixing unsafe behavior of neural networks integrated in safety-critical pipelines.

Developing a robust collision avoidance algorithm that reliably prevents collision without alerting excessively is challenging due to sensor error and uncertainty in the future behavior of the aircraft. The Airborne Collision Avoidance System X (ACAS X) (Kochenderfer and Chryssanthacopoulos, 2011) family of collision avoidance systems formulates the problem of collision avoidance as a partially observable Markov decision process. The variant for unmanned aircraft, ACAS Xu, uses dynamic programming (DP) to then find a solution in terms of resolution advisories that avoid collisions while minimizing disruptive alerts. The DP process makes use of a very large lookup table, that makes storage costly and certification time-consuming for certified avionics systems. Therefore, Julian and Kochenderfer (2019) propose using a deep neural networks for compressing the table without loss of performance, as measured by a set of safety and operational metrics. The task is then to accurately regress the lookup table, that associates values to combinations of actions and state variables. There are 5 possible advisory actions and seven real-valued state variables that define an aircraft encounter; the state variables are discretized, forming an eight-dimensional score table with approximately 120 million discrete points. This, or a downsampled version of the table, defines the ACAS Xu dataset: \(\{(x^{(i)},y^{(i)})_{i=1}^{N}\}\) where \(x^{(i)}\in\mathbb{R}^{7}\) represents a (discretized) state, and \(y^{(i)}\in\mathbb{R}^{5}\) are the values associated to each of the five possible actions in that state. A set of edit examples is usually defined by considering certain desired properties, formally verified to not be globally satisfied for a network trained on the task (Katz et al., 2017), and taking as \(x_{e}\) samples that satisfy the _input constraint_ of the property, and as \(y_{e}\) samples that do not satisfy the _output constraint_ of the property.

Graph Neural NetworksDeep learning models have been particularly successful when dealing with signals such as speech, images, or video, in which there is an underlying Euclidean structure; however, recently there has been a growing interest in trying to apply learning on non-Euclidean geometric data, for instance represented in the form of graphs (Bronstein et al., 2017). Graph Neural Networks (GNNs) learn node representations by applying shared permutation invariant functions over local neighbourhoods of nodes in the graph (Bronstein et al., 2021). These representations can then be used for tasks like node classification for e.g. assigning a category to each paper in a citation graph (Wu et al., 2020). GNNs have achieved prominent results in learning features and topology of graph data, however, knowledge editing for GNNs is rarely explored, despite their widespread applicability; therefore, Liu et al. (2023) propose a method to edit these models, restricting to the aforementioned node classification task.

The task can be formalized as follows: let \(G=(V,E)\) be an undirected graph with \(V=(v_{1},\ldots,v_{|V|})\) and \(E=(e_{1},\ldots,e_{|E|})\) being the set of nodes and edges, respectively. Given a feature space \(\mathcal{X}\) (e.g. the space of real-valued \(d\)-dimensional feature vectors \(\mathbb{R}^{d}\)), a node feature tensor \(X\in\mathcal{X}^{|V|}\) and a label space \(\mathcal{Y}\), the goal is to learn a representation \(h_{v}\) from which a label \(y_{v}\in\mathcal{Y}\) for each node \(v\in V\) can be easily predicted. Many datasets for node classification exist in the literature, comprised of data from various domains like citation networks and social networks, and we find again the distinction between small-scale and large-scale datasets (Wu et al., 2020). Among the former we find datasets like Cora, which contains a selection of Machine Learning papers collected from the web, and the references automatically parsed from their bibliographies (McCallum et al., 2000). In particular, the network contains \(|V|=2708\) nodes (articles) and \(|E|=5429\) links (citations); the feature space is \(\mathcal{X}=\{0,1\}^{1433}\), i.e. each node is described in terms of the presence (or absence) of certain keywords, taken from a dictionary of 1433 unique words (bag-of-words content representation); the label space is \(\mathcal{Y}=\{1,\ldots,7\}\), i.e. the task is to predict to which of seven classes (e.g. _Theory_ or _Reinforcement_Learning_) each publication belongs. The Reddit dataset is instead a popular representative of large-scale node classification datasets. Hamilton et al. (2017). constructed a graph dataset from Reddit posts made in the month of September, 2014. The node label \(y_{v}\in\mathcal{Y}\) in this case is the community, or "subreddit"; that a post belongs to, considering \(|\mathcal{Y}=50\) large communities. A post-to-post graph is constructed connecting posts if the same user comments on both. In total this dataset contains \(|V|=\) 232,965 posts with an average degree of 492 (\(|E|\) is in the order of 100 millions edges). In both of these cases, and the many other instances of node classification datasets, constructing an edit dataset is fairly straightforward, and done in the same manner as for the image classification task in Computer Vision. After training the model \(f_{0}(\cdot)\) under consideration on a _subgraph_, one evaluates it on the whole graph: each pair \((x^{(i)},y^{(i)})\) such that \(\hat{y}^{(i)}=\arg\max f(x^{(i)})\) is incorrect, becomes an edit pair \((x^{(i)}_{e},y^{(i)}_{e})\). The geometry of graphs lends itself nicely to defining also generality and locality sets: indeed, since the task under consideration is node classification, as we have seen a single example \(x^{(i)}\) describes a node \(v\), then one can define its neighborhood \(N(x^{(i)})\)
to be its actual neighborhood in the graph \(N_{G}(v)=\{w\in V\mid\exists\left(v,w\right)\in E\}\); from this definition, the definitions of generality and locality sets follow immediately, as seen in earlier sections.

## 4 Knowledge Editing Methodologies

In recent times, several "knowledge editing" methods have been introduced to effectively modify the behaviors of models while maintaining their previous performance on the same task (Sinnitsin et al., 2020). These approaches draw inspiration from various fields of artificial intelligence research and encompass a range of methodologies, from straightforward fine-tuning with regularization techniques (Zhu et al., 2020) to meta-learning methods that utilize hypernetwork models to learn parameter updates (De Cao et al., 2021; Mitchell et al., 2022). In the upcoming sections, we will provide individual discussions on the different families of knowledge editing methodologies, emphasizing their respective areas of application, as well as the advantages and limitations of most notable techniques.

The objective of this section is to categorize various knowledge editing techniques discussed in the literature into distinct groups. Specifically, we can classify these approaches into four distinct families, namely: _regularization techniques_, _meta-learning_, _direct model editing_, and _architectural strategies_. All presented works have different characteristics, target different areas of application, types of edits, and adopt diverse experimentation strategies. Nevertheless, the objective of all the works reported can be formulated within the formal framework given in 2.2. A comparison between the most notable KE methodologies at the time of writing can be found in Table 3. On the other hand, Table 4 presents a comparison with non-sequential single batch edits of factual knowledge.

### Regularization Techniques

Catastrophic forgetting, (Kemker et al., 2018), is a well-known phenomenon in literature, fundamentally limiting the flexibility of editing networks once trained or fine-tuned, (Lee et al., 2019). Indeed, in the absence of any regularization process, the regular fine-tuning signal has the ability to easily execute a specific edit, albeit with a tendency to over-fit to the provided edit examples. However, this approach lacks in providing generality to the edit and has a negative impact on locality, owing to the absence of a plasticity mechanism, (Sinnitsin et al., 2020). Similar to continual learning, regularization techniques for knowledge editing aim to modify the standard fine-tuning signal of the target edit to ensure reliability and locality. Therefore, for regularization techniques, KE is not parametrized and does not require any pre-training, but it is nothing more than gradient descent computed with given edits and some specific regularization terms. While not all of these techniques were originally developed for the specific task of knowledge editing, they have

\begin{table}
\begin{tabular}{l l l l l l l l l} \hline \hline
**KE Methodology** & KE & Training & Preserves & Only & \multirow{2}{*}{SNS} & \multirow{2}{*}{BNS} & \multirow{2}{*}{SSE} & \multirow{2}{*}{BSE} & \multirow{2}{*}{
\begin{tabular}{c} Scales \\ to LM \\ \end{tabular} } \\  & Cathegory & Required & Architecture & & & & & & \\ \hline FT + \(L_{2}\) & Regularization & False & ✓ & ✗ & ✓ & ✓ & ✓ & ✗ \\ FT + KL & Regularization & False & ✓ & ✗ & ✓ & ✓ & ✓ & ✗ \\ EWC & Regularization & False & ✓ & ✗ & ✓ & ✓ & ✓ & ✓ & ✗ \\ CNP & Architectural & True & ✗ & ✓ & ✓ & ✓ & ✓ & ✓ & ✓ \\ ENN & Meta-Learning & True & ✗ & ✓ & ✓ & ✗ & ✓ & ✗ & ✗ \\ KnowledgeEditor & Meta-Learning & True & ✓ & ✓ & ✓ & ✗ & ✗ & ✗ & ✓ \\ MEND & Meta-Learning & True & ✓ & ✓ & ✓ & ✓ & ✗ & ✗ & ✓ \\ ROME & Direct Editing & False & ✓ & ✓ & ✗ & ✗ & ✗ & ✓ \\ MEMIT & Direct Editing & False & ✓ & ✗ & ✓ & ✓ & ✓ & ✓ & ✓ \\ SERAC & Architectural & True & ✗ & ✓ & ✓ & ✓ & ✓ & ✓ & ✓ \\ CaliNet & Architectural & True & ✓ & ✓ & ✓ & ✗ & ✗ & ✓ \\ T-Patcher & Architectural & False & ✗ & ✓ & ✓ & ✓ & ✗ & ✓ \\ GRACE & Architectural & True & ✗ & ✓ & ✓ & ✓ & ✓ & ✓ \\ \hline \hline \end{tabular}
\end{table}
Table 3: Comparison of the most notable KE methodologies in the literature. Different characteristics are reported for each approach, highlighting main advantages and disadvantages. For all approaches, we report: the category and whether it requires _training_ of an auxiliary model; if it _preserves the architecture_ of the edited model or requires the introduction of new components; whether it needs only the edit pair \((x_{e},y_{e})\), or requires additional input to perform the edit; if it is able to handle _single non-successive_ edits (SNS), _batched non-successive_ edits (BNS), _single successive_ edits (SSE), and _batched successive_ edits. Finally, we report if it can scale to Large Models (LM), that, following the definition in (Zhao et al., 2023), are models with more than 10B parameters.
proven to be in some way effective and are commonly used as useful baselines for comparison. Moreover, due to their simplicity, they can easily adapt to work with different types of edits: from single non-successive edits to batches of successive edits. However, depending on the number of layers fine-tuned, they rarely scale to models with large number of parameters such as Large Language Models (LLMs), that according to (Zhao et al., 2023) are models with more than 10B parameters.

For instance, authors in (Sotoudeh and Thakur, 2021) introduce a technique called "Neural Network Patching" that allows for the correction of deep neural networks without retraining from scratch. They present the concept of neural network patching, which involves identifying and correcting the faulty or damaged components of a network. The proposed method involves using a set of repair operators to identify and replace damaged components of the network, identifying the minimum \(L_{2}\) norm parameter update that reliably edits the model output, while minimizing the deviation from the original target model. Conversely, (Zhu et al., 2020) utilize a constrained optimization process instead of penalizing an updated model for deviating from the original one. Their method employs either an \(L_{2}\) or \(L_{\infty}\) constraint between the original model parameters and the edited ones, highlighting the importance of selecting a subset of parameters to be updated. Additionally, they demonstrate how their method is similar to Elastic Weight Consolidation (EWC), (Lee et al., 2019), which involves computing a penalty term for each weight in the neural network based on how much it contributes to the performance of the original task. Similarly to (Zhu et al., 2020), loss enriched with the Kullback-Leibler divergence (KL) have been proposed in order to regularize the network's weights based on the KL divergence between the network's output on the old task and the network's output on the new task. This encourages the network to maintain similar weights for the parts of the network that are relevant to both tasks (Yoon et al., 2017; Serra et al., 2018; Mitchell et al., 2022; Huang et al., 2023).

As previously mentioned, the techniques outlined in this section have been primarily utilized as baseline approaches in knowledge editing and heavily intersect with continual learning works (Mundt et al., 2023). However, in various experiments cited in (De Cao et al., 2021; Mitchell et al., 2022; Huang et al., 2023), these techniques have demonstrated limited efficacy in maintaining model accuracy with regards to previous knowledge. In fact, as noted by (De Cao et al., 2021), regularization techniques overlook the highly nonlinear nature of large models and the significant impact that even minor changes in parameter space can have on the output of numerous data points. For those reasons, more elaborated works have been proposed in literature as the ones in the following sections.

### Meta-Learning and HyperNetworks

Meta-learning techniques refer to a set of algorithms and approaches that enable machines to learn how to learn, (Finn et al., 2017). Meta-learning techniques have been applied to a range of applications, such as computer vision (Ren et al., 2018), natural language processing (Gu et al., 2020), robotics (Finn et al., 2017), and reinforcement learning (Houthooft et al., 2018). They have shown promising results in improving the efficiency and effectiveness of machine learning systems and enabling machines to learn more autonomously.

They can be broadly categorized into two types: _model-based_ and _optimization-based_ meta-learning. In the context of knowledge editing, model-based meta-learning focus on learning a model that can be used to adapt to new data efficiently. This involves learning the structure of the model and its parameters such that it can be generalized to new data. In optimization-based meta-learning, the focus is on learning how to optimize the parameters of a model to adapt to new knowledge.

\begin{table}
\begin{tabular}{l l l l l l l l l l} \hline \hline Dataset & Model & 
\begin{tabular}{c} Evaluation \\ Metrics \\ \end{tabular} & FT & KE & MEND & ROME & MEMIT & SERAC & T-Patcher \\ \hline \multirow{3}{*}{\(\text{zsRE}\)} & SR & 54.70 & 6.60 & 45.60 & 99.18 & 99.23 & 90.16 & 97.12 \\  & GR & 49.20 & 7.80 & 48.00 & 94.90 & 87.16 & 89.96 & 94.95 \\ \cline{1-1}  & \multirow{3}{*}{GPT-J [6B]} & DD & 62.76 & 5.82 & 11.79 & 0 & 0 & 0.1 & 3.76 \\ \cline{1-1}  & & SR & 99.90 & 13.40 & 73.80 & 99.80 & 99.90 & 99.78 & 100.00 \\ \cline{1-1} CounterFact & & GR & 97.53 & 11.00 & 74.20 & 86.63 & 73.13 & 99.41 & 83.98 \\ \cline{1-1}  & & DD & 98.98 & 5.62 & 96.25 & 0 & 0 & 1.11 & 91.63 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Comparison of some of the most notable KE methodologies on zSRE (Levy et al., 2017) and CenterFact (Meng et al., 2022) with non-sequential single batch edits of factual knowledge. For each methodology, we report success rate (SR), generalization rate (GR), and Drawdown (DD) metrics. Results adapted from (Yao et al., 2023).
In literature, authors of "Editable Neural Networks" (ENN), (Sinitsin et al., 2020), firstly exploit the meta-learning paradigm for knowledge editing to "learn to allow effective editing". The core idea behind "Editable Training" is to enforce the model parameters to be "prepared" for the editor function KE (Section 2.2), that in their experimentation is defined as Stochastic Gradient Descent (SGD) with up to \(k\) steps and learning rate \(\alpha\). In particular, they propose to train the starting model \(f_{0}\) with a loss that at the same time encourages reliability and locality. That is obtained with two additional terms to the base loss, one that measures the success of an edit, cross-entropy, and another that assess the distance in the output probability between the edited model and the original one, KL divergence. They prove to be successful on either computer vision datasets for classification (Krizhevsky et al., 2009; Deng et al., 2009) and Natural Adversarial Examples (NAE) (Hendrycks et al., 2021) and machine translation (Cettolo et al., 2014). They work with single non-successive and successive edits, with good performances on both types of edits. Nevertheless, as pointed out by (Mitchell et al., 2022), the methodology requires to further training the base model before an edit with a pre-training step. That can be critical in scenarios with large models (LM) or when the memory available is a constraint.

Conversely, (De Cao et al., 2021) they propose an optimization-based meta-learning, firstly employing a hypernetwork (Ha et al., 2016) dubbed KnowleEditor with the objective to "learn to update" the parameters of another network. Therefore, since the knowledge editing task requires being locale except for the edit, they frame the learning task as a constrained optimization problem using a Bidirectional-LSTM (Schmidhuber et al., 1997) and some downstream Feed-Forward Neural Networks (FFNN). Once trained, only the input edit feed the hypernetwork that predicts vectors to gate and shift the edit fine-tuning gradient of the starting network in respect to a certain weight matrix. Therefore, we can say that KnowledgeEditor learns how to modify the gradient in order to provide the property enumerated in Section 2.4. On the other hand, the training itself of the hypernetwork does not change the weights of the starting model as (Sinitsin et al., 2020), but requires some original training samples to estimate the original output probability distribution. Indeed, as (Sinitsin et al., 2020), the hypernetwork is trained with the sum of two loss components: the first one aims at providing reliability and generality with cross-entropy between semantically equivalent edits and predictions of the edited model and the second one provides locality with the KL divergence as (Sinitsin et al., 2020). However, in addition to them, they propose to add a margin to KL and iteratively reduce it to progressively make the edit more local. They test their KnowledgeEditor on different NLP tasks, from fact-checking (FC) with a fine-tuned BERT model (Devlin et al., 2018) with the FEVER dataset (Thorne et al., 2018), to closed book question answering (QA) with BART model (Lewis et al., 2020) on the Zero-Shot Relation Extraction (zsRE) dataset (Levy et al., 2017). However, they only experimented with single non-successive changes. Nevertheless, authors of (Huang et al., 2023) adopt KnowledgeEditor as a baseline and their experiments on FEVER and zsRE show that it fails to implement more than a couple of successive single edits. Indeed, as hypothesized by the authors, KnowledgeEditor hypernetwork is trained with the starting model \(f_{0}\) and thus strongly coupled with the original parameters. As the editing proceeds, the model becomes more different from the initial one, resulting in their failure.

Building over (De Cao et al., 2021), authors of (Mitchell et al., 2022) leverage on hypernetworks too in order to learn how to update weights of a starting model. However, while KnowledgeEditor trains a recurrent neural network to map the edit example into a rank-1 mask over the gradient, (Mitchell et al., 2022) hypernetwork, named MEND, directly maps the gradient into a new parameter update, retaining tractability by leveraging the low-rank form of the gradient. Indeed, the input of a MEND network is a decomposed gradient and the output is formed by some pseudoactivations and psudodelta that should encapsulate, reliability, generality, and locality. Indeed, as (De Cao et al., 2021), they make use of cross-entropy between semantically equivalent edits and predictions of the edited model to enforce generability and reliability (edit loss), and KL divergence for locality without the margin (locality loss). In addition, they propose two further hyperparameters to perform a weighted sum of the two losses and to make learnable the edit learning rate coefficient. Each layer of the network itself consists of two consecutive blocks, both initialized to compute the exact identity function of the normalized decomposed gradient, using four matrices initialized with zero or Xavier uniform initialization (Glorot and Bengio, 2010). Finally, in order to edit multiple layers of the starting model with same matrices dimension, they propose to use the same MEND network, while applying a learned layer-specific scale and offset similar to (Perez et al., 2018). As (De Cao et al., 2021), they experiment their methodology only with NLP tasks using FEVER (Thorne et al., 2018) and zsRE (Levy et al., 2017) datasets. In addition, they also experiment with GPT-style models, (Radford et al., 2018), working with a custom version of Wikitext-103 (Merity et al., 2016), named Wikitext Generation. They both experiment with non-sequential single or batch types of edits, showing large regression over 100 simultaneous edits. Finally, it is important to point out that as KnowledgeEditor, also MEND has the same limitations with successive edits, being strictly tied to the weights of the starting model. In fact, if pre-training is conducted on \(f_{t}\), KE will exhibit significantly poorer performance with \(f_{t+1}\). Moreover, as the weights of the edited model diverge from those of the pre-training, MEND will gradually deteriorate, ultimately losing all its editing capabilities.
### Direct Model Editing

This family of approaches aims to edit the weights within the target neural network directly, enabling effective implementation of a predefined set of changes. By directly manipulating the variables of a model, most of the direct model editing methodologies build upon efforts to localize and understand the internal mechanisms within models (Ehlage et al., 2021; Dar et al., 2023). These approaches strive to attribute knowledge to specific neurons in the network and edit their activations to reflect the desired changes (Mitchell et al., 2022). Furthermore, owing to the tightly coupled nature of these approaches with the network architecture, the majority of research has been focused on specific architectures, such as MLP and Transformers. As a result, the validation of their effectiveness on alternative architectures is usually left to future endeavors.

Geva, Mor, et al. (Tay et al., 2022), firstly identify the MLP layers in a masked LM transformer as key-value memories of entities and information associated with that entity, (Sukhbaatar et al., 2015). Building on this finding, (Dai et al., 2022) demonstrate a method to edit facts in BERT models (Devlin et al., 2018); they propose the concept of knowledge neurons to study how factual knowledge is stored in pretrained Transformers. Specifically, the authors examine the fill-in-the-blank cloze task for BERT and propose a knowledge attribution method to identify the neurons that express a given relational fact. They find that the activation of such knowledge neurons is positively correlated to the expression of their corresponding facts. Therefore, they present a preliminary methodology that leverages knowledge neurons to edit factual knowledge in Transformers, even without any fine-tuning. The authors perform a knowledge surgery for pretrained Transformers by directly modifying the corresponding parameters in feed-forward networks. Such surgery shows promising results, keeping a moderate influence on other knowledge. The methodology proposed can be used to perform both single and multiple edits at the same time. However, the authors only experimented with single edits in their paper, focusing on specifically on factual knowledge.

Factual knowledge is also the focus of Meng Kevin, et al. work, (Meng et al., 2022), but exclusively experimenting on autoregressive language modelling, such as GPT-style models, (Radford et al., 2018). The study explores the storage and direct manipulation of factual associations in transformer models. These associations are modeled as tuples, represented as \(t=(s,r,o)\), comprising a subject \(s\), a relation \(r\), and an object \(o\), which connect to form a factual relationship. The research delves into understanding how these tuples are stored within transformer models and investigates methods to facilitate their direct editing. Firstly, they trace the causal effects of hidden state activations within GPT using causal mediation analysis (Pearl, 2001) as previously done by other works (Vig et al., 2020) to identify the specific modules that mediate recall of a fact about a subject. Their analysis reveals that feedforward MLPs at a range of middle layers are decisive when processing the last token of the subject name. Secondly, they test their previous findings by introducing a novel direct model editing methodology: Rank-One Model Editing method (ROME). The algorithm aims at producing single, not successive edits by altering the parameters that determine a feedforward layer's behavior. As stated by the authors, despite the simplicity of the intervention, ROME is similarly effective to other model-editing approaches achieving good generalization and locality simultaneously, whereas previous approaches sacrifice one or the other. Furthermore, they introduce a new dataset, CounterFact (derived from a set of true facts from WikiData), for evaluating counterfactual edits in language models. It contains 21,919 records with a diverse set of subjects, relations,

Figure 2: Scaling curves showing three different evaluation metrics with an increased number of non-successive batch edits for three different KE methodologies: MEND, ROME, and MEMIT. Results are computed using CounterFact and GPT-J. Locality is shown not as drawdown (DD), but as its complementary specificity over a neighborhood of samples (Meng et al., 2022). ROME and MEND performs well up to ten edits, but rapidly degrade, losing almost all SR before batches of 1k. On the other hand, MEMIT performs well with considerable large batches of edits. Adapted from (Meng et al., 2022).
and linguistic variations. Finally, they propose to monitor a further metrics, _fluency_, to evaluate text generation's repetitiveness by measuring the weighted average of bi- and tri-gram entropies (Zhang et al., 2018).

ROME results are comparable with other knowledge editing meta-learning techniques. Nevertheless, the methodology is limited to work with single non-successive edits. To address this problem, the same authors modified the original algorithm to overcome this problem (Meng et al., 2022). The method, called MEMIT, is able to scale up to thousands of associations for GPT-J (6B) and GPT-NeoX (20B), exceeding prior work by an order of magnitude. As ROME, MEMIT works by first identifying the critical layers in the LLM that are responsible for storing the memories that need to be updated. Then, it uses a rank-one modification of the MLP weights of these layers to directly write the new memories into the model. This process is repeated for each memory that needs to be updated. The authors evaluated MEMIT on a variety of tasks, including factual question answering, natural language inference, and summarization. They found that MEMIT was able to significantly improve the performance of the LLM on these tasks, even when the number of memories that were updated was large. In addition to its scalability, MEMIT also has several other advantages over previous methods for updating LLMs. First, it is relatively efficient, requiring only a few minutes to update a large model with thousands of memories. Second, it is very accurate, with the updated models achieving near-perfect accuracy on the tasks that were evaluated. Third, MEMIT is generalizable, with the updated models able to perform well on a variety of tasks. Figure 2 compares ROME, MEMIT, and one of the meta-learning techniques described in section 4.2. It is possible to appreciate the improvement brought with MEMIT and the clear collapse of the MEND HyperNetwork-based editor with large batches. Overall, MEMIT is a valuable tool for improving the performance of these models. However, it is important to point out that, even if there are works that try to expand the scope of the methodology (Gupta et al., 2023), MEMIT is limited to modifying factual association and that there is not a clear path to scale it to different skills. Furthermore, more recent research is suggesting that casual tracing for picking which parameters to update is surprisingly unreliable (Hase et al., 2023).

### Architectural Strategies

Within this family of methodologies, we find approaches that stand apart from the ones that directly or indirectly modify the weights of the target model. Instead, they focus on manipulating or augmenting the original architecture to patch and modify the network's existing knowledge. In particular setups this can be preferable because the set of original weights cannot be accessible.

A first editor function of this type was proposed by (Sinitsin et al., 2020), that taking inspiration from Conditional Neural Processes (CNP) (Garnelo et al., 2018), they propose a specialized architecture that performs edits by adding a special condition vector to intermediate activations. The vector is generated by an additional encoder layer and provides information to effectively steer the final prediction of the network. This approach is very similar to more generic memory-augmented models that introduce memory mechanisms to enhance neural networks (Graves et al., 2014; Santoro et al., 2016). On the same line of experimentation, Mitchell et al. (Mitchell et al., 2022) proposed an approach, called SERAC (Semi-Parametric Editing with a Retrieval-Augmented Counterfactual Model), which stores edits in an explicit memory and learns to reason over them to modulate the base model's predictions as needed. This allows SERAC to be more expressive than other model editors, and to produce more accurate predictions for test inputs that are not closely related to the edit. That is achieved using three components: a memory, a classifier, and a counterfactual model. Users adds edit in the memory and the classifier decides whether the memory contains inputs relevant to processing them. If the classifier determines that a relevant edit example exists, the input and edit example are passed to the counterfactual model that is responsible for making the prediction. They evaluate SERAC on numerous tasks, focusing exclusively on large language models with single and batch non-successive edits.

On the same line of SERAC, authors of (Dong et al., 2022) presented a memory-based methodology called CaliNet. It is a method for calibrating specifically factual knowledge in pretrained language models (PLM) without re-training from scratch. CaliNet first detects whether a PLM has learned a fact correctly by comparing its scores for the correct fact and a set of distractor facts. If the PLM has not learned the fact correctly, CaliNet then uses a lightweight method to add and adapt new parameters to the PLM for that specific fact. CaliNet has two main components: first, a contrastive knowledge assessment (CKA) module that detects whether a PLM has learned a fact correctly. The CKA module works by comparing the PLM's scores for the correct fact and a set of distractor facts. If the PLM assigns a higher score to the correct fact than to the distractor facts, then the CKA module concludes that the PLM has learned the fact correctly. Secondly, a factual knowledge calibration (FKC) module adds and adapts new parameters to the PLM for a specific fact. The FKC module works by first creating a new set of parameters for the PLM that are specific to the given fact. These new parameters are then initialized with the PLM's original parameters for the fact. The FKC module then fine-tunes the new parameters on a dataset of factual examples that include the given fact. Using a custom dataset based on ParaRel set (Elazar et al., 2021), CaliNet has shown to be effective at calibrating factual knowledge in PLMs. In experiments on the knowledge probing task, CaliNet was able to improve the factual accuracy of PLMs by up to 20%.
All previous works have tackled only non-successive edits, making only one edit or batch of edits at a time. However, as pointed out by (Huang et al., 2023), the one-mistake-fixing scenario is not an accurate abstraction of the real-world challenge. Therefore, they extend the scenario into successive edits, introducing a novel model editor, Transformer-Patcher (T-Patcher), that can shift the behavior of transformer-based models by simply adding and training a few neurons in the last Feed-Forward Network layer. Being at the end of the model, the new neurons have access to the output of all the previous layers. This allows the new neurons to learn how to correct mistakes that are made in earlier layers of the model. Overall the proposed methodology allows for targeted shifts in the behavior of the model, akin to other fine-tuned oriented methodologies like LoRA (Hu et al., 2022). Transformer-Patcher is able to successively correct up to thousands of errors while generalizing to their equivalent inputs and retaining the model's accuracy on irrelevant inputs. This is in contrast to previous methods, which either fail to make a sequence of edits or to remember previous edits. The work evaluates Transformer-Patcher on both classification and generation tasks, showing that Transformer-Patcher can achieve state-of-the-art performance for single successive edits. However, despite the expansive scope of the methodology, their approach and implementation are highly architecture-specific, relying heavily also on large sources of data and unrelated inputs.

To this end Hartvigsen, Thomas, et al. (Hartvigsen et al., 2022), proposes GRACE, a methodology that requires only samples of the edits and that can perform successive edits, ensuring minimal impact on unrelated inputs. GRACE works by caching a chosen layer's activations in an adaptive codebook as edits stream in. When a new edit is received, GRACE retrieves the corresponding activations from the codebook and uses them to update the model's predictions. This allows GRACE to make targeted edits to the model's behavior without affecting its overall performance. The authors evaluated GRACE on a variety of tasks, including text classification, natural language inference, and question answering. They showed that GRACE was able to significantly improve the performance of LLMs on streaming errors, while minimally affecting their performance on unrelated inputs. Finally, the authors do not explicitly mention the impact of GRACE on latency. However, it is possible that GRACE could have a small impact on latency, as it requires caching activations in an adaptive codebook.

## 5 Conclusion and Future Directions

In this survey, we organize recent progress of the increasingly growing field of knowledge editing. We began formalizing it under a common definition that seamlessly connect the slightly different facets of each work presented in the literature so far. Indeed, being a very recent branch of research, each author tried to differently bend definitions to better accommodate their methodologies. So, following the first definitions given by (Sinitsin et al., 2020) and the more recent adaptation by (Huang et al., 2023), we formally define knowledge editing as the task of modifying the knowledge of a target model in a non-sequential or sequential manner, without significantly affecting its original performance. This makes knowledge editing closely related to the much more well-known branch of continuous learning, or lifelong learning. In fact, knowledge editing can be seen as a restricted case of continuous learning, (Mundt et al., 2023), in which we want to apply edits, usually non uniformly distributed (Henn et al., 2021), to previously acquired knowledge by the network. Continuous learning, on the other hand, is broader in scope, looking for general methodologies to provide increasingly more knowledge to a network, enabling it to perform more tasks and skills. Nevertheless, despite their differences, the two groups are closely related and share common problems, such as catastrophic forgetting (Ratcliff, 1990). This means that there is potential for benefits to flow from both groups to each other.

Building on the more formal definition, we presented a distilled summary of the most relevant works in the literature at the time of writing. We proposed to categorize these works into four families: regularization techniques, meta-learning, direct model editing, and architectural strategies. We discussed each family in turn, highlighting their intrinsic characteristics and limitations. We also summarized the most frequent field of application, tasks, and datasets that have been tackled in each family, for quick reference. We did not specifically delve into the works where knowledge editing could emerge as an additional benefit of the proposed methodologies (Hewitt et al., 2023) but it is worth noting that future expansions of similar survey research could encompass these aspects for a more comprehensive analysis.

Overall, we have presented a rapidly expanding field of research driven by the current trend of foundational models (Zhou et al., 2023). The advancements in this area have led to a significant increase in the development of tools and methodologies to effectively harness the intrinsic knowledge of these models. As we move forward, knowledge editing is poised to become a critical factor in leveraging the power of these models for various industrial applications.

Finally, it is vital to acknowledge that the power of knowledge editing also brings inherent risks that must not be overlooked. While editing models can correct their behavior and improve their utility, it can also be exploited for harmful purposes. In particular, sophisticated editing algorithms may enable malicious actors to deliberately incorporate backdoors, vulnerabilities, hidden behaviors, or harmful tendencies into the models. This concern becomes even more critical for methodologies that edit weights without providing sufficient interpretability of the applied changes. This
dual use is a common risk for many machine learning technologies, and only proactive efforts to develop robust security measures and ethical guidelines can help to mitigate these potential risks.
