Original: T RANSFORMER -P ATCHER : O NE M ISTAKE WORTH O NE N EURON
Revised: T RANSFORMER -P ATCHER : O NE M ISTAKE WORTH O NE N EURON

Original: Anonymous authors

Original: Paper under double-blind review

Original: A BSTRACT
Revised: A BSTRACT

Original: Large Transformer-based Pretrained Language Models (PLMs) dominate almost all Natural Language Processing (NLP) tasks.
Revised: Large Transformer-based Pretrained Language Models (PLMs) dominate almost all Natural Language Processing (NLP) tasks.

Original: Nevertheless, they still make mistakes from time to time.
Revised: Nevertheless, they still make mistakes from time to time.

Original: For a model deployed in an industrial environment, fixing these mistakes quickly and robustly is vital to improve user experiences.
Revised: For a model deployed in an industrial environment, fixing these mistakes quickly and robustly is vital to improve user experiences.

Original: Previous works formalize such problems as Model Editing (ME) and mostly focus on fixing one mistake.
Revised: Previous works formalize such problems as Model Editing (ME) and mostly focus on fixing one mistake.

Original: However, the one-mistake-fixing scenario is not an accurate abstraction of the real-world challenge.
Revised: However, the one-mistake-fixing scenario is not an accurate abstraction of the real-world challenge.

Original: In the deployment of AI services, there are ever-emerging mistakes, and the same mistake may recur if not corrected in time.
Revised: In the deployment of AI services, there are ever-emerging mistakes, and the same mistake may recur if not corrected in time.

Original: Thus a preferable solution is to rectify the mistakes as soon as they appear nonstop.
Revised: Thus a preferable solution is to rectify the mistakes as soon as they appear nonstop.

Original: Therefore, we extend the existing ME intothe Sequential Model Editing (SME) to help develop more practical editing methods.
Revised: Therefore, we extend the existing ME into Sequential Model Editing (SME) to help develop more practical editing methods.

Original: Our study shows that most current ME methods could yield unsatisfying results in this scenario.
Revised: Our study shows that most current ME methods could yield unsatisfying results in this scenario.

Original: We then introduce Transformer-Patcher, a novel model editor that can shift the behavior of transformer-based models by simply adding and training a few neurons in the last Feed-Forward Network layer.
Revised: We then introduce Transformer-Patcher, a novel model editor that can shift the behavior of transformer-based models by simply adding and training a few neurons in the last Feed-Forward Network layer.

Original: Experimental results on both classification and generation tasks show that Transformer-Patcher can successively correct up to thousands of errors ( Reliability ) and generalize to their equivalent inputs ( Generality ) while retaining the model’s accuracy on irrelevant inputs ( Locality ).
Revised: Experimental results on both classification and generation tasks show that Transformer-Patcher can successively correct up to thousands of errors ( Reliability ) and generalize to their equivalent inputs ( Generality ) while retaining the model’s accuracy on irrelevant inputs ( Locality ).

Original: Our method outperforms previous fine-tuning and HyperNetwork-based methods and achieves state-of-the-art performance for Sequential Model Editing (SME).
Revised: Our method outperforms previous fine-tuning and HyperNetwork-based methods and achieves state-of-the-art performance for Sequential Model Editing (SME).

Revised: The code is available at https://github.com/ZeroYuHuang/Transform er-Patcher .

Original:  I NTRODUCTION
Revised:  I NTRODUCTION

Original: Transformer-based models, particularly large Pretrained Language Models (PLMs) (Devlin et al., 2019; Brown et al., 2020) have become the backbone model of modern Natural Language Processing (NLP) and have enabled promising results in various downstream tasks (Lv et al., 2019;
Revised: Transformer-based models, particularly large Pretrained Language Models (PLMs) (Devlin et al., 2019; Brown et al., 2020) have become the backbone model of modern Natural Language Processing (NLP) and have enabled promising results in various downstream tasks (Lv et al., 2019;

Original: Budzianowski & Vulic, 2019; Ramnath et al., 2020).
Revised: Budzianowski & Vulic, 2019; Ramnath et al., 2020).

Original: However, PLMs still produce undesirable outputs occasionally (Zhao et al., 2019; Basta et al., 2021).
Revised: However, PLMs still produce undesirable outputs occasionally (Zhao et al., 2019; Basta et al., 2021).

Original: The cost of such mistakes is non-negligible.
Revised: The cost of such mistakes is non-negligible.

Original: For example, a mistaken automatic translation result could get a person arrested (Hern, 2018).
Revised: For example, a mistaken automatic translation result could get a person arrested (Hern, 2018).

Original: One of the most usual expedients was using a manual cache (e.g., lookup table) to overrule these problematic predictions (Sinitsin et al., 2020).
Revised: One of the most usual expedients was using a manual cache (e.g., lookup table) to overrule these problematic predictions (Sinitsin et al., 2020).

Original: Though convenient and straightforward, it lacks robustness and generality because it could be disabled by the slightest change in the input, such as paraphrasing in natural language.
Revised: Though convenient and straightforward, it lacks robustness and generality because it could be disabled by the slightest change in the input, such as paraphrasing in natural language.

Original: On the other hand, one can also re-train the model on the original dataset supplemented with problematic examples.
Revised: On the other hand, one can also re-train the model on the original dataset supplemented with problematic examples.

Original: While superior in performance, it is computationally and temporally expensive to re-train large PLMs with billions or even trillions of parameters.
Revised: While superior in performance, it is computationally and temporally expensive to re-train large PLMs with billions or even trillions of parameters.

Original: Previous research formalized such problems as Model Editing (ME) and proposed various methods to intervene model’s behavior on a specific example while preventing the model from forgetting other examples.
Revised: Previous research formalized such problems as Model Editing (ME) and proposed various methods to intervene model’s behavior on a specific example while preventing the model from forgetting other examples.

Original: Some straightly finetune the model on the example and used a constraint loss to maintain the model’s overall performance (Zhu et al., 2020; Sotoudeh & Thakur, 2021).
Revised: Some straightly finetune the model on the example and used a constraint loss to maintain the model’s overall performance (Zhu et al., 2020; Sotoudeh & Thakur, 2021).

Original: Some edit the model through a HyperNetwork, which regards the model and the false predicted example as inputs and produced a weight update for the model’s parameters (Cao et al., 2021; Sinitsin et al., 2020; Mitchell et al., 2022a).
Revised: Some edit the model through a HyperNetwork, which regards the model and the false predicted example as inputs and produced a weight update for the model’s parameters (Cao et al., 2021; Sinitsin et al., 2020; Mitchell et al., 2022a).

Original: Despite their impressive progress, they mostly focus on one-step editing (fixing one mistake), which is not applicable for the practical situation.
Revised: Despite their impressive progress, they mostly focus on one-step editing (fixing one mistake), which is not applicable to practical situations.

Original: Because a model deployed for real-world applications are expected to face different errors ceaselessly.
Revised: Because models deployed for real-world applications are expected to face different errors ceaselessly.

Original: And the same error may pop up repeatedly and bother different users.
Revised: And the same error may pop up repeatedly and bother different users.

Original: In addition, as illustrated in Figure 1, once a wrong answer appears in an online question-answering (QA) model, leaving it unfixed and waiting for future corrections could mislead more people.
Revised: In addition, as illustrated in Figure 1, once a wrong answer appears in an online question-answering (QA) model, leaving it unfixed and waiting for future corrections could mislead more people.

Original: Therefore, an ideal model editor should provide continuous and promptly fixing of newly emerged mistakes in a both effective and efficient manner.
Revised: Therefore, an ideal model editor should provide continuous and promptly fixing of newly emerged mistakes in an effective and efficient manner.

Original: 2022/11/11 19: 图片 4.svg file:///C:/Users/ 黄泽宇 /Desktop/ 图片 4.svg 1/ Instant correcon improves user experience
Revised: [Figure]

Original: The slower the ﬁxing, the more users arebothered A QA model
Revised: The slower the ﬁxing, the more users are

Original: [Figure]
Revised: [Figure]

Original: Thus we extend the ME task into the sequential setting and formalize it as Sequential Model Editing (SME) task, which requires a model editor to fix a series of mistakes as soon as they appear.
Revised: Thus we extend the ME task into the sequential setting and formalize it as Sequential Model Editing (SME) task, which requires a model editor to fix a series of mistakes as soon as they appear.

Original: The desiderata of a qualified sequential model editor are three properties (Section 3).
Revised: The desiderata of a qualified sequential model editor are three properties (Section 3).

Original: For each editing, the post-edit model should be of 1) Reliability : make the desirable output given the input; 2) Generality : generalize over other equivalent inputs; 3) Locality : retain its accuracy over irrelevant inputs.
Revised: For each editing, the post-edit model should be of 1) Reliability : make the desirable output given the input; 2) Generality : generalize over other equivalent inputs; 3) Locality : retain its accuracy over irrelevant inputs.

Original: We then propose a standard SME experiment pipeline that is compatible with different tasks and five evaluation metrics to evaluate the three properties.
Revised: We then propose a standard SME experiment pipeline that is compatible with different tasks and five evaluation metrics to evaluate the three properties.

Original: Experiments show that most existing model editors could fail to generalize to the sequential editing scenario.
Revised: Experiments show that most existing model editors could fail to generalize to the sequential editing scenario.

Original: Fine-tuning-based methods are vulnerable to forgetting previous edits.
Revised: Fine-tuning-based methods are vulnerable to forgetting previous edits.

Original: HyperNetwork-based editors are strongly coupled with the initial model that they are trained with, thus failing to edit the model after several steps (Section 5).
Revised: HyperNetwork-based editors are strongly coupled with the initial model that they are trained with, thus failing to edit the model after several steps (Section 5).

Original: To handle SME, we introduce Transformer-Patcher.
Revised: To handle SME, we introduce Transformer-Patcher.

Original: Unlike previous methods, Transformer-Patcher retains all original parameters to prevent harming the model’s overall performance.
Revised: Unlike previous methods, Transformer-Patcher retains all original parameters to prevent harming the model’s overall performance.

Original: It only adds a handful of trainable neurons (patches) to the last Feed-Forward Network (FFN) layer to revise the model’s behavior on the problematic input and achieve a low editing cost.
Revised: It only adds a handful of trainable neurons (patches) to the last Feed-Forward Network (FFN) layer to revise the model’s behavior on the problematic input and achieve a low editing cost.

Original: Furthermore, we train the patch to only respond to specific inputs with the proposed activation loss and memory loss.
Revised: Furthermore, we train the patch to only respond to specific inputs with the proposed activation loss and memory loss.

Original: Experimental results on fact-checking (classification) and question answering (auto-regressive generation) indicated that Transformer-Patcher could rectify a series of mistakes (up to thousands) while almost perfectly retaining the model’s overall performance.
Revised: Experimental results on fact-checking (classification) and question answering (auto-regressive generation) indicated that Transformer-Patcher could rectify a series of mistakes (up to thousands) while almost perfectly retaining the model’s overall performance.

Original: The main contributions of this work are twofold: 1) We formally propose a sequential model editing task, as well as its standard experiment pipeline and evaluation metrics.
Revised: The main contributions of this work are twofold: 1) We formally propose a sequential model editing task, as well as its standard experiment pipeline and evaluation metrics.

Original: We introduce
Revised: We introduce

Original: Transformer-Patcher, a simple yet effective model editor to revise transformer-based PLMs, achieving state-of-the-art SME performance.
Revised: Transformer-Patcher, a simple yet effective model editor to revise transformer-based PLMs, achieving state-of-the-art SME performance.

Original:  R ELATED WORKS
Revised:  R ELATED WORKS

Original: Feed-forward Network Both transformer encoder and decoder contain the Feed-Forward Network (FFN).
Revised: Feed-forward Network Both the Transformer encoder and decoder contain the Feed-Forward Network (FFN).

Original: Recent works (Geva et al., 2021; Dai et al., 2021) analogously observed that FFN operates as key-value neural memories (Sukhbaatar et al., 2015).
Revised: Recent works (Geva et al., 2021; Dai et al., 2022) analogously observed that FFN operates as key-value neural memories (Sukhbaatar et al., 2015).

Original: They regarded the input of FFN as a query, the first layer as keys, and the second as values.
Revised: They regarded the input of FFN as a query, the first layer as keys, and the second as values.

Original: Thus the intermediate hidden dimension of FFN can be interpreted as the number of memories in the layer, and the intermediate hidden state is a vector containing activation values for each memory.
Revised: Thus the intermediate hidden dimension of FFN can be interpreted as the number of memories in the layer, and the intermediate hidden state is a vector containing activation values for each memory.

Original: Therefore, the final output of FFN can be viewed as the weighted sum of values activated.
Revised: Therefore, the final output of FFN can be viewed as the weighted sum of values activated.

Original: Model editors Existing model editors are mainly separated into two types: fine-tuning-based and
Revised: Model editors Existing model editors are mainly separated into two types: fine-tuning-based and

Original: HyperNetwork-based.
Revised: HyperNetwork-based.

Original: Fine-tuning-based editors usually straightly tune the model with an extra loss to eschew over-fitting to edit example.
Revised: Fine-tuning-based editors usually straightly tune the model with an extra loss to eschew over-fitting to edit examples.

Original: For instance, Zhu et al.
Revised: For instance, Zhu et al.

Original: (2020) proposed an extra loss to reduce the distance between pre-edit and post-edit parameters.
Revised: (2020) proposed an extra loss to reduce the distance between pre-edit and post-edit parameters.

Original: Mitchell et al.
Revised: Mitchell et al.

Original: (2022a); Meng et al.
Revised: (2022a); Meng et al.

Original: (2022) equipped fine-tuning with KL-divergence to restrict the post-edit model’s output space.
Revised: (2022) equipped fine-tuning with KL-divergence to restrict the post-edit model’s output space.

Original: For another, HyperNetwork-based editors require additional training phrases.
Revised: For another, HyperNetwork-based editors require additional training phrases.

Original: Sinitsin et al.
Revised: Sinitsin et al.

Original: (2020) proposed a Meta Learning-based (Finn et al., 2017) approach named Editable Training to learn editable parameters for model modification.
Revised: (2020) proposed a Meta Learning-based (Finn et al., 2017) approach named Editable Training to learn editable parameters for model modification.

Original: Cao et al.
Revised: Cao et al.

Original: (2021) proposed KnowledgeEditor (KE) trained with constrained optimization to produce weight updates.
Revised: (2021) proposed KnowledgeEditor (KE) trained with constrained optimization to produce weight updates.

Original: Mitchell et al.
Revised: Mitchell et al.

Original: (2022a) proposed
Revised: (2022a) proposed

Original: MEND that learns to transform the gradient obtained by standard fine-tuning to edit large language models (Raffel et al., 2020).
Revised: MEND that learns to transform the gradient obtained by standard fine-tuning to edit large language models (Raffel et al., 2020).

Original: In addition, some works only focus on specific tasks, such as masked language modeling (Dai et al., 2021) and autoregressive language modeling (Meng et al., 2022; Geva et al., 2022).
Revised: In addition, some works only focus on specific tasks, such as masked language modeling (Dai et al., 2022) and autoregressive language modeling (Meng et al., 2022; Geva et al., 2022).

Original: They require special input other than edit examples to conduct model editing.
Revised: They require special input other than edit examples to conduct model editing.

Original: Continual Learning The proposed SME task could be regarded as an emergent variant of Continual Learning (CL)
Revised: Continual Learning The proposed SME task could be regarded as an emergent variant of Continual Learning (CL)

Original: (Mundt et al., 2020).
Revised: (Mundt et al., 2020).

Original: And dynamically expandable networks are employed for
Revised: And dynamically expandable networks are employed for

Original: CL as well (Rusu et al., 2016; Li & Hoiem, 2018).
Revised: CL as well (Rusu et al., 2016; Li & Hoiem, 2018).

Original: But there are some differences in the setting.
Revised: But there are some differences in the setting.

Original: In
Revised: In

Original: CL, usually the model is continually trained using different datasets and tasks.
Revised: CL, usually, the model is continually trained using different datasets and tasks.

Original: But SME deals with only one example at once and all examples are from the same task.
Revised: But SME deals with only one example at once and all examples are from the same task.

Original: The difference in setting renders
Revised: The difference in setting renders

Original: SME an unexplored area with new challenges that may not be properly addressed by general CL methods.
Revised: SME an unexplored area with new challenges that may not be properly addressed by general CL methods.

Original: For example, KL divergence loss and L2 normalization are usual methods to address the catastrophic forgetting in CL (De Lange et al., 2022), but previous works (Cao et al., 2021;
Revised: For example, KL divergence loss and L2 normalization are usual methods to address the catastrophic forgetting in CL (De Lange et al., 2022), but previous works (Cao et al., 2021;

Original: Mitchell et al., 2022a) and our experiments show that they can hardly maintain models accuracy on irrelevant inputs in ME task.
Revised: Mitchell et al., 2022a) and our experiments show that they can hardly maintain models accuracy on irrelevant inputs in ME task.

Original: And methods that add task-specific parameters for CL usually need extra training (Yoon et al., 2018; Wortsman et al., 2020; de Masson d’Autume et al., 2019), thus falling short of SME’s application efficiency requirement.
Revised: And methods that add task-specific parameters for CL usually need extra training (Yoon et al., 2018; Wortsman et al., 2020; de Masson d’Autume et al., 2019), thus falling short of SME’s application efficiency requirement.

Original:  S EQUENTIAL M ODEL E DITING PROBLEM
Revised:  S EQUENTIAL M ODEL E DITING PROBLEM

Original: [Figure]
Revised: [Figure]

Original: 1 and ( x t , y x t ) as input, and outputs the revised model f t .

Original: Following Mitchell et al.
Revised: Following Mitchell et al.

Original: (2022a), a model f ∈ F can be defined as a function f : X (cid:55)→ Y that maps an input x to its prediction f ( x ) .
Revised: (2022a), a model f ∈ F can be defined as a function f : X (cid:55)→ Y that maps an input x to its prediction f ( x ) .

Original: Then, given a model f and an edit example pair ( x e , y x e ) that f ( x e ) ̸
Revised: Then, given a model f and an edit example pair ( x e , y x e ) that f ( x e ) ̸

Original: = y x e , a model editor ME isdefined as a function [Equation] to output a post-edit model f ′ 
Revised: = y x e , a model editor ME is to output a post-edit model f ′ .

Original:  =
Revised: ME : F × X × Y (cid:55)→ F ( f, x e , y x e ) → f ′ =

Original: ME( f, x e , y x e ).
Revised: ME( f, x e , y x e )

Original: given a data stream { ( x 1 , y x 1 ) , · · · , ( x s , y x s ) } and an initial model f 0 , a model editor ME needs to conduct edits successively when the model makes undesirable output, as shown in Figure 2:
Revised: Given a data stream { ( x 1 , y x 1 ) , · · · , ( x s , y x s ) } and an initial model f 0 , a model editor ME needs to conduct edits successively when the model makes undesirable output, as shown in Figure 2.

Original: [Equation]
Revised: [Equation]

Original: And after every edit in SME the post-edit model f ′ should satisfy the following three properties:
Revised: And after every edit in SME the post-edit model f ′ should satisfy the following three properties:

Original: Property 1 Reliability : the post-edit model should output the desired prediction:
Revised: Property 1 Reliability : the post-edit model should output the desired prediction:

Original: [Equation]
Revised: [Equation]

Original: Property 2 Generality : Given an edit example x e , E x e = { x j | y x j = y x e } is defined as the set of its equivalent inputs (e.g. rephrased sentences).
Revised: Property 2 Generality : given an edit example x e , E x e = { x j | y x j = y x e } is defined as the set of its equivalent inputs (e.g. rephrased sentences).

Original: Then the post-edit model f ′ should satisfy:
Revised: Then the post-edit model f ′ should satisfy:

Original: [Equation]
Revised: [Equation]

Original: Property 3 Locality : the edit should be implemented locally and precisely, which means the postedit model should remain accurate on the irrelevant examples set I x e =X \ E x e :
Revised: Property 3 Locality : the edit should be implemented locally and precisely, which means the postedit model should remain accurate on the irrelevant examples set I x e =

Original: [Equation]

Original: And particularly, an edit should not disrupt the results of past edits in SME setting, which means: f t ( x k ) =

Original: y x k ,for k where f k − 1 ( x k )̸ =y x k (5) [Figure] T
Revised: X \ E x e : ∀ x j ∈ I x e , f ′ ( x j ) =

Original: [Figure] Classification : Elizabeth Truss is the UK Prime Minister
Revised: y x j (4)

Original: Autoregressive

Original: Generation : Who is the UK Prime Minister? True ( × ) 
Revised: In particular, an edit should not disrupt the results of past edits in SME setting, which means: f t ( x k ) =

Original: False (√) Patcher Elizabeth Truss( × ) Rishi Sunak(√)
Revised: y x k , for k where f k − 1 ( x k ) ̸

Original: Patcher Patcher Transformer Layer × (N-1) Input example
Revised: = y x k (5)

Original:  Attention Layer Layer N Frozen
Revised:  T RANSFORMER -P ATCHER

Original: [Figure]
Revised: [Figure]

Original: First, we call one misclassification or one wrongly generated token one mistake in the rest of the paper.
Revised: First, we call one misclassification or one wrongly generated token one mistake in the rest of the paper.

Original: Aiming at the SME task for transformer-based models, we propose Transformer-Patcher shown in Figure 3.
Revised: Aiming at the SME task for transformer-based models, we propose Transformer-Patcher shown in Figure 3.

Original: It freezes all original parameters and adds one neuron (patch) to the last FFN layer for one mistake.
Revised: It freezes all original parameters and adds one neuron (patch) to the last FFN layer for one mistake.

Original: And we train the patch to take effect only when encountering its corresponding mistake.
Revised: And we train the patch to take effect only when encountering its corresponding mistake.

Original: For classification, we add only one patch to rectify the model.
Revised: For classification, we add only one patch to rectify the model.

Original: For auto-regressive generation, we count how many tokens are wrongly generated under the teacher-forcing setting and add one patch for each of them.
Revised: For auto-regressive generation, we count how many tokens are wrongly generated under the teacher-forcing setting and add one patch for each of them.

Original: This section describes how to add and train one patch.
Revised: This section describes how to add and train one patch.

Original: Multiple patches editing follows exactly the same principle and is formally described in Appendix A.
Revised: Multiple patch editing follows exactly the same principle and is formally described in Appendix A.

Original: 4. W HAT IS A PATCH ?
Revised: 4. W HAT IS A PATCH ?

Original: As mentioned in section 2, FFN operates as key-value neuron memories.
Revised: As mentioned in Section 2, FFN operates as key-value neuron memories.

Original: Its forward computation is a process that retrieves values from matrix V by matching keys in matrix K and the input query q .
Revised: Its forward computation is a process that retrieves values from matrix V by matching keys in matrix K and the input query q .

Original: For a standard FFN, given a query q ∈ R d , its output FFN ( q ) is:
Revised: For a standard FFN, given a query q ∈ R d , its output FFN ( q ) is:

Original: [Equation]
Revised: [Equation]

Original: [Equation] (7) where Act( · ) is a non-linear activation function (e.g., Relu or Gelu), a is the vector of activation values, b k  and b v are two bias vectors.
Revised: where Act( · ) is a non-linear activation function (e.g., Relu or Gelu), a is the vector of activation values, b k , and b v are two bias vectors.

Original: A patch is an extra neuron (an extra key-value pair) added to the last FFN layer.
Revised: A patch is an extra neuron (an extra key-value pair) added to the last FFN layer.

Original: After patching, the new output FFN p ( q ) is:
Revised: After patching, the new output FFN p ( q ) is:

Original: [Equation]
Revised: [Equation]

Original: where
Revised: where

Original: k p ∈
Revised: k p ∈

Original: R
Revised: R

Original: d is the patch key, v p ∈ R
Revised: d is the patch key, v p ∈ R

Original: d is the patch value, b p is a scalar named patch bias, a p = Act( q · k p + b p ) represents the activation value of the patch.
Revised: d is the patch value, b p is a scalar named patch bias, a p = Act( q · k p + b p ) represents the activation value of the patch.

Original: With the substitution of equationsand 7, equation 9 can be reformulated as:
Revised: With the substitution of equationsand 7, equation 9 can be reformulated as:

Original: [Equation]
Revised: [Equation]

Original: 4. T RAINING A PATCH FOR EDITING
Revised: 4. T RAINING A PATCH FOR EDITING

Original: An ideal edit requires reliability , generality  and locality proposed in Section 3.
Revised: An ideal edit requires reliability , generality , and locality proposed in Section 3.

Original: For reliability , a patch needs to be activated according to equation 10.
Revised: For reliability , a patch needs to be activated according to equation 10.

Original: Let q e represent the input query of the mistake, the patch key k p and patch bias b p should satisfy:
Revised: Let q e represent the input query of the mistake, the patch key k p and patch bias b p should satisfy:

Original: [Equation]
Revised: [Equation]

Original: When Act is ReLU or GeLU, the above condition can be approximated  follows:
Revised: When Act is ReLU or GeLU, the above condition can be approximated as follows:

Original: [Equation]
Revised: [Equation]

Original: To meet the constraint 12, we propose a activation loss l a to maximize the activation value:
Revised: To meet the constraint 12, we propose a activation loss l a to maximize the activation value:

Original: [Equation]
Revised: [Equation]

Original: Once a patch is activated, according to equation 10, it adds a bias term a p · v p to the output of the last layer.
Revised: Once a patch is activated, according to equation 10, it adds a bias term a p · v p to the output of the last layer.

Original: Because we are editing the last layer of the model, the output of the model can be adjusted to any result without worrying that other components of the model would cancel the editing effect.
Revised: Because we are editing the last layer of the model, the output of the model can be adjusted to any result without worrying that other components of the model would cancel the editing effect.

Original: To obtain the target output, we leverage the task’s original loss function and rename it as edit loss l e .
Revised: To obtain the target output, we leverage the task’s original loss function and rename it as edit loss l e .

Original: Formally, for an edit example ( x e , y e ) , the patched model’s output is p e , l e is defined as:
Revised: Formally, for an edit example ( x e , y e ) , the patched model’s output is p e , l e is defined as:

Original: [Equation]
Revised: [Equation]

Original: where L ( · ) is a function of label y e and model output p e and depends on the specific task.
Revised: where L ( · ) is a function of label y e and model output p e and depends on the specific task.

Original: For locality , the model’s behavior should not be shifted on irrelevant examples, thus the patch should not be activated by any irrelevant examples.
Revised: For locality , the model’s behavior should not be shifted on irrelevant examples, thus the patch should not be activated by any irrelevant examples.

Original: When using ReLU or GeLU, it can be approximated as that all queries from irrelevant examples
Revised: When using ReLU or GeLU, it can be approximated as that all queries from irrelevant examples

Original: q i should have a patch activation value less than or equal to a threshold β , i.e., the maximum of them is less than or equal to β :
Revised: q i should have a patch activation value less than or equal to a threshold β , i.e., the maximum of them is less than or equal to β :

Original: [Equation]
Revised: [Equation]

Revised: [Equation]

Original: Thus we propose the memory loss l m to enforce the constraint 15.
Revised: Thus we propose the memory loss l m to enforce the constraint 15.

Original: To imitate the distribution of queries from irrelevant examples, we randomly retains some queries from previously seen examples as memories.
Revised: To imitate the distribution of queries from irrelevant examples, we randomly retain some queries from previously seen examples as memories.

Original: Each query is a d -dimensional vector and we can stack them as a matrix M ∈ R
Revised: Each query is a d -dimensional vector and we can stack them as a matrix M ∈ R

Original: d m × d , where d m is the number of queries saved.
Revised: d m × d , where d m is the number of queries saved.

Original: Our proposed memory loss l m is the sum of two terms.
Revised: Our proposed memory loss l m is the sum of two terms.

Original: The first term l m 1 is introduced to make the patch inactivated to all queries in M :
Revised: The first term l m 1 is introduced to make the patch inactivated to all queries in M :

Original: [Equation]
Revised: [Equation]

Original: 16) where S ( · ; k ) is a function that receives a vector v and outputs a scalar
Revised: where S ( · ; k ) is a function that receives a vector v and outputs a scalar

Original: [Equation]
Revised: [Equation]

Original: It first employ element-wise exponential function to v and then select k largest elements to compute their average as the output.
Revised: It first employs element-wise exponential function to v and then selects k largest elements to compute their average as the output.

Original: Although constraint 15 is about the maximum, we employ TopK here fora more efficient optimization.
Revised: Although constraint 15 is about the maximum, we employ TopK here for more efficient optimization.

Original: In case that l m 1 can not absolutely ensure the constraint 15, we propose l m 2 to distance the activation value of q e and q i .
Revised: In case that l m 1 can not absolutely ensure the constraint 15, we propose l m 2 to distance the activation value of q e and q i .

Original: That is, the activation value of the mistaken example is larger than that of the irrelevant examples by a certain margin γ .
Revised: That is, the activation value of the mistaken example is larger than that of the irrelevant examples by a certain margin γ .

Original: [Equation]
Revised: [Equation]

Original: To sum up, the loss l p for training a patch is defined as a weighted sum of the above losses:
Revised: To sum up, the loss l p for training a patch is defined as a weighted sum of the above losses:

Original: [Equation]
Revised: [Equation]

Original: [Equation]

Original:  where a , m are hyper-parameters.
Revised: ) where a , m are hyper-parameters.

Original: β is selected as -3 for GeLU and 0 for ReLu, since GeLU(- 3) ≈ 0.004 is small enough and ReLU(0)=0.
Revised: β is selected as -3 for GeLU and 0 for ReLu, since GeLU(- 3) ≈ 0.004 is small enough and ReLU(0)=0.

Original: γ is selected as 3 for GeLU and 0 for ReLU.
Revised: γ is selected as 3 for GeLU and 0 for ReLU.

Original:  E XPERIMENTS 5. E XPERIMENTAL SETTINGS AND E VALUATION METRICS
Revised:  E XPERIMENTS 5. E XPERIMENTAL SETTINGS AND E VALUATION METRICS

Original: We proposed an experimental pipeline for SME used for standard datasets with training set D train , validation set D val , and test set D test .
Revised: We proposed an experimental pipeline for SME used for standard datasets with training set D train , validation set D val , and test set D test .

Original: There are two differences between our setting and the previous
Revised: There are two differences between our setting and the previous

Original: Model Editing setting.
Revised: Model Editing setting.

Original: First, we employ multi-step editing rather than one-step.
Revised: First, we employ multi-step editing rather than one-step.

Original: Second, previous works usually generate counterfactual edit examples (e.g., replacing the answer to a question with a random one), while we employ authentic examples where the model makes mistakes.
Revised: Second, previous works usually generate counterfactual edit examples (e.g., replacing the answer to a question with a random one), while we employ authentic examples where the model makes mistakes.

Original: We first split the original D train into an edit set D edit and a new training set D ′ train .
Revised: We first split the original D train into an edit set D edit and a new training set D ′ train .

Original: To evaluate generality, backtranslation could be utilized to generate the equivalent set E x e for edit example x e ∈ D edit following previous works (Cao et al., 2021).
Revised: To evaluate generality, backtranslation could be utilized to generate the equivalent set E x e for edit example x e ∈ D edit following previous works (Cao et al., 2021).

Original: To evaluate locality, a subset D tr randomly sampled from D ′ train is used to see how the post-edit model performs on its training data.
Revised: To evaluate locality, a subset D tr randomly sampled from D ′ train is used to see how the post-edit model performs on its training data.

Original: Our SME pipeline starts with an initial model f 0 trained on D ′ train and validated using D val , the model is sequentially edited while encountering mistakes in D edit .
Revised: Our SME pipeline starts with an initial model f 0 trained on D ′ train and validated using D val , the model is sequentially edited while encountering mistakes in D edit .

Original: After the t th edit example ( x te , y te ) , we obtain a post-edit model f t .
Revised: After the t th edit example ( x te , y te ) , we obtain a post-edit model f t .

Original: Supposing that there are T total edits
Revised: Supposing that there are T total edits

Original: and I represents the indicator function, our proposed metrics are calculated as follows:
Revised: and I represents the indicator function, our proposed metrics are calculated as follows:

Original: 1) Success Rate (SR): to evaluate the reliability, we test if the post-edit model outputs the desired prediction.
Revised: 1) Success Rate (SR): to evaluate the reliability, we test if the post-edit model outputs the desired prediction.

Original: Thus, SR is
Revised: Thus, SR is:

Original: [Equation]
Revised: [Equation]

Original: 2) Generalization Rate (GR): to evaluate the generality, we test the post-edit model f t on the equivalent set E x te = { x te, 1 · · · , x te,N t } of the edit example x te , thus GR is:
Revised: 2) Generalization Rate (GR): to evaluate the generality, we test the post-edit model f t on the equivalent set E x te = { x te, 1 · · · , x te,N t } of the edit example x te , thus GR is:

Original: [Equation]
Revised: [Equation]

Original: Edit Retain Rate (ER): to evaluate locality and reliability, we evaluate how many past edits are retained by the final model f T .
Revised: Edit Retain Rate (ER): to evaluate locality and reliability, we evaluate how many past edits are retained by the final model f T .

Original: In  real application, a reliable model editor should keep the fixed bugs from recurring again, thus SR alone cannot evaluate reliability, and we define ER by testing the final model on all its past edit examples E pe :
Revised: In a real application, a reliable model editor should keep the fixed bugs from recurring again, thus SR alone cannot evaluate reliability, and we define ER by testing the final model on all its past edit examples E pe :

Original: [Equation]
Revised: [Equation]

Original: 4) Training Retain Rate (TrainR): to evaluate locality, we compare the performance  the final model of f T and the initial model f 0 on subsampled test D tr .
Revised: 4) Training Retain Rate (TrainR): to evaluate locality, we compare the performance of the final model of f T and the initial model f 0 on subsampled test D tr .

Original: Thus, the TrainR is defined as:
Revised: Thus, the TrainR is defined as:

Original: [Equation]
Revised: [Equation]

Original: 5) Test Retain Rate (TestR): to evaluate locality, we see if the post-edit model
Revised: 5) Test Retain Rate (TestR)

Original:  still retains the generalization ability over unseen data.
Revised: : to evaluate locality, we see if the post-edit model still retains the generalization ability over unseen data.

Original: Than the TestR is defined as:
Revised: Then the TestR is defined as:

Original: [Equation]
Revised: [Equation]

Original: Datasets and Baselines Both classification and auto-regressive generation tasks are selected for evaluation.
Revised: Datasets and Baselines Both classification and auto-regressive generation tasks are selected for evaluation.

Original: Following Cao et al.
Revised: Following Cao et al.

Original: and Mitchell et al.
Revised: and Mitchell et al.

Original: (2022a)
Revised: (2022a)

Original: , we employ Fact-Checking (FC) for classification and closed-book Question Answering (QA) for generation.
Revised: , we employ Fact-Checking (FC) for classification and closed-book Question Answering (QA) for generation.

Original: For FC, we apply a
Revised: For FC, we apply a

Original: BERT base model (Devlin et al., 2019) and the FEVER dataset (Thorne et al., 2018).
Revised: BERT base model (Devlin et al., 2019) and the FEVER dataset (Thorne et al., 2018).

Original: For QA, we apply a BART base model (Lewis et al., 2020) and the Zero-Shot Relation Extraction (zsRE) dataset (Levy et al., 2017).
Revised: For QA, we apply a BART base model (Lewis et al., 2020) and the Zero-Shot Relation Extraction (zsRE) dataset (Levy et al., 2017).

Original: We directly use the equivalent set released by Cao et al.
Revised: We directly use the equivalent set released by Cao et al.

Original: We use the same data split as Cao et al.
Revised: We use the same data split as Cao et al.

Original: Both FC and QA are evaluated using accuracy.
Revised: Both FC and QA are evaluated using accuracy.

Original: Our baselines include (1) Fine-Tuning-based editors :
Revised: Our baselines include (1) Fine-Tuning-based editors :

Original: The FT directly fine-tunes the model on the edit example.
Revised: The FT directly fine-tunes the model on the edit example.

Original: Following Mitchell et al.
Revised: Following Mitchell et al.

Original: (2022a), FT+KL is selected as a baseline.
Revised: (2022a), FT+KL is selected as a baseline.

Original: It fine-tunes the model with an extra KL divergence loss l kl .
Revised: It fine-tunes the model with an extra KL divergence loss l kl .

Original: Following Sinitsin et al.
Revised: Following Sinitsin et al.

Original: (2020) and Zhu et al.
Revised: (2020) and Zhu et al.

Original: , we report fine-tuning-based baselines by fine-tuning all parameters ( FT(all) and FT(all)+KL ) or the last layer ( FT(last) and FT(last)+KL ).
Revised: , we report fine-tuning-based baselines by fine-tuning all parameters ( FT(all) and FT(all)+KL ) or the last layer ( FT(last) and FT(last)+KL ).

Original: (2) Two HyperNetwork-based editors: KE (Cao et al., 2021) and
Revised: (2) Two HyperNetwork-based editors: KE (Cao et al., 2021) and

Original: MEND (Mitchell et al., 2022a).
Revised: MEND (Mitchell et al., 2022a).

Original: (3) SERA : a variant of the latest SOTA memory-based model editor
Revised: (3) SERA : a variant of the latest SOTA memory-based model editor

Original: SERAC (Mitchell et al., 2022b).
Revised: SERAC (Mitchell et al., 2022b).

Original: Other details of our baselines are reported in Appendix B.
Revised: Other details of our baselines are reported in Appendix B.

Original: Experiment Details Initial models for two tasks are obtained following the same training settings as Cao et al.
Revised: Experiment Details Initial models for two tasks are obtained following the same training settings as Cao et al.

Original: For FC, the accuracy of the initial model attains 94.1% on D tr , 76.9% on D test .
Revised: For FC, the accuracy of the initial model attains 94.1% on D tr , 76.9% on D test .

Original: For QA, the accuracy of the initial model attains 56.6% on D tr , 23.1% on D test .
Revised: For QA, the accuracy of the initial model attains 56.6% on D tr , 23.1% on D test .

Original: To reduce the experimental uncertainty, we randomly split the edit set into n = 20 folders to run SMEtimes and report the averaged performance as the final result.
Revised: To reduce the experimental uncertainty, we randomly split the edit set into n = 20 folders to run SME [Table] [Table] times and report the averaged performance as the final result.

Original: The initial model f 0 makes aboutmistakes in a FC folder and about 139 in a QA folder on average For methods requiring memories (fine-tune with KL and ours), 40,000 memory examples are sampled from D ′ train \ D tr are employed for both tasks, and are updated as editing proceed.
Revised: The initial model f 0 makes about 63 mistakes in an FC folder and about 139 in a QA folder on average. For methods requiring memories (fine-tuning with KL and ours), 40,000 memory examples are sampled from D ′ train \ D tr are employed for both tasks and are updated as editing proceed.

Original: The hyper-parmeter a and m are selected asand 10 respectively for both tasks to make the extra losses and the original task loss in the same order of magnitude.
Revised: The hyperparameters a and m are selected as 1 and 10 respectively for both tasks to make the extra losses and the original task loss in the same order of magnitude.

Original: Other details can be found in Appendix B.
Revised: Other details can be found in Appendix B

Original: [Table]

Original: [Table]
Revised: [Table]

Original: 5. E XPERIMENTAL RESULTS
Revised: 5. E XPERIMENTAL RESULTS

Original: Main results The experiment results are shown in Table 1.
Revised: Main results The experiment results are shown in Table 1.

Original: Our method achieves strong performance in all five metrics across two tasks.
Revised: Our method achieves strong performance in all five metrics across two tasks.

Original: It could make a series of model corrections (SR ≈ 1) while nearly retaining every past edit (ER ≈ 1) and almost perfectly keeping the model’s overall performance (TrainR ≈ 1, TestR ≈ 1).
Revised: It could make a series of model corrections (SR ≈ 1) while nearly retaining every past edit (ER ≈ 1) and almost perfectly keeping the model’s overall performance (TrainR ≈ 1, TestR ≈ 1).

Original: The fine-tuning-based editors could partly preserve the model’s behavior and achieve high SR [Table] but it is vulnerable to forgetting previous edits (low ER).
Revised: The fine-tuning-based editors could partly preserve the model’s behavior and achieve high SR, but it is vulnerable to forgetting previous edits (low ER).

Original: Two
Revised: Two

Original: HyperNetwork-based editors, fail in the SME setting.
Revised: HyperNetwork-based editors fail in the SME setting.

Original: They have trouble retaining models’ overall performance (low ER, TrainR, TestR) and conducting a series of edits (low SR and GR).
Revised: They have trouble retaining models’ overall performance (low ER, TrainR, TestR) and conducting a series of edits (low SR and GR).

Original: SERA achieves the highest GR [Table] while can only partially preserve the model’s overall performance (TestR,
Revised: SERA achieves the highest GR, while can only partially preserve the model’s overall performance (TestR,

Original: TrainR ≈ 0.9)
Revised: TrainR ≈ 0.9)

Original: compared to Transformer-Patcher.
Revised: compared to T-Patcher.

Original: Apart from being effective, our method is efficient enough as well.
Revised: Apart from being effective, our method is efficient enough as well.

Original: Using a V100, one edit costs only 7.1s for FC and 18.9s for QA.
Revised: Using a V100, one edit costs only 7.1s for FC and 18.9s for QA.

Original: We could further improve the efficiency to 4.7s and 12.4s by decreasing the number of memory examples to 10,000.
Revised: We could further improve the efficiency to 4.7s and 12.4s by decreasing the number of memory examples to 10,000.

Original: Scale up to thousands of edits Table 1 shows that Transformer-Patcher achieves good performance for about 60 edits on FC and 140 edits on QA, thus we wonder if it could handle more edits.
Revised: Scale up to thousands of edits Table 1 shows that Transformer-Patcher achieves good performance for about 60 edits on FC and 140 edits on QA, thus we wonder if it could handle more edits.

Original: So we utilize all data in D edit as a single data stream to run SME.
Revised: So we utilize all data in D edit as a single data stream to run SME.

Original: As shown in Table 2,
Revised: As shown in Table 2,

Original: Transformer-Patcher could effectively correct up to thousands of mistakes and retain the model’s overall performance simultaneously compared with  other two strong baselines.
Revised: Transformer-Patcher could effectively correct up to thousands of mistakes and retain the model’s overall performance simultaneously compared with the other two strong baselines.

Original: It’s interesting to notice that the number of edits E of Transformer-Patcher is less than the number of actual mistakes N made by the initial model.
Revised: It’s interesting to notice that the number of edits E of Transformer-Patcher is less than the number of actual mistakes N made by the initial model.

Original: In other words, our method can fix some potential mistakes of the initial model before the error actually happens.
Revised: In other words, our method can fix some potential mistakes in the initial model before the error actually happens.

Original: On the contrary, the fine-tuning-based method fixes more mistakes than the original model, which means it created more errors during the editing process.
Revised: On the contrary, the fine-tuning-based method fixes more mistakes than the original model, which means it created more errors during the editing process.

Original: It seems contradictory that our method attains fewer E and lower TestR, this may due to the distribution shift between D edit and D test .
Revised: It seems contradictory that our method attains fewer E and lower TestR, this may due to the distribution shift between D edit and D test .

Original: See more explanation in Appendix C. Furthermore, the post-edit model only gets 1.4% larger for FC and 4.5% larger for QA.
Revised: See more explanation in Appendix C. Furthermore, the post-edit model only gets 1.4% larger for FC and 4.5% larger for QA.

Original: We believe this cost is acceptable for automatically correcting the model’s mistakes from time to time during deployment.
Revised: We believe this cost is acceptable for automatically correcting the model’s mistakes from time to time during deployment.

Original: In practice, we suggest using the transformer-patcher to provide a timely response for each mistake online, and after accumulating certain quantities of mistakes, we could fine-tune the original model on all accumulated mistakes, so that the patches can be removed.
Revised: In practice, we suggest using the transformer-patcher to provide a timely response for each mistake online, and after accumulating certain quantities of mistakes, we could fine-tune the original model on all accumulated mistakes, so that the patches can be removed.

Original: In this way, we could achieve a good balance between model size and editing effectiveness.
Revised: In this way, we could achieve a good balance between model size and editing effectiveness.

Original: 5. A NALYSES
Revised: 5. A NALYSES

Original: [Figure]
Revised: [Figure]

Original: The collapse of MEND and KE We discuss here why MEND and KE fail in the SME.
Revised: The collapse of MEND and KE We discuss here why MEND and KE fail in the SME.

Original: Figurepresents how SR varies with the number of edits on both FC and QA.
Revised: Figurepresents how SR varies with the number of edits on both FC and QA.

Original: Figure 4 shows that MEND and
Revised: Figure 4 shows that MEND and

Original: KE are effective in the first few steps, but shortly after they are no longer able to produce valid edits.
Revised: KE are effective in the first few steps, but shortly after they are no longer able to produce valid edits.

Original: However, in their original paper (Cao et al., 2021; Mitchell et al., 2022a), they both reported that they achieved high SR when dealing with one-step editing.
Revised: However, in their original paper (Cao et al., 2021; Mitchell et al., 2022a), they both reported that they achieved high SR when dealing with one-step editing.

Original: We find this phenomenon reasonable since both HyperNetwork-based editors are trained with the initial model f 0 and thus strongly coupled with the original parameters.
Revised: We find this phenomenon reasonable since both HyperNetwork-based editors are trained with the initial model f 0 and thus strongly coupled with the original parameters.

Original: As the editing proceeds, the model becomes more different from the initial one, resulting in their failure.
Revised: As the editing proceeds, the model becomes more different from the initial one, resulting in their failure.

Original: We tried to retrain HyperNets after every edit using the post-edit model, but the cost for re-training is unacceptable as it costs hours to train a HyperNet model editor.
Revised: We tried to retrain HyperNets after every edit using the post-edit model, but the cost for re-training is unacceptable as it costs hours to train a HyperNet model editor.

Original: [Table]
Revised: [Table]

Original: Memory loss To validate the effectiveness of our proposed memory loss, we apply several alternative patches: 1) T-Patcher w/o l m , 2) KL Patch, where l m is replaced with the KL divergence loss, 3) T-Patcher w/o l m 2 .
Revised: Memory loss To validate the effectiveness of our proposed memory loss [Table] we apply several alternative patches: (1) T-Patcher w/o l m , (2) KL Patch, where l m is replaced with the KL divergence loss, (3) T-Patcher w/o l m 2 .

Original: The ablation results in Table 3 show thatthe memory loss is critical.
Revised: The ablation results in Table 3 show that memory loss is critical.

Original: Simply adding patches withoutthe memory loss hurts the model’s overall performance.
Revised: Simply adding patches without memory loss hurts the model’s overall performance severely.

Original: The KL divergence partially alleviates this problem (higher TrainR, TestR, and ER) but is still unsatisfying on the more complex QA task, which is similar to the Fintuning with KL results in Table 1.
Revised: The KL divergence partially alleviates this problem (higher TrainR, TestR [Table] and ER) but is still unsatisfying on the more complex QA task, which is similar to the Fintuning with KL results in Table 1.

Original: By comparing w/o l m 2 and T-Patcher, we observe that the main contribution of our proposed memory loss comes from l m 1 , while adding l m 2 still improves the method’s performance.
Revised: By comparing w/o l m 2 and T-Patcher [Table] we observe that the main contribution of our proposed memory loss comes from l m 1 , while adding l m 2 still improves the method’s performance.

Original: Furthermore, to investigate whether our added patches do solely respond to the specific error we visualize the activation values of different patches on their corresponding mistakes in Figure 5 for the QA task.
Revised: Furthermore, to investigate whether our added patches do solely respond to the specific error we visualize the activation values of different patches on their corresponding mistakes in Figure 5 for the QA task.

Original: The X-axis represents the mistake (8.2 represents the second mistake of the 8th edit example) and the Y-axis represents the patch.
Revised: The X-axis represents the mistake (8.2 represents the second mistake of the 8th edit example) and the Y-axis represents the patch.

Original: Figure 5a shows that the patch can be activated by multiple irrelevant queries without the constraint ofthe memory loss, leading to low ER, TrainR, and TestR. Figure 5b is a lot darker, indicating that the KL loss tends to deactivate patches to bridge the distribution gap  before patching and after patching.
Revised: Figure 5a shows that the patch can be activated by multiple irrelevant queries without the constraint of memory loss, leading to low ER, TrainR, and TestR. Figure 5b is a lot darker, indicating that the KL loss tends to deactivate patches to bridge the distribution gap [Figure] [Figure] before patching and after patching.

Original: And figure 5c presents a clear diagonal line, which means each patch takes charge of its corresponding mistake.
Revised: And figure 5c presents a clear diagonal line, which means each patch takes charge of its corresponding mistake.

Original: Further analysis about the activation value of different patches is presented in Appendix C.
Revised: Further analysis of the activation value of different patches is presented in Appendix C.

Original: [Figure] [Figure] Patched layer position To validate the benefits of patching the last layer instead of the others, we focus on  QA task and patch each decoder layerof the Bart-base model separately.
Revised: Patched layer position To validate the benefits of patching the last layer, we focus on the QA task and patch each decoder layer separately.

Original: The ablation results are illustrated in Figure 6a.
Revised: The ablation results are illustrated in Figure 6a.

Original: First, patching the bottom layer (layer 0 andlayer 1) can not make effect edits.
Revised: First, patching the bottom layer (layer 0 and 1) can not make effect edits.

Original: This may be because patching the bottom layer severely influences every token in the input sequence, making  patch’s optimization more difficult.
Revised: This may be because patching the bottom layer severely influences every token in the input sequence, making the patch’s optimization more difficult.

Original: While the patches added to the last layer only influence correspondent mistaken tokens, Then, compared to the other metrics, what the patching position influenced most is GR, which increases from 0.74 of layer 2 to 0.81 of layer 5, proving that patching the top layers may improve the generality .
Revised: While the patches added to the last layer only influence correspondent mistaken tokens, Then, compared to the other metrics, what the patching position influenced most is GR, which increases from 0.74 of layer 2 to 0.81 of layer 5, proving that patching the top layers may improve the generality .

Original: This phenomenon is aligned with previous studies (Jawahar et al., 2019) which found that high-level semantic features are encoded at the top layers ans superficial information are encoded in lower layers.
Revised: This phenomenon is aligned with previous studies (Jawahar et al., 2019) which found that high-level semantic features are encoded at the top layers and superficial information is encoded in lower layers.

Original: Besides, patching the last layer could ameliorate the editing efficiency as well.
Revised: Besides, patching the last layer could ameliorate the editing efficiency as well.

Original: Because computation results of previous layers could be cached and reused while editing;
Revised: Because computation results of previous layers could be cached and reused while editing.

Original: Memory size In order to verify the robustness ofthe our method, we conduct experiments using different memory size (from 5,000 to 40,000) on  QA task.
Revised: Memory size In order to verify the robustness of our method, we conduct experiments using different memory sizes (from 5,000 to 40,000) on the QA task.

Original: As is shown inthe Figure 6b, our method is not very sensitive to the size of the memory set.
Revised: As is shown in Figure 6b, our method is not very sensitive to the size of the memory set.

Original: Reducing memory examples only causes slight drops in SR, ER, TrainR, and TestR, and a slight increase in GR.
Revised: Reducing memory examples only causes slight drops in SR, ER, TrainR, and TestR, and a slight increase in GR.

Original:  C ONCLUSION
Revised:  C ONCLUSION

Original: In this work, we proposed the Sequential Model Editing task, as well as its experiment pipeline and evaluation metrics.
Revised: In this work, we proposed the Sequential Model Editing task, as well as its experiment pipeline and evaluation metrics.

Original: We then introduce Transformer-Patcher, a practical method for sequentially editing transformer-based language models.
Revised: We then introduce Transformer-Patcher, a practical method for sequentially editing transformer-based language models.

Original: Experiments on both classification and autoregressive generation tasks demonstrate its ability to edit the model up to  thousand times continuously.
Revised: Experiments on both classification and autoregressive generation tasks demonstrate its ability to edit the model up to a thousand times continuously.

Original: This method could have a positive social impact by fixing serious mistakes in large PLMs, including generating biased predictions and hate speech, benefiting a broad spectrum of audiences.
Revised: This method could have a positive social impact by fixing serious mistakes in large PLMs, including generating biased predictions and hate speech, benefiting a broad spectrum of audiences.

Original: A C ALCULATION OF ACTIVATION LOSS AND MEMORY LOSS FOR MULTIPLE NEURON PATCHING
Revised: A M ULTIPLE NEURON PATCHING

Original: In auto-regressive generation tasks model may make multiple mistakes on one example.
Revised: In auto-regressive generation tasks, the model may make multiple mistakes in one example.

Original: Since FFN is a position-wise network, every mistake in the output can be ascribed to one query to the last FFN layer.
Revised: Since FFN is a position-wise network, every mistake in the output can be ascribed to one query to the last FFN layer.

Original: Therefore, for an example where  model makes n mistakes each mistake can be ascribed to a query q ie to  last FFN layer and we add n patches to handle each of them.
Revised: Therefore, for an example where the model makes n mistakes, each mistake can be ascribed to a query q ie to the last FFN layer, and we add n patches to handle each of them.

Original: Specifically, given an input query q , the new output FFN p ( q ) of a FFN with n patches is:[Equation]
Revised: Specifically, given an input query q , the new output FFN p ( q ) of a FFN with n patches is:

Original: [Equation]
Revised: [Equation]

Original: where K p ∈ R d × n is the patch key, v p ∈ R n × d is the patch value, b p ∈ R n is the patch bias, a p = Act( q · k p + b p ) is a vector containing activation values of patches.
Revised: where K p ∈ R d × n is the patch key, v p ∈ R n × d is the patch value, b p ∈ R n is the patch bias, a p = Act( q · k p + b p ) is a vector containing activation values of patches.

Original: With the substitution of equations 6 and 7, equation 9 can be reformulated as:
Revised: With the substitution of equations 6 and 7, equation 9 can be reformulated as:

Revised: [Equation]

Original: [Equation]
Revised: [Equation]

Original: During calculating the activation loss for multiple patches, we just constraint the patch k ip to be activated by its corresponding query q ie , let q e ∈ R n × d represent the matrix containing n corresponding queries, then we can obtain A ∈ R n which is defined as a vector containing activation values of each patch on its corresponding query:
Revised: During calculating the activation loss for multiple patches, we just constraint the patch k ip to be activated by its corresponding query q ie , let q e ∈ R n × d represent the matrix containing n corresponding queries, then we can obtain A ∈ R n which is defined as a vector containing activation values of each patch on its corresponding query:

Original: [Equation]
Revised: [Equation]

Original: It can also be formulated as follows:
Revised: It can also be formulated as follows:

Original: [Equation]
Revised: [Equation]

Original: where diag is a function to select the diagonal elements from a matrix.
Revised: where diag is a function to select the diagonal elements from a matrix.

Original: Then the activation loss for n patches can be calculated as follows:
Revised: Then the activation loss for n patches can be calculated as follows:

Original: [Equation]
Revised: [Equation]

Original: where S is the function defined in Equation 17, k a is a hyper-parameter.
Revised: where S is the function defined in Equation 17, k a is a hyper-parameter.

Original: Memory loss l m for multiple patches remains the sum of two terms l m 1 and l m 2 , where l m 1 is identical as Equation 16.
Revised: Memory loss l m for multiple patches remains the sum of two terms l m 1 and l m 2 , where l m 1 is identical as Equation 16.

Original: As for l m 2 , we restrict that for i -th patch k i p , all its activation value to a query in M should be smaller than that to its corresponding query q ie , thus l m 2 becomes:
Revised: As for l m 2 , we restrict that for i -th patch k ip , all its activation value to a query in M should be smaller than that to its corresponding query q ie , thus l m 2 becomes:

Original: [Equation]
Revised: [Equation]

Original: For initialization, every patch k ip is initialized as its normalized related query q ie | q ie | 2 so that the initial activation value is 1.
Revised: For initialization, every patch k ip is initialized as its normalized related query q ie | q ie | 2 so that the initial activation value is 1.

Original: B E XPERIMENTAL D ETAILS
Revised: B E XPERIMENTAL D ETAILS

Original: Data splits We utilize the same data split of training and testing following Cao et al.
Revised: Data splits We utilize the same data split of training and testing following Cao et al.

Original: For closed-book fact-checking,  binary FEVER dataset originally has 104,966 training instances and 10,444 validation instances.
Revised: For closed-book fact-checking, the binary FEVER dataset originally has 104,966 training instances and 10,444 validation instances.

Original: In order to adapt it to  SME task, we keep the original validation set intact and employ it as D test , and split the original training data into three subsets: a new training set D ′ train , a new validation set D val and an edit set D edit in the ratio of 0 . 8 : 0 . 1 : 0 . 1 .
Revised: In order to adapt it to the SME task, we keep the original validation set intact and employ it as D test , and split the original training data into three subsets: a new training set D ′ train , a new validation set D val and an edit set D edit in the ratio of 0 . 8 : 0 . 1 : 0 . 1 .

Original: As a result, we get 10,496 instances for  edit set.
Revised: As a result, we get 10,496 instances for the edit set.

Original: Since the Bert-based classifier attains 88.3% on the edit set, the ideal edit sequence length is 10496*88.3%/20=63 on average.
Revised: Since the Bert-based classifier attains 88.3% on the edit set, the ideal edit sequence length is 10496*88.3%/20=63 on average.

Original: For closed-book question answering, we employ the zsRE dataset released by Cao et al.
Revised: For closed-book question answering, we employ the zsRE dataset released by Cao et al.

Original: (2021), which originally has 244,173 examples for training and 27,644 examples for validation.
Revised: (2021), which originally has 244,173 examples for training and 27,644 examples for validation.

Original: We first filter out examples with only one answer and then employ the same data split process as FEVER in the ratio of 0 . 9 : 0 . 075 : 0 . 025 .
Revised: We first filter out examples with only one answer and then employ the same data split process as FEVER in the ratio of 0 . 9 : 0 . 075 : 0 . 025 .

Original: Finally we get 5,317 edit data and 15,982 for validation and 24, for test.
Revised: Finally, we get 5,317 edit data and 15,982 for validation, and 24,051 for testing.

Original: Since the Bart-based model attains 47.9% on the edit set, the ideal edit sequence length is 5317*47.9%/20=139 on average.
Revised: Since the Bart-based model attains 47.9% on the edit set, the ideal edit sequence length is 5317*47.9%/20=139 on average.

Original: For both datasets, we randomly sampled a subset from D ′ train with the size of 10,000 as D tr , and the edit set D edit is split into n
Revised: For both datasets, we randomly sampled a subset from D ′ train with the size of 10,000 as D tr , and the edit set D edit is split into n

Original: = 20 folders to run SME n = 20 times independently.
Revised: = 20 folders to run SME n = 20 times independently.

Original: For  model editor requiring memories (fine-tune with KL and Transformer-Patcher), we randomly sampled a subset from D ′ train \ D tr with the size of 40000 and update it as the editing proceeds.
Revised: For the model editor requiring memories (fine-tuning with KL and Transformer-Patcher), we randomly sampled a subset from D ′ train \ D tr with the size of 40000 and update it as the editing proceeds.

Original: Initial models training Initial models are trained following Cao et al.
Revised: Initial models training Initial models are trained following Cao et al.

Original: For FC task, we fine-tune a BERT base model with an additional linear layer that maps the hidden state of  BOS (beginning of a sentence) token to the probability of the positive label.
Revised: For the FactChecking task, we fine-tune a BERT base model with an additional linear layer that maps the hidden state of the BOS (beginning of a sentence) token to the probability of the positive label.

Original: We maximize the model likelihood and the final model attains an accuracy of 76.9% on D test , 94.1% on D tr and 88.3% on D edit .
Revised: We maximize the model likelihood and the final model attains an accuracy of 76.9% on D test , 94.1% on D tr and 88.3% on D edit .

Original: For  QA task, we fine-tune a BART base model by maximizing the model likelihood regularized with dropout and label smoothing.
Revised: For the QA task, we fine-tune a BART base model by maximizing the model likelihood regularized with dropout and label smoothing.

Original: The final model attains an accuracy (exact match between model prediction and ground truth) of 23.1% on D test , 56.6% on D tr and 47.9% on D edit .
Revised: The final model attains an accuracy (exact match between model prediction and ground truth) of 23.1% on D test , 56.6% on D tr and 47.9% on D edit .

Original: And these results are comparable with results that the model trained and released by Cao et al.
Revised: And these results are comparable with results that the model trained and released by Cao et al.

Original: (2021) has achieved.
Revised: (2021) has achieved.

Original: Transformer-Patcher training details For FC
Revised: Transformer-Patcher training details For FC

Original: , we add one patch for every edit example.
Revised: , we add one patch for every edit example.

Original: For
Revised: For

Original: QA, we employ the teacher forcing setting and count how many target tokens are not assigned to the highest likelihood as the mistake number.
Revised: QA, we employ the teacher forcing setting and count how many target tokens are not assigned to the highest likelihood as the mistake number.

Original: For one edit example, we add up to 5 patches.
Revised: For one edit example, we add up to 5 patches.

Original: FC and QA task share almost the same hyper-parameters.
Revised: FC and QA task share almost the same hyper-parameters.

Original: We repeat one edit example 8 times and feed them to Transformer-Patcher as a batch for training.
Revised: We repeat one edit example 8 times and feed them to Transformer-Patcher as a batch for training.

Original: The initial learning rate is set as 0.01.
Revised: The initial learning rate is set as 0.01.

Original: Adam optimizer (Kingma & Ba, 2015) is applied for both tasks.
Revised: Adam optimizer (Kingma & Ba, 2015) is applied for both tasks.

Original: Every patch is initialized with the normalized corresponding query q e | q e | 2 .
Revised: Every patch is initialized with the normalized corresponding query q e | q e | 2 .

Original: Such a method makes each patch activated with an initial activate value 1.
Revised: Such a method makes each patch activated with an initial activate value 1.

Original: The patch value v p ∈ R n × d is parameterized as element-wise production of two matrices: v ′ p ∈ R n × d and n p ∈ R n × d , v ′ p is initialized with the random number between 0 and 1, and elements in n p is initialized with a integer 5 to make the patch value dominant over existing values V .The
Revised: The patch value v p ∈ R n × d is parameterized as element-wise production of two matrices: v ′ p ∈ R n × d and n p ∈ R n × d , v ′ p is initialized with the random number between 0 and 1, and elements in n p is initialized with an integer 5 to make the patch value dominant over existing values V .The

Original: parameter k a mentioned in equation 30 is set as 5, and parameter k for memory loss is set as 1000.
Revised: parameter k a mentioned in equation 30 is set as 5, and parameter k for memory loss is set as 1000.

Original: All hyper-parameters are chosen by running  few examples on  validation set.
Revised: All hyper-parameters are chosen by running a few examples on the validation set.

Original: Baseline implementation details For KE, we directly utilize the released trained HyperNetwork for conducting SME experiments (Cao et al., 2021).
Revised: Baseline implementation details For KE, we directly utilize the released trained HyperNetwork for conducting SME experiments (Cao et al., 2021).

Original: For MEND, there is no HyperNetwork released and we re-implement the released code with hyperparameters set as Mitchell et al.
Revised: For MEND, there is no HyperNetwork released and we re-implement the released code with hyperparameters set as Mitchell et al.

Original: (2022a).
Revised: (2022a).

Original: We employ fine-tuning-based methods following Mitchell et al.
Revised: We employ fine-tuning-based methods following Mitchell et al.

Original: (2022a) and Cao et al.
Revised: (2022a) and Cao et al.

Original: For all fine-tuning-based baselines, we set  learning rate as 1e-5 and utilize Adam optimizer to finetune the model until the mistaken example is corrected.
Revised: For all fine-tuning-based baselines, we set the learning rate as 1e-5 and utilize Adam’s optimizer to fine-tune the model until the mistaken example is corrected.

Original: For  computation of KL loss for fine-tuning +KL-constraints baselines, we randomly sample a batch of examples in  memory set with the size of 512.
Revised: For the computation of KL loss for fine-tuning +KL-constraints baselines, we randomly sample a batch of examples in a memory set with the size of 512.

Original: For SERAC (Mitchell et al., 2022b), we implement one variant of it: SERA.
Revised: For SERAC (Mitchell et al., 2022b), we implement one variant of it: SERA.

Original: The SERAC maintains a cache of all edit examples.
Revised: The SERAC maintains a cache of all edit examples.

Original: Given an input, it first employs a scope classifier to estimate if the input is relevant to (falls in the scope of) any cached edit examples.
Revised: Given an input, it first employs a scope classifier to estimate if the input is relevant to (falls in the scope of) any cached edit examples.

Original: If so, it then employs a counterfactual model (needs to have the identical output space as the original model) to produce the output relying on the most relevant cached example.
Revised: If so, it then employs a counterfactual model (needs to have the identical output space as the original model) to produce the output relying on the most relevant cached example.

Original: Otherwise, it returns the output of the original model.
Revised: Otherwise, it returns the output of the original model.

Original: In our proposed SME experiment setting, the in-scope examples have the same label as the edit example, thus the function of **the counterfactual model is to reproduce the answer of the relevant example.
Revised: In our proposed SME experiment setting, the in-scope examples have the same label as the edit example, thus the function of the counterfactual model is to reproduce the answer of the relevant example.

Original: During the implementation of QA, we choose the Bart-base as the counterfactual model, but we find is not trivial for the Bart model to reproduce the answer, thus it is more practical to directly return the label of the cached edit example.
Revised: During the implementation of QA, we choose the Bart-base as the counterfactual model, but we find is not trivial for the Bart model to reproduce the answer (the original paper use T5 for generation tasks), thus it is more practical to directly return the label of the cached edit example.

Original: We refer to this direct-return-method as SERA and include it as our baseline for both Fact-Checking and Question-Answering task.
Revised: We refer to this direct-return method as SERA and include it as our baseline for both Fact-Checking and Question-Answering tasks.

Original: All other implementation details  are the same as the original paper (Mitchell et al., 2022b).
Revised: All other implementation details about SERA are the same as the original paper (Mitchell et al., 2022b).

Original: Environment details For all methods we run SME experiment n =20 times on n different edit folder simultaneously using 8 NVIDIA Tesla V100 GPUs.
Revised: Environment details For all methods, we run SME experiment n =20 times on n different edit folders simultaneously using 8 NVIDIA Tesla V100 GPUs.

Original: And it cost around 1 hour for running
Revised: And it cost around 1 hour for running

Original: Trnasformer-Patcher on FEVER and around 3 hours on zsRE.
Revised: Trnasformer-Patcher on FEVER and around 3 hours on zsRE.

Original: C E XTRA EXPERIMENT RESULTS
Revised: C E XTRA EXPERIMENT RESULTS

Original: [Table] Variation of locality with  number of edits The metric ER, TestR and TrainR reflect the locality of the final model, but how models behave in the middle is still unclear to us.
Revised: Variation of locality with the number of edits The metric ER, TestR, and TrainR reflect the locality of the final model, but how models behave in the middle is still unclear to us.

Original: Thus we choose KE, MEND, FT(all)+KL and Transformer-Patcher and investigate how their locality varies with the number of edits on the QA task.
Revised: Thus we choose KE, MEND, FT(all)+KL, and Transformer-Patcher and investigate how their locality varies with the number of edits on the QA task.

Original: The results are shown in Figure 7.
Revised: The results are shown in Figure 7.

Revised: As editing continues,

Revised: [Table]

Original: As editing continues, more and more damage has been done to the model by other baselines, except Transformer-Patcher.
Revised: [Table] w/o l m 0. KL 0. more and more damage has been done to the model by other baselines, except Transformer-Patcher.

Original: [Figure]
Revised: [Figure]

Original: Standard deviation of experiment results Since some values in Table 1 and Table 3 are very close, we report the standard deviation in Table 5.
Revised: Standard deviation of experiment results Since some values in Table 1 and Table 3 are very close, we report the standard deviation in Table 5.

Original: Note that the SR and the GR are calculated using all different folders at the same time, the standard deviation is therefore 0.
Revised: Note that the SR and the GR are calculated using all different folders at the same time, the standard deviation is therefore 0.

Original: According to Table 5,
Revised: According to Table 5,

Original: Transformer-Patcher achieves the smallest deviation on ER, TrainR, and TestR.
Revised: Transformer-Patcher achieves the smallest deviation on ER, TrainR, and TestR.

Original: Statistics of activation values of different patches In order to study the activation situation of patches on different examples.
Revised: Statistics of activation values of different patches In order to study the activation situation of patches on different examples.

Original: we present the mean and deviation of absolute patches activation values on three different mistakes: 1) Edit: the mistake for which the patch is added; 2) Past-edit: mistakes from previous edit examples; 3) Random: mistake of examples randomly sampled from
Revised: we present the mean and deviation of absolute patches activation values on three different mistakes: 1) Edit: the mistake for which the patch is added; 2) Past-edit: mistakes from previous edit examples; 3) Random: mistake of examples randomly sampled from

Original: D test .
Revised: D test .

Original: As BERT and BART utilize GeLU, both positive and negative activation values could activate the patch.
Revised: As BERT and BART utilize GeLU, both positive and negative activation values could activate the patch.

Original: We employ absolute value to measure to what extent the patch is activated.
Revised: We employ absolute value to measure to what extent the patch is activated.

Original: The results are shown in Table 4.
Revised: The results are shown in Table 4.

Original: First, the T-Patcher w/o l m attains the highest value for Edit queries, indicating [Table] [Table] [Table]
Revised: First, the T-Patcher w/o l m attains the highest value for Edit queries, indicating the effectiveness of our activation loss.

Original: [Table]

Original: the effectiveness of our activation loss.

Original: Then our memory loss can effectively push the activation values of Past-edit and Random queries to 0, thus disabling the patch on irrelevant examples.
Revised: Then our memory loss can effectively push the activation values of Past-edit and Random queries to 0, thus disabling the patch on irrelevant examples.

Original: The
Revised: The

Original:  KL Patch has the lowest activation value of Edit query on both tasks, which explains the lower SR of QA in Table 3.
Revised: [Table] [Table] KL Patch has the lowest activation value of Edit query on both tasks, which explains the lower SR of QA in Table 3.

Original: Editing results of Transformer-Patcher with fixed memory set The experimental results 1 are obtained using a memory set that  updated with the editing proceeds.
Revised: Editing results of Transformer-Patcher with fixed memory set The experimental results 1 are obtained using a memory set that is updated with the editing proceeds.

Original: Thus in Table 6 we present the editing results of Transformer-Patcher using a fixed memory set.
Revised: Thus in Table 6 we present the editing results of Transformer-Patcher using a fixed memory set.

Original: We only observe a slight decline in ER and a slight rise in TrainR.
Revised: We only observe a slight decline in ER and a slight rise in TrainR.

Original: The results further show the robustness of our method.
Revised: The results further show the robustness of our method.

Original: Besides, we have to highlight that our method allows us to save more previous edits as memory and leverage more memories in the training process.
Revised: Besides, we have to highlight that our method allows us to save more previous edits as memory and leverage more memories in the training process.

Original: Because we do not need to save original raw data but only corresponding input queries (several constant vectors that do not require gradients).
Revised: Because we do not need to save original raw data but only corresponding input queries (several constant vectors that do not require gradients).

Original: On the contrary,
Revised: On the contrary,

Original: KL requires feeding a mini-batch of raw data into the pre-edit model and post-edit model separately, thus the GPU memory becomes a restriction of the number of memories utilized in one batch.
Revised: KL requires feeding a mini-batch of raw data into the pre-edit model and post-edit model separately, thus the GPU memory becomes a restriction of the number of memories utilized in one batch.

Original: But
Revised: But

Original: Transformer-Patcher could apply hundreds of thousands of memory vectors in one batch and cost minimal GPU memory and computation resources.
Revised: Transformer-Patcher could apply hundreds of thousands of memory vectors in one batch and cost minimal GPU memory and computation resources.

Original: Contradictory of lower E and lowerlower TestR in Table 

Revised: Contradictory of lower E and lower TestR in Table

Original: It seems inconsistent that Transformer-Patcher has achieved fewer E and lower TestR than FT(all)+KL method.
Revised: It seems inconsistent that TransformerPatcher has achieved fewer E and lower TestR than FT(all)+KL method.

Original: Because one would expect the model to reduce future errors and behave better on the test set by fixing errors.
Revised: Because one would expect the model to reduce future errors and behave better on the test set by fixing errors.

Original: The phenomenon may be because of the data distribution gap between the edit set and  test set.
Revised: The phenomenon may be because of the data distribution gap between the edit set and the test set.

Original: Thus the improvement of ”reducing future errors” can not directly lead to higher TestR. For FEVER, the accuracy of the initial model attains 88.3% on the edit set and 76.9% on the test set.
Revised: Thus the improvement of “reducing future errors” can not directly lead to higher TestR. For FEVER, the accuracy of the initial model attains 88.3% on the edit set and 76.9% on the test set.

Original: For zsRE, the accuracy of the initial model attains 47.9% on the edit set and 23.1% on the test set.
Revised: For zsRE, the accuracy of the initial model attains 47.9% on the edit set and 23.1% on the test set.

Original: A distinct gap between the edit set and test set is observed.
Revised: A distinct gap between the edit set and test set is observed.

Original: Thus we should comprehensively consider all metrics to evaluate methods.
Revised: Thus we should comprehensively consider all metrics to evaluate methods.

Original: Another reasonable explanation is that our modified model may slightly overfit the edit example.
Revised: Another reasonable explanation is that our modified model may slightly overfit the edit example.

Original: But fitting more to edit examples may be a desired feature in actual application because we expect the model to be closer to the real data met during deployment. 
Revised: But fitting more to edit examples may be a desired feature in actual applications because we expect the model to be closer to the real data met during deployment. A CKNOWLEDGMENTS

Revised: This work was partially supported by the State Key Laboratory of Software Development Environment of China under Grant SKLSDE-2023ZX-16.