Massive Editing for Large Language Models via Meta Learning
Authors: Chenmien Tan
Ge Zhang
Jie Fu
Venue: ICLR 2024 poster (2024)
Keywords: Language Model
Model Editing
Meta Learning
Primary area: transfer learning, meta learning, and lifelong learning

Abstract: While large language models (LLMs) have enabled learning knowledge from the pre-training corpora, the acquired knowledge may be fundamentally incorrect or outdated over time, which necessitates rectifying the knowledge of the language model (LM) after the training. A promising approach involves employing a hyper-network to generate parameter shift, whereas existing hyper-networks suffer from inferior scalability in synchronous editing operation amount (Hase et al., 2023b; Huang et al., 2023). For instance, Mitchell et al. (2022) mimics gradient accumulation to sum the parameter shifts together, which lacks statistical significance and is prone to cancellation effect. To mitigate the problem, we propose the MAssive Language Model Editing Network (MALMEN), which formulates the parameter shift aggregation as the least square problem, subsequently updating the LM parameter using the normal equation. To accommodate editing multiple facts simultaneously with limited memory budgets, we separate the computation on the hyper-network and LM, enabling arbitrary batch size on both neural networks. Our method is evaluated by editing up to thousands of facts on LMs with different architectures, i.e., BERT-base, GPT-2, and GPT-J (6B), across various knowledge-intensive NLP tasks, i.e., closed book fact-checking and question answering. Remarkably, MALMEN is capable of editing hundreds of times more facts than MEND (Mitchell et al., 2022) with the identical hyper-network architecture and outperforms editor specifically designed for GPT, i.e., MEMIT (Meng et al., 2023).

Published as a conference paper at ICLR 2024
MASSIVE EDITING FOR LARGE LANGUAGE MODELS VIA META LEARNING
Chenmien Tan'; Ge Z Jie Fust University of Edinburgh', University of Waterloo", 01.AF, HKUST chenmien. tan Laneed.at ac..ac.uk. gezhang@ edu, jiefulust.hk
ABSTRACT
While large language models (LLMs) have enabled learning knowledge from the pre-training corpora, the acquired knowledge may be fundamentally incor- rect or outdated over time, which necessitates rectifying the knowledge of the language model (LM) after the training. A promising approach involves employ- ing a hyper-network to generate parameter shift, whereas existing hyper-networks suffer from inferior scalability in synchronous editing operation amount (Hase et al., 2023b; Huang et al., 2023). For instance, Mitchell et al. (2022) mimic sum the parameter shifts together, which lacks statis-
gradient accumulation tical significance and is prone to cancellation effect. To mitigate the problem, we propose the MAssive Language Model Editing Network (MALMEN), which formulates the parameter shift aggregation as the least square problem, subse- quently updating the LM parameters using the normal equation. To accommo- date editing multiple facts simultaneously with limited memory budgets, we sep- arate the computation on the hyper-network and LM, enabling arbitrary batch size on both neural networks. Our method is evaluated by editing up to thou- sands of facts on LMs with different architectures, i.e., BERT-base, GPT-2, T5- XL (2.8B), and GPT-J (6B), across various mnowledge-intensive NLP tasks, i.e. closed book fact-checking and question answering. Remarkably, MALMEN is ca- pable of editing hundreds of times more facts than MEND (Mitchell al., 2022) with the identical hyper-network architecture and outperforms editor specifically designed for GPT, i.e., MEMIT (Meng al., 2023). Our code available https://gitiie com/ Cetheemiienaann.mm /m mmannen..
INTRODUCTION
Large language models (LLMs) have exhibited the ability to acquire knowledge from pre-training corpora and demonstrated promising performance in knowledge-intensivy NLP tasks such as fact verification and question answering (Thorne et al., 2018; Petroni et al., 2019; Roberts et al., 2020). However, such knowledge may be factually incorrect and outdated over time. For instance, lan- guage model (LM) trained before 2023 probably predicts "Paris Saint-Germain rather than "Inter Miami CF" when prompted with "What sports team does Messi play for?". A straightforward rem- cdy is to fine-tune the model on the corrected datasets, whereas such an approach suffers the risk of overfitting and catastrophic forgetting (Kirkpatrick al., 2017: Zhu et al., 2020). It is challenging to edit the model precisely as the knowledge is implicitly and distributionally encoded in the param- eters of LM. An ideal editing method is expected be (i) generalizable, where the model behaves consistently across a different formulation of an injected fact and (ii) local, where the updates do affect the remainder of the acquired knowledge (De Cao et al., 2021; Mitchell al., 2022).
Several lines of research have investigated editing LM effectively and locally (Dai et al.. 2022; Huang et al., 2023), among which an emerging approach entails training hyper-network generate updated parameters (Ha et al., 2017; De Cao et al., 2021; Hase et al., 2023b; Mitchell et al., 2022). Unlike fine-tuning, hyper-networks can explicitly designate editing generalizability and locality as objectives, learning to uphold the consistency and reliability of the LM (De Cao et al., 2021; Hase
Work done while interning at HKUST.
1 "ooresponniig author.

---

Published as a conference paper at ICLR 2024
et al., 2023b; Mitchell et al., 2022). Recognizing that pre-trained weight is a good initialization, De Cao et al. (2021); Hase et al. (2023b); Mitchell et al. (2022) predict the parameter shift rather than directly generating the updated parameter. Existing heper-networks also generate the parameter shift conditioned on the standard fine-tuning gradient as the gradient serves as a viable starting point for model editing and provides rich insights into how knowledge is encoded within the LM (De Cao et al., 2021; Hase et al., 2023b; Mitchell et al., 2022).
Although existing neper-networks have shown notable performance in editing single or few facts, they exhibit limited scalability in synchronous editing operation amount (Hase et al., 2023b; Huang al., 2023). Due to the consideration of computation complexity, the language model is typically frozen when training the hyper-networks (De Cao et al., 2021; Hase et al., 2023b; Mitchell et al., 2022). following downside that the hyper-networks tend to overfit to the present state of the LMM, allowing for only few updates before necessitating re-training to adapt to the LM's new state, which renders meta-learning computationally expensive for mass editing in actual industrial scenarios (Hase et al., 2023b; Huang et al., 2023). Hase et al. (2023b) sought to extend meta- learning to sequential editing but only scale to few, egg., 10, updates. In this paper, we focus on another direction, which is to edit multiple facts at once so that the cost of training the hyper-network amortized to each editing is lower.
There are mainly two challenges to the issue: (i) the impact of varying edits the model parameters may be contradictory, making it difficult to ascertain the parameters effective for all facts to be injected (Yu et al., 2020); (ii) training hyper-networks to edit large number of facts simultaneously results in substantial memory consumption, potentially exceeding the hardware limit. Regarding the first challenge, existing hyper-networks resort mimicking gradient accumulation to sum the parameter shifts together, which lacks statistical significance and is prone to cancellation effect (Mitchell al., 2022). In contrast, we formulate the parameter shift aggregation as least square problem to seek for the parameter shift effective for all facts to be injected. For the second challenge, instead of concatenating the hyper-network to the L.M, we delineate the computation between the hyper-network and L.M. The decomposition permits arbitrary batch sizes on both neural networks, significantly reducing the memory required.
The primary contribution of this work is LM editing algorithm called MAssive Language Model Editing Network (MALMEN), which is designed for scalability across numerous facts while main- taining commendable editing performance and economical memory consumption. Empirical evalu- ations are conducted to edit up to thousands of facts on LMs with diverse architectures, i.e., BERT- base (Devlin al., 2019), GPT-2 (Radford et al., 2019), T5-XL (2.8B; Raffel et al., 2020), and GPT-J (6B; Wang & Komatsuzaki, 2021) across various knowledge-intensiv NIP tasks, i.e., closed book fact verification and question answering. We also perform ablation studies to elucidate the effect of design components of MALMEN.
RELATED WORK
Several lines of research have investigated on model editing, including fine-tuning with hard con- straint (Zhu et al., 2020), editing with external memory (Mitchell et al., 2023; Hartvigsen et al., 2023; Huang et al., 2023), locate-and-edit (Dai et al., 2022; Gupta et al., 2023; Hase et al., 2023a), and meta-learning (Sinitsin al., 2020; De Cao et al., 2021; Mitchell et al., 2022). We refer readers to Yao et al. (2023) for a comprehensive survey.
Editing with External Memory Mitchell et al. (2023) store edits in an explicit memory, utilizing a scope classifier to evaluate the probability that an input falling within the realm of a stored edit point. If the input matches any point in the storage, the counter-factual model generates output conditioned on the input and edit point. Huang et al. (2023) address an LM error by incorporating an network (FFN) of the last Transformer block. By leveraging
additional neuron into the the sparsity of GeLU activation function (Hendryeks & Gimpel, 2016), the neuron is trained to be only valid for in-scope inputs, then the inserted neuron does not alter the output of unrelated input.
Locate-and-edit Dai et al. (2022) employ integrated gradients (Sundararajan al., 2017) to pin- point the location of knowledge within LM at the neuron level. Drawing inspiration from Geva et al. (2021), Dai et al. (2022) hand-craft modifications the value slots corresponding to knowledge
2

---

Published as a conference paper at ICLR 2024
neurons to rectify LM outputs. Meng et al. (2022; 2023) measure the efficacy of hidden states in GPT for fact recall through causal tracing (Vig et al., 2020), where the representation the subject's last token within the FFN at intermediate layers to be significant. On the basis, Meng et al. (2022; 2023) conceptualize the linear layers as a key-value memory association and modify the value of effective hidden states. However, Hase et al. (2023a) observe that representation denoising provides limited insights into the best layer for model editing.
Meta-learning Sinitsin al. (2020) describe a bi-level meta-learinng that identifies model ini- tialization for quick fine-tuning. De Cao et al. (2021); Mitchell et al. (2022) learn to transform the standard fine-tuning gradient to a more targeted parameter shift, where they mainly focus on build- ing light-weight hyper-networks as naive multi-layer perception (MLP) that intakes the gradients and outputs the parameter shifts of linear layer suffer a quadratic complexity with respect to the hidden size. Specifically, De Cao et al. (2021) pose LSTM (Hochreiter & Schmidhuber, 1997) to project the sentence embedding into rank-1 masks (Krueger al., 2017) over the gradients; Mitchell et al. (2022) decompose the gradient into the outer product of keys and value gradients and apply low-rank MLPs (Hu et al., 2022) to refine the keys and value gradients.
PROBLEM FORMULATION
Let X' be the prompt set and y be the answer set, e.g., for fact verification, the answer set binary, iee. {True, False); for question answering, the answer set is the vocabulary set. For each edit prompt-answer tuple (Ir,)) X x V, let
Elx, v) C X x ) be the equivalent tuple collection subject to (æ, v) such that (af, y²) is semantically equivalent to (x.,)) y) for any (x²,y²) F(,,, y). For example, for the edit tuple ("Whhtt is the capital of China?", "Beijing."), "), equivalent tuple is ("Of what country is Beijing the capital?", "China.));
Uzz y) (X x Ex,, y) be the unrelated tuple collection subject (x. y). where (x", is unrelated to (z, y) for any (x","") ) E U(z, v). For the edit tuple example above, an unrelated tuple is ("What the capital of the United States?". "Washington D.C.")
Let p: X' x [0, be the LM that maps each prompt-answer tuple (a, to the probability p(y(z) that is the answer to the prompt x. We parameterize the LM by W (W; E L} and then denote the LM as pw, where We is the weight of the linear layer and L is the collection of trainable linear layers in the LM.
Our goal is to edit mn prompt-answer tuples M simultaneously, generalize to their equiva- lent tuple collection Um E(x,, 34). and maintain the the prediction for unrelated tuple collection n Uv,, v1) = (X' x ) U E(z,,0) y:) unchanged. In this regard, we measure the performance of the editing using the editing success (ES), generalization success (GS), and locality success (LS)
defined as follows:
ES = P ((..))
y arg max Pw (1'zz) v'EY
GS = P P(r9)))~U B(aan)
yf = arg max (y)()) DEY
LS (("",""~~" U(ra)))))
y" arg max Pyy Pyv (1/2z")) yey
where W [W, e e L} is the post-edit weight.
4 METHOD
In this section, we introduce MALMEN, an LM editing hyper-network that generates parameter shifts with generality and locality conditioned on the standard fine-tuning gradient. MALMEN enjoy
3

---

Published as a conference paper at ICLR 2024
commendable scalability in synchronous editing operation amount with the identical architecture with MEND (Mitchell et al., 2022). Recall that scaling meta-learning to multiple editing mainly faces two challenges: (i) The parameter shifts corresponding to different facts may be contradictory, making it challenging to determine a parameter shift effective for all facts (Yu et al., 2020); (ii) is memory demanding to accommodate the representation of numerous facts into the hyper-network simultaneously. We address these difficulties in the following two subsections, respectively.
4.1 AGGREGATING PARAMETER SHIFTS USING THE NORMAL EQUATION
Let us firstly consider single linear layer with weight W Idd' which transforms input (key) E Rd into output (value) v = Wu E RR (We omit the bias term for simplicity). MEND go : Rd x Rd' + Rdd'dd leverages low-rank decomposition to transform the raw gradient into a more targeted pseudo gradient. Specifically, the tuple of key u and value gradient V. (where L is the standard fine-tuning loss) are fed into the hyper-network ge to generate parameter shift S= go V, E I2 xd (see Appendix A. 1 for the detail). When editing m prompt-answes tuples (az, ys) (that contains tokens in total) simultaneously, MEND cache the tuples (uj, D)j and generate parameter shifts (S for all tokens and update the weight W by summing the parameter shifts, i..,, W < W + ク Sj (Mitchell et al., 2022). The procedure of summing the parameter shifts bears resemblance to gradient accumulation in supervised learning, where the stochastic gradient of each batch acts a Monte Carlo estimation of the expected gradient, rendering their means an unbiased estimator of the expected gradient. However, in the case of parameter shifts generated by the hyper-network, summing them lacks statistical significance. We contend that such summing could potentially give rise to a cancellation effect, where the parameter shifts corresponding to differing keys exhibit significant magnitudes that counteract each other (Yeh al., 2022).
Inspired by Meng et al. (2022; 2023), we consider the linear layers in the FFNs of Transformers as key-value memories. Given that a linear layer with weight W transforms key into value e Wu, the effect of a parameter shift S subject to key Wu + Su. Now let (S,...,,S,) E Rexdd xd be the parameter shifts subject to the key matrix U == (W1....,"u, un) E Rdx= Our aim is to aggregate the parameter shifts, or equívalently, find single parameter shift with nearly the same effect. We formulate as the following (regularized) least square problem, where D = =(11...,, dr,) E IR'' x is the value difference matrix such that d, Syu, Vj E [n]. The intuition is that the optimal parameter shift S* has nearly equivalent effect with parameter shifts (Si,..., S..) as it approximately maps each key uj into the value difference dj. We add the regularization term A|| S112 to guarantee the numerical stability when U is not row-wise full rank, where À is a learnable parameter.
to change the value from v Wu to
S,)
min SER xa ||SU D112 2|SS1|
The solution to the above optimization problem is the normal equation: S' DUU(UUT (UUT+AI)) +1)- In this regard, we can modify the weight of a linear layer by a similar procedure with MEND but computing the value difference matrix D and then update using the normal equation instead of summing the parameter shifts.
Algorithm 1: Editor Inference
We edit linear layers f E L using the above procedure simultaneously, which yields the al- gorithm summarized in Alg. where ue and Ve, denote the key and value subject to the lin- ear layer l and the j-th token of the prompt- answer tuples (I,, 1) and Ug. De and S; denote the key matrix, value difference matrix and optimal parameter shift of linear layer L, respectively. As a comparison, the red line is unique for MEND (Mitchell et al., 2022), and the blue lines are unique for MALMEN. Notice that one may choose L as subset of linear lay- ers in the LM by freezing other linear layers or cache ju V Vu,,, I.) for subset of tokens in
Input: Edit tuples (zi, y) L + Em log Pw (w Cache (ue, (ue,))ecc.jC()) Back-propagate L Cache (V D)EECSEIn) Se, & go Vel, L), Vl E C,j e [n]
ST + Se Ve E
des <- Se,mer, V E [n]
Ut [..,, uej..... 1.......e De +-
VL ST + DrU? +NIE--
We t- W7+ E
W (e:: WWE:
4

---

Published as a conference paper at ICLR 2024
the prompt-answer tuples (æ,, y:) Notice also that when editing several layers simultancously, the changes in former layers will affect the keys to the latter layers, and thus the post-edit keys to the linear layer are different from those in the updating formula. However, the issue similarly occurs in the standard fine-tuning and does not lead to empirical failure (see Appendix A.3 for a detailed discussion).
4.2 MEMORY ECONOMIC TRAINING
Recall the editing purpose is that the post-edit LM Pwv can generalize to the equivalent tuple col- lection U E(x;, y4) and maintain the prediction for unrelated tuple collection n (2 yi un- changed. Following De Cao al. (2021); Mitchell et al. (2022), we set the negative log-probabilityy as the generalization loss Lien and the KL divergence as the locality loss Lioe as follows. The total meta loss Lmeta is a weighted sum of the generalization loss Lgon and locality loss Lioes where Aloe is hyper- paramerr that governs the locality weight.
Leen (0) = - Re .²t) ~ Eluss
Line Ee NE U(a.. v.)
Dxi (pw (1lx
Lieet (0) = Lgea(() (0) + Aooc
In practice, we sample an equivalent tuple (rf of) and locality tuple (x. vf") for each edit tuple (z,, y:) to compute the empirical meta loss. Notice that the meta loss Limeta a function of the hyper-network parameter concatenate the hyper- network to the LM so that the meta loss can be back propagated into the hyper-network (De Cao et al., 2021; Mitchell et al., 2022), as illustrated in Figure 1. However, it requires caching all intermediate variables in the hyper- network to prepare for the pack-propagation. Recall that the total number of cached tuples (ue.s Vu.. L)eEc.jein equals to the number of linear layers to be edited multiply the num- ber of tokens n in the prompt-answer tuples (I), y1 which can be enormous when edit- ing thousands of facts. It is problematic to compute the meta gradient Vo by follow- ing the traditional procedure due to exceedingly high memory costs.
(ues V Deecssi
(af, - (af x
Hyper Network ge
Language Model par
0. Traditionally
W
back prop.
Iynets
Figure The procedure to compute Volmeta in Mitchell et al. (2022). The cached tuples are fed into the hyper-network to generate the up- dated LM parameter, which is differentiable w.r.t the hyper-network parameter. After feeding the equivalent and unrelated prompt-answe tuples into the LM, the meta loss is back propagated along the red arrow.
To allow back-propagation on both neural net- works with arbitrary batch size, separate the phok-propagatton on the LM and hyper- network. In the first stage, equivalent and un- related tuples are fed into the LM in batches and the meta gradients are accumulated on linear layers é E L to obtain (V W. Leeta) whose size is constant w.r.t. the number of edits. In the second stage, we manually compute the meta gradient w.r.t. each value difference de,, when needed following Vde, Imeta V W Lmeta (U.U?" + Ael)--uee, (See Theorem 1), then the component of the meta gradient VoLmeta contributed by the tuple (Me,j Vv,,L) L) can be computed through baok-propagating the proxy loss Va,,, Um.tade,j. This allows us to com- pute the meta gradient Vo by dividing
Algorithm 2: Editor Training
Input: (I Vi, o uf xr, )
W + Editor Inference ((2,, y:)
Cache (ue,j, V.,, Lijec) and (S)) Compute Timeta following Equation (1)
Back-propagat Timeta on the LM Cache (V w. Lmetta)ec
Ue [..., W. I.I. J.
Me < V W. Timeta (U.U? + - V Timeta +- M,U,, Ve E
dLmneta/ /dve + -ts(M Sr. + go go Voe, L)
de,, + Se, ve L.j In]
Dj + [..., "..,dejj... de.j......" VL
+ Eesc tr (r.V LT Dz) Back-propagat, Ż
5

---

Published as a conference paper at ICLR 2024
(me 36)
(ves Vog Deecdeee (Vi)
(of, 14) (n) (iv)
()
Cache (ua))eecee())
Language Model pa
Hyper Network
Language Model ps
(ii))
W
( Cache (en tvi)
(vii)
(iv)
L
L
Immtt
The overall procedure compute the meta gradient Vo (i) The edit prompt- answer tuples (24, (1),3)))= are fed into the LM pw, where keys (ue.s)eec.JE()) are cached. (ii) Back-propagate the standard fine-tuning loss L and cache the gradient with respect to values, i.e. (Ve., (iii) Feed cached tuples (ue.j, Vee,j.Vee.,L L).c)),e into the hyper-network Do to infer the updated LM parameter W without caching any intermediate variable. (iv) Feed the equiv- alent and unrelated tuples (xf, y ) ..,,y," )² into the post-edit LM Pyv (v) Back- propagte the meta loss Lmmet linear layers & E L and compute Lmettaec and (dLmeta/ /dde) (vi) Again, feed the cache tuples (We.j V Vv,, L)sEc.jE(M) into the hyper-network go to generate the value difference matrices (De)Eec but with the training mode. (vii) Back propagate the proxy loss L ElEc,jE(n) Vde,, Liectaie All inputs to neural networks, including (2t, Ys. xf, v., y ) and (ut.j, V Vor, L)je).))())) can be split into batches, where the gradients of the meta loss Lmeta and proxy loss L are accumulated.
Figure 2:
",,
the cached tuples (ue.j. Ver, oz [) into batches and accumulating the gradient component contributed by tuples from different batches. Recall that the regularization factor X train- able parameter. We also compute its gradient by manually back- propagating the meta loss, i.e. d.T.mtt./ /d/, -tr(V (Theorem 2). Notice that computation amount and result are identical to the traditional proce- dure, while the decomposition substantially reduces the memory required. The overall algorithm to compute the meta gradient V Lmmeta is summarized in Alg. 2 and fig. 2. After obtaining the meta gradient V Luueta the hyper-network parameter updated by the Adam optimizer (Kingma & Ba, 2015).
w. T-meta
UU,UZ + -
-tr(V ''meta' (U,U?++ -
EMPIRICAL EVALUATION
primary objective of MALMEN is to achieve scalability in synchronous editing operation amount, where the algorithm is anticipated to be effective (as measured by ES, GS, and LS) and efficient (in terms of computation time and memory usage). Our experimentation aims to (i) assess the scalability of the editing performance subject the number of edits, and (ii) elucidate the impact of MALMEN's design elements.
The experiments are implemented LMs with different architectures. i.e. BERT-base (Devlin et al., 2019), GPT-2 (Radford et al., 2019), T5-XL (2.8B; Raffel et al., 2020), and GPT-J (6B; Wang & Komatsuzaki, 2021) in various knowledge-intensin and question answering. For BERT-base, we use the Fact Extraction and VERtification (FEVER) dataset (Thorne et al., 2018) with the identical train/val splits with De Cao al. (2021); Mitchell et al. (2022), which contains 104,996 training and 10,444 validation samples. The unrelated tuples (x y ym are randomly sampled from FEVER2 (Thorne et al., 2019). Before the editing, we concatenate the LM to linear layer that maps the final hidden state of the BOS (beginning of the sentence) token to a log probabibbyyy and fine-tune the whole model on the FEVER dataset (see Appendix A.4 for the detail). During the editing, to simulate the scenario in practice, the answers in the edit and equivalent tuples are opposite to the ones when fine-tuning. For GPT-2, T5-XL, and GPT-J, the shot Relation Extraction (zsRE) question answering dataset (Levy et al.,
NLP tasks, i.e., closed book fact verification

---

Published as a conference paper at ICLR 2024
2017) with the identical train/val splits with De Cao al. (2021); Mitchell al. (2022), which has 244,173 training and 27.644 validation instances. The unrelated tuples (x y )= are sampled from Natural Questions (NQ; Kwiatkowski et al., 2019). Due to the difficulty of fine-tuning all parameters of T5-XI. and GPT-J and fine-tune a subset of the parameters can lead to unfair comparison, in contrast to BERT-base, we do not fine-tune GPT-2, T5-XI,, and GPT-J before the editing. We also use the correct answers to the edit and equivalent prompts to edit GPT-2, TS-XL and GPT-J. Notice that this setting is identical Mitchell et al. (2022). To better evaluate the locality of editing, we use the publicly available version of TS-XL fine-tuned on NQ.
Meng et al. (2022; 2023) but different with De Cao al. (2021);
5.1 SCALING CURVE
We compare MALMEN with fine-tuning (FT; Appendix A.5), MEND, and MEMIT. To scale MEND to multiple editing with limited mem- ory budget, we use a re-implementation us- ing a similar method with Section 4.2. In contrast to Meng et al. (2023): Huang et al. (2023), who deploy MEND trained by Mitchell et al. (2022) for making single edit, we train and evaluate MEND applying simultane- ous edits. The hyper-parameter of MEND is also tuned achieve better performance in multiple editing scenario. We use identical pyper-parameters for MALMEN across dif- ferent models and tasks. For BERT-base, GPT- 2, and GPT-J, we select L as the second lin- layer in the FFN of the last Transformer blocks and only cache the tokens that output the answer, e.g., for BERT-base, the BOS to- ken. For T5-XL, we select as the second linear layer in the FFN of the last Transformer blocks in both encoder and decoder. An example of GPT-J is illustrated in Figure 3.
Lionel
Attention
FC
Messi
plays
football
(Paayer 6)
6x
Figure 3: Hooked module GPT-J. The module
of interest is highlighted with yellow pentagram.
0.9
0.9
0.8
8
0.7
MEND MALMEN
0.5
0.5
10"
10
10"
10"
10" Number edits
10"
Number edits
Number edits
Figure 4: Scaling curve of BERT-base 10M)
1.0
0.17
0.9
0.9
0.16
0.8
0.8
0.15
0.7
0.7
FT
MEND MALMEN
0.14
0.6
0.6
0.13
10"
10
10
Number of edits
Number of edits
Number of edits
Figure 5: Scaling curve of GPT-2 (124M)
We present the scaling curves of small models, i.e., BERT- and GPT-2, in Figures 4 and 5, where the number of edits m is varied from 2 to 2 and 26 to 2 respectively. All experiments are repeated at least times where the shaded area represents the standard deviation. MALMEN demonstrates the strongest scalability across the number of edits. Compared to MEND, MALMEN

---

Published as a conference paper at ICLR 2024
edit over order of magnitude more facts with similar performance. On BERT-base fine- tuning is fragile, where a slightly larger or smaller learning rate causing failure on LS or ES and GS. This might due to the labels in the editing low loss by merely reversing the output. FT also suffers larger gap between ES and GS compared with MEND and MALMEN, indicating that the parameter shifts generated by hyper-networks enjoy better generalization.
opposite to those in FT, allowing LM achieve
1.00
0.5
0.95
0.90
0.90
0.85
0.4
0.52
0 0.80
0.85
00
9 0.3
0.75
0.75
0.51
FT
0.70
0.70
MEND
0.1
0.65
MALMEN
0.60
10"
10"
0.0
10"
10
10"
10"
10"
10"
Number of edits
Number of edits
Number of edits
Figure 6: Scaling curve of T5-XL (2.8B)
1.00
0.30
0.95
0.98
0.25
0.96
0.20
0.29
d0 0.94
8 0.85
0.15
0.92
0.90
0.80
0.10
0.86
MEMIT
0.05
0.24
0.86
0.00
10"
10'
10"
10"
10"
10
10
10
10"
10"
10"
10"
Number of edits
Number of edits
Number of edits
Figure 7: Scaling curve of GPT-J (6B)
The scaling curves of large models, i.e. T5-XL. and GPT-J, are illustrated in Figures 6 and 7, where the number of edits m is varied from 2 to 21 16, 384 and 2 to 211, As the model scale increases, the performance of all editing methods improve. MALMEN maintains strong scalability, although its LS is slightly lower than the lead (the gap is consistently smaller than 0.02). It is remarkble that MALMEN GPT-J with similar performance and outperforms editor specifically designed for GPT, i.e. MEMIT. As for computation time, it takes 12.25 and 33.75 hours in total (including training) for MALMEN and MEMIT to edit 16,384 facts on GPT-J using a single NVIDIA A A100 GPU, respectively.
edit more than two orders of magnitude more facts than MEND
5.2 ABLATION STUDY
FEVER, m 512
zsRE, m 512
BERT-base (110M)
GPT-2 (124M)
Variant
ES 1
GS (%)
(S)
ES (%)
GS 1
(S) t
Sum param. shifts No regularization Edit first FC in FFN
(1.9) (1.66
(3.9)
(1.4
50.7 (1.4)
17.0 (0.5)
0..
00.0)
0.0 (0.0)
(2.4)
50.3 (1.7)
51.0
97.7 (1.3)
15.8 (1.3)
Cache all tokens
97.0 (0.7)
90.0 (1.4)
90.3 (1.4)
99.2 (0.3)
(0.0)
16.6 (1.0)
MALMEN
93.0 (1.6)
85.8 (2.1)
89.5 (2.1)
99.7 (0.2)
96.1 (0.6)
16.5 (1.0)
Table 1: Ablation study on BERT-base and GPT-2
Table shows ablations of MALMEN's main difference with MEND, where the numbers in brackets represent the standard deviation. "Sum param. shifts" replaces updating using the normal equation by summing the parameter shifts. "No regularization" removes the regularization term in the least square problem. Recall that the input size of the second linear layer in the FFN of BERT-base and GPT-2 is 3072 and 1024, respectively. When m = 512. the normal equation is problematic as key matrix is not rowe full rank. On BERT-base, training cannot be conducted due matrix
8

---

Published as a conference paper at ICLR 2024
singularity error. Although there is enror reported on GPT-2 (possibly due to the limitation of computation precision), MALMEN is unable to converge properly. "Edit first FC in FFN" turns to edit the first linear layer in the FFN of the last 6 Transformer blocks, which generally achieves inferior performance. "Cache all tokens" refers to caching the tuple of key and value gradient for all tokens rather than those output the answer. It is remarkable that "Cache all tokens" enjoys better performance on BERT-base. However, the advantage reverses when continuing to scale the number of facts to be edited, illustrated by Table 2. Moreover, only caching tokens that output the answer also accelerate training and inference (38.9 (38.9% fewer time on single NVIDIA A40 GPU).
zsRE, m 8192
GPT-J (6B)
Variant
ES (
GS f
LS (%) f
Time (h) 4
Cache all tokens
94.0 (0.3)
85.5 (0.7)
25,9 (0.2)
7.2
MALMEN
99.7 (0.0)
92.8 (0.3)
25.1 (0.3)
4.4
Table 2: Ablation study on GPT-J
To see whether the design of normal equation alleviates the cancellation effect, MALMEN is compared with "Sum param. shifts" under different number of edits on GPT-2 in Figure 8. We define the residual subject to linear layer and the j-th
10
10²
10'
Sum snifss
token Tı.j ||5 uz de.]ll/|dd,
which describes the
MALMEN
10
offset volume caused by the parameter shift aggregation, and measure the cancellation effect by the mean residual (MR), i.e., Ii Etec E Te.j- It can be observed that for both meth- ods, MR increases along with the number of edits while the MR of MALMEN is about three orders of mangitude smaller.
10"
10'
Number of edits
Figure 8: Cancellation effect
We also illustrate the effect of memory economic training by varying m from 2 to 213 on GPT-2, as presented by Figure "MEND-style" concatenates the hyper-network to the LM as in Figure 1, which yields substantially higher memory consump- tion and quickly exceeds the hardcore limit. In contrast, the memory consumption of MALMEN grows slowly subject to the number of edits, allowing it to edit thousands of facts single GPU.
Memory (GB)
:00
MEND-style
20
MAI MEN
10
10"
10"
10*
Number of edits
Figure 9: Memory consumption
DISCUSSION
We present an LM editing hyper-network scalable to thousands of facts, called MAssive Language Model Editing Network (MALMEN). Our evaluations demonstrate that, with identical archi- tecture, MALMEN can edit hundreds of times more facts than MEND, and outshines MEMIT, an editor specifically designed for GPT, thereby positioning itself competitive alternative for real- world industrial applications. MALMEN formulate the parameter shift aggregation as a least square problem, subsequently updating the LM parameter utilizing the normal equation. To allow arbi- trary batch size on both neural networks, the computation on hyper-netwond and LM are segregated, making it feasible edit multiple facts with constrained memory limits.
Limitations Although MALMEN achieves decent performance in editing thousands of facts si- multaneously, it requires computation with linear complexity in relation to the number of facts to compute the meta gradient. Additionally, MALMEN still fails to generalize to rephrasings not just occurring in prompts. For instance, an ideal editor could infer from the tuple ("Whht is the capi- tal of France?", "Paris.") to ("Of what country is Paris the capital?"" "France."). Ensuring model consistency over larger scope through local editing remains challenge.

---

Published as a conference paper at ICLR 2024
ACKNOWLEDGEMENT
This work is partially funded by Theme based Research Scheme (T45-205/21-N), Research Grants Council of Hong Kong. We thank anonymous reviewers for their valuable comments. Partial com- putations of this work were performed using HPC services provided by Baskerville at the University of Birmingham and Cirrus the University of Edinburgh.
REFERENCES
Damai Dai, Li Dong, Yaru Hao, Zhifang Sui, Baobao Chang, and Furu Wei. Knowledge neurons in pretrained transformers. In Proceedings of the 60th Annual Meeting of the Association for Compu- tational Linguistics, 2022. URL https: aaw.aaaaantoooooooccceaaooa
org/ / 2022.022222222 acl- long 581.
Nicola De Cao, Wilker Aziz, and Ivan Titov. Editing factual knowledge in language models. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, 2021. URL https: : www.attoaatoooyy...cooo.
22gg/2211, emnlp-men main. 522.
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT:
Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics, 2019. URL
https: htttp::/accanthooloe
org/N19-1423
Mor Geva, Roei Schuster, Jonathan Berant, and Omer Levy. Transformer feed-forward layers are key-value memories. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing. 2021. URL httpps////ccaaahooooy...ooo 446.
Anshita Gupta, Dehanjan Mondal, Akshay Krishna Sheshadri, Wenlong Zhao, Xiang Lorraine Li, Sarah Wiegreffe, and Niket Tandon. Editing commonsense knowledge in gpt. arXiv, 14956, 2023. URL https: http/riivvvv.///.aa/aaa org/ /at///ab//3/3555555
David Ha, Andrew M. Dai, and Quoe V. Le. Hypernetworks. In Proceedings the 5th International Conference on Learning Representations, 2017. URL WtRhttps:/ httptt:ss//peeeevieeee wwtp///eeeeeeeeeeeee/ee/e./o.eee net forum? id=rkpACelll 11x.
Thomas Hartvigsen, Swami Sankaranarayanan, Hamid Palangi, Yoon Kim, and Marzyeh Ghassemi. Aging with grace: Lifelong model editing with discrete key-value adapters. arXiv, 2211.11031, 2023. URL https: / /wwxiv.xvvvvv////////a./a/aaa org/ httpg//b///......ee///
22211.1111.
Peter Hase, Mohit Bansal, Been Kim, and Asma Ghandeharioun. Does localization inform editing? surprising differences in causality-based localization vs. knowledge editing in language models. arXiv, 2301 .04213, 2023a. URL https:ttpp.... aaaiiiiiiv. www.iiiwooo.o....e..eooe 2201 04213.
Peter Hase, Mona Diab, Asli Celikyilmaz, Xian Li, Zornitsa Kozareva, Veselin Stoyanov, Mohit Bansal, and Srinivasan Iyer. Methods for measuring, updating, and visualizing factual beliefs in language models. In Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics, 2023b. URL https: https://aclaaaeeeee pttps://aclanthoogy..oomm www.eaalla.aa......
Dan Hendrycks and Kevin Gimpel. Gaussian error linear units. arXiv preprint arXiv:1606.08// 2016. URL https:
Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation,
9()) 1997. URL htttps://ww/ pnw.:////wwppp........m.ma/ps... org/ /o///////aaa /ooi/aas/10.1170 poaappas.... 1611835114.
Edward Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. In Proceedings of the 10th International Conference on Learning Representations, 2022. URL https://
openreviex www/teeuut tet/
10

---

Published as a conference paper at ICLR 2024
Zeyu Huang, Yikang Shen, Xiaofeng Zhang, Jie Zhou, Wenge Rong, and Zhang Xiong.
saanformer-patcheer One mistake worth one neuron. In Proceedings of the 11th International Conference Learning Representations, 2023. URL BtLhttp:: wwweeenreveew.eeeeeeeeeeeeeeeeee 4d=4oYUGGGBPm.
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of the 6th International Conference on Learning Representations, 2015. URL https://arxxxi
1112.1111112 6980.
James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka SaabbkkaBarriiska. Demis Hass- abis, Claudia Clopath, Dharshan Kumaran, and Raia Hadsell. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences, 1 114(13)3521-3356, 2017.
URL https:/ /www. praas.aas....... org/ do / aabs/ 10. 1073/pnas..... 1611835114.
David Krueger, Chin-Wei Huang, Riashat Islam, Ryan Turner, Alexandre Lacoste, and Aaron Courville. Bayesian hypernetworks. In NeurIPS workshop Bayesian Deep Learning, 2017.
URL http: http://aaaassanallaaaraaaa
wwg//017//////ooooooo htpppaaappssaaa/eee pdf.
Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, Kristina Toutanova, Llion Jones, Matthew Kelcey, Ming-Wei Chang, Andrew M. Dai, Jakob Uszkoreit, Quoe Le, and Slav Petrov. Natural questions: A benchmark for question answering research. Trans- actions of the Association for Computational Linguistics, 7:452-466, 2019. URL https: //aclanthology. wwt//1ggg/-/.//
Omer Levy, Minjoon Seo, Eunsol Choi, and Luke Zettlemoyer Zero-shot relation extraction via reading comprehension. In Proceedings of the 21st Conference on Computational Natural Lan- guage Learning, 2017. URL https: https/////aaaaathoaalo.ooo.
org/K17-1034.
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization, In Proceedings the 7th International Conference on Learning Representations, 2019. URL ht opw.review..e.eeeee
net/forum? (i02uum2d==BKGRRccqY"
Kevin Meng, David Bau, Alex Andonian, and Yonatan Belinkov. Locating and edit- ing factual associations in gpt. In Advances in Neural Information Processing Systems, 2022. URL htttts::/ppoceeeiingg neurips ec http:/apprrfee/e//eeeeeeaaaeeeee files/ ptsppprrtteessspppre/222222 pappr/2022/
.df.
Kevin Meng, Arnab Sen Sharma, Alex J Andonian, Yonatan Belinkov, and David Bau. Mass-editing memory transformer. In Proceedings of the 11th International Conference Learning Rep- resentations, 2023. URL https: httpppp:////ppeeeeeee http///peeeveeeeeeeeeeeeeeeeeeee net/
wtt.://wwwweeeeteteeeeeeaaaaaaee worum? (o
Eric Mitchell, Charles Lin, Antoine Bosselut, Chelsea Finn, and Christopher D Manning. Fast model editing at scale. Proceedings of the 10th International Conference on Learning Representa- lions, 2022. URL
.net/ wwwt/foruunt forum? id=0DDZxeWEOPt..
Eric Mitchell, Charles Lin, Antoine Bosselut, Christopher D Manning, and Chelsea Finn. Memory- based model editing at scale. In Proceedings of the 39th International Conference on Machine Learning. 2023. URL https: https::/ppccceedde mlr www.mpprree... www.ppressvvee.... /aasss/vlc vtl./vv22///// mit m1h2/mitchel1220 html.
Fabio Petroni, Tim Rocktäschel, Sebastian Riedel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, and Alexander Miller. Language models as knowledge bases? In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, 2019. URL httpt::///clllttee http:///cltthooog.....
oxg/D19-122 1250.
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners, 2019. URL
https: https::/dAmmccfii http///mmcffssw...... www.wwwwoorooo..ccmmo wwt.eeeerr.eeeeeeeeeeeeeeeeeeeee httpee/eeeeeeeeeeeaaaagggeooeeee language model wtw.ooddeaaaaeuuuuuuapeeee ae htw.:/ttttttttteeeerree.........

---

Published as a conference paper at ICLR 2024
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to- text transformer. Journal of Machine Learning Research, 21(140):1-67, 2020. URL http: // //jml r. http:/paapssss///////ss//
html.
Adam Roberts, Colin Raffel, and Noam Shazeer. How much knowledge can you pack into the parameters of language model? In Proceedings of the 2020 Conference on Empirical Meth- ods in Natural Language Processing, 2020. URL https: http:///aaaaannn.a...//o wrg.://....../.0....../ cmn.p-matee 437.
Anton Sinitsin, Vsevolod Plokhotnyuk, Dmitry Pyrkin, Sergei Popov, and Artem Babenko. Editable neural networks. In Proceedings of the 8th International Conference Leurning Representa- lions, 2020. URL httpt:tt///// /wt.//vepeeeeeeeeeeeeeeeeeeeeeee net/ / fow.mm/iddeJeeeaaatttta.oa
Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. In Proceedings of the 34th International Conference Machine Learning, 2017. URL https:
/ //proceedings mlr press//esssse /v700 jandararaajanlaa..... ha.htm.
James Thore,, Andreas Vlachos, Christos Christodoulopoulls, and Arpit Mittal. FEVER: a large- scale dataset for fact extraction and VERification. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics, 2018. URL https:
//aclanthology ozg. /ogg//18/0 117--108--111111111 pdf.
James Thorne, Andreas Vlachos, Oana Cocaraseu, Christos Christodoulopoulos, and Arpit Mittal. The FEVER2.0 shared task. In Proceedings of the 2nd Workshop on Fact Extraction and VERifi- cation, 2019, URL https: / //t///aaaan/// aawlantholooyy....ooo.o.oooooole org//19 6601.
Jesse Vig, Sebastian Gehrmann, Yonatan Belinkov, Sharon Qian, Daniel Nevo, Yaron Singer, and Stuart Shieber. Investigating gender bias in language models using causal mediation analysis. In Advances in Neural Information Processing Sys- tems, 2020. URL https://proceed// 9265002e222771555e1eefa htt. .httlal.....ll......
neurips. poosscccpappee cccppaper/222//aaaea
Ben Wang and Aran Komatsuzaki. Gpt-j-6b: A 6 billion parameter autoregressive language model. https: / / gi github..h......g com wwt../owowiiicccoooooc wtwp://ngo.oooo/eee-ttrrra http:///esshaaaasseeeeee www.rrnnsforeer-00 jax, May 2021.
Yunzhi Yao, Peng Wang, Bozhong Tian, Siyuan Cheng, Zhoubo Li, Shumin Deng, Huajun Chen, and Ningyu Zhang. Editing large language models: Problems, methods, and opportunities. arXiv, 2305. 13172, 2023. URL https: arxiv. wwtp:////ggabbbbbaoebab 2305. 13172.
Chih- Kuan Ych, Ankur Taly, Mukund Sundararajan, Frederick Liu, and Pradeep Ravikumar. First is better than last for language data influence. In Advances in Neural Information Processing Sys- tems, 2022. URL https: papprrs.p..//p .iis cc/ cc/paper Files/ walee/pppeee paper//aaa 220///2222hhaa/// www.aaaatttttttoecaeeaeeea.e html.
Tianhe Yu, Saurabh Kumar, Abhishek Gupta, Sergey Levine, Karol Hausman, and Chelsea Finn. Gradient surgery for multi-task learning. In Advances in Neural Information Process- ing Systems, 2020. URL
neurips. htcp/appe//222//eeeeeeeee .tmll.
Eda waw.aa/aaaaa...0000000000000----
Chen Zhu, Ankit Singh Rawat, Manzil Zaheer, Srinadh Bhojanapalli, Daliang Li, Felix X. Yu, and Sanjiv Kumar. Modifying memories in transformer models. arXiv, 2012.00363, 2020. URL. https: //tp://aaivvv////v///a/ org/
httgg//////// abss 2oos2201... 00363.
A EXTENDED DISCUSSION
A.1 DETAIL OF MEND
Specifically, MEND generates the pseudo key ū and pseudo gradient V conditioned the key and the gradient with respect to the value V.L. i.e., (ū, V.L) go(u, L. and outputs rank-1 parameter shift S - To üT, where n) is a parameter that governs the learning rate (Mitchell
12

---

Published as a conference paper at ICLR 2024
al., 2022). The purpose of the decomposition is to make the editor parameter has linear com- plexity with respect to the hidden size of the LM. As this is not the concern of this paper, we omit the detail and simply write S = go(u, V.L) for clarity.
A.2 EFFICIENT IMPLEMENTATION OF MEND AND MALMEN
Explicit computation of the parameter shifts (Si,..., Sn) E Ruxd' xd is avoided as it is spatially demanding. For MEND, by combining S = Li== Sj and S, -n/Ve, L 8/ (Appendix A.I,, we have S = -n L ÜT,, where Ü = (WI...., ún) and VvL = (V., L.... v., For MALMEN, by combing d, Sy and Sj = -n L. L. we have d, = -na u firstly compute the scalar =n u and then multiply the coefficient with the pseudo gradient VayT.. T.. After obtaining the value difference matrix D (di,..., dr), output the optimal parameter shift 5 using the normal equation.
uz Va, L. Here we
A.3 KEY SHIFTING ALSO EXISTS IN THE STANDARD FINE-TUNING
Consider feeding single key u into linear layer with weight W and yielding value v Wu. Recall that gradient with respect to the weight is V L V.L.u² u²" When feeding the same key after updating the weight W using gradient descent with learning rate i.e., W < W - v) L, the value will be (W VV I.Ju v -- uuu V.. which equivalent to applying gradient descent on the value e with learning rate s7u2 This is similar to MALMEN, where the post-edit value of key is approximately e d = v rÿū? u V, (see Appendix A.2). However, as in fine-tuning and MALMEN, typically, several linear layers are updated simultancously, the key to the latter layers will not be identical to the pre-edit. Interestingly, for fine-tuning and MALMEN, training more layers usually leads to better performance, which indicates that the post-edit value is not harmed by the key shifting.
A.4 TUNING BERT- BASE ON THE FEVER DATASET
We fine-tune all parameters of BERT-base using the Adam optimizer (Kingma & Ba, 2015) with learning rate 3e-5. To determine the number of epochs, first fine-tune only the training split and validate on the validation split. The highest accuracy occurs at the second epoch. We then fine-tune BERT-base on all data for two epochs and edit the tuned model.
A.S EDITING MODELS BY FINE-TUNING
We tune the FFN of the last 3 Transformer blocks for BERT-base and GPT-2 and the FFN of the last Transformer blocks in both encoder and decoder for T5-XI,, which is identical to the choice of Mitchell et al. (2022). For GPT-J, tune the second linear layer in the FFN of layer 21, which identical to the choice of Meng et al. (2022; 2023). To prevent catastrophic forgetting, we use AdamW optimizer (Loshchilov & Hutter, 2019) with learning rate 5e-4 and weight decay 5e-4, which is identical to the choice of Meng et al. (2022; 2023). Training more epochs typically yields higher ES and GS and lower LSS. We report the result of 5 epochs.
A.6 HYPER- PARAMETERS OF MEND AND MALMEN
We use identical hyper-parameter for MEND and MALMEN as follows.
Name
Value
Rank of linear transformation in hyper-network
1920
Number blocks in hyper-network
2
Initial learning rate
le-6
Meta-learning rate Locality coefficient
le-5
1
Maximum meta gradient norm
1
13

---

Published as a conference paper at ICLR 2024
A.7 JUSTIFICATION FOR THE RE-IMPLEMENTATION OF MEND
We do not follow the original implementation of MEND in Mitchell et al. (2022) because (i) it goes beyond our memory budget edit large number of facts (See Figure 9); (ii) MEND is mainly designed for making a single edits so that the hyper-parameters selected by Mitchell et al. (2022) is sub-optimal in our setting. To justify our re-implementation of MEND multiple editing scenario, we reproduce the experiment in the Section 5.3 of Mitchell et al. (2022), where the result is available in Table 3. The setting is different with Section 5.1 in several aspects: (i) BART-base was fine-tuned by De Cao et al. (2021) the zsRE dataset before the editing; (ii) During the editing, we use alternative answers rather than correct answers; (iii) The unrelated tuples are sampled distinct from the edit tuples in the zsRE dataset instead of the NQ dataset; (iv) Metrics are computed sequence- wisely rather than token-wisely; (v) The Edit Success is computed over the edit and equivalent tuples instead of the edit tuples solely. "Original" directly copies the result in Mitchell et al. (2022). can be observed that our implementation consistently achieves higher Edit Success and Accuracy Drawdown. This is because contrast to 10 (See Section 3.2 of Mitchell et al. (2022)). Our choice is based on the performance of MEND on decoder-only models (Figures and 7), where MEND achieves similar LS with other methods but suffers much worse ES and GS.
select the locality coefficient Atoc 1 (See Appendix A. in
Edit Success
Accuracy Drawdown |
Edits
Original
Ours
Original
Ours
5
0.97
0.99
0.005
0.007
25
0.89
0.98
0.011
0.015
75
0.78
0.89
0.011
0.026
125
0.67
0.91
0.012
0.040
Table 3: Comparison with the original implementation of MEND
A.8 QUALITATIVE ANALYSIS ON THE FAILURE CASES OF MALMEN
We provide some failure examples of editing T5-XL on the zsRE dataset using MALMEN in Ta- bles 4 and 5. The first and second lines in each row of Table 4 are the edit tuple and equivalent tuple, respectively. The prediction of the post-edit LM usually does not deviate too far from the target answer, where the errors generally only occur on individual tokens. When the LM makes mistakes on the edit tuple, it often commits the same errors the equivalent tuple. It is noteworthy that in some cases, the LM can correctly answer the equivalent prompt even if it makes mistake on the edit prompt.
B PROOFS
Theorem 1. Suppose that U Rddx, f 1& Red D + DUT + A1)-1, and
g: Rdd xd + RR is a differentiable function. Then, Vigo = Vg. (UUT +UI-~U
Proof. Substituting of = dD dT (UU AT-- into dig o f) trl df) yields d(g o f) tr(Vg" dD- UTTUU" + ) = LNTUTUU + - dD). Following that d(g f) tr( ag(V fy" dD) we complete the proof.
Theorem 2. Suppose that D E . xn U E Rdxn, ff f: R dd X DUT (UUT +X and
g: Rd xd + R is differentiable function. Then, d(g 0 f)/d) = -tr(Vg (UUT + +
ddx into d(g f) tr( (Vg" df) yields d(g f) -Vr DUT + +XI) - Following that d(go f) (d(go f) dX)dA we complete the proof.
Proof. Substituting df = DUT d(UUT + - = -DUT + 2dx
14

---

Published as a conference paper at ICLR 2024
Prompt
Target Answer Murine coronavirus
Post-edit Answer
What family does Mouse hepatitis virus belong?
Murin coronavirus X
What family does Mouse hepatitis virus belong to?
Murin coronavirus X
On what date did Kosmos 611 lift off? When was the launch date for Kosmos 611?
28 November 1973
28 September 1973 X 28 September 1973 X
What was the record label of Sub Noize Souljaz?
Suburban Records
Noize
Rawurban
Noize
Records X
What was the Sub Noize Souljaz label?
Surban Noize Records X
Who featured in the film Camera Buff?
Jerzy Stuhr
Jerzy Stuhr /
Who played in the movie Camera Buff? Which lady Jane Seymour was born to? Who's ss Jane Seymour's 's mother?
Jeremia Stuhr X
Margery Wentworth
Margery Wentworth
Margery Sehighworth X
Who worked on SR class?
Richard Maunsell
Richard Maunsell
Who worked at SR Z class?
Richard Saricesell X
Which place is Love on a Rooftop in? Which place does Love on Rooftop exist in?
San Francisco
Santori X
San Francisco /
What year did Harry Grey, 3rd Earl of Stamford die in?
16 November 1739
17 November 1739 X
What year did Harry Grey, 3rd Earl of Stamford die?
16 November 1739
What kind of family is Pellicia of?
Hesperiidae
Psperiidae
Which family is Pellicia's?
Hesperiidae /
Table 4: Edit and equivalent tuple failure cases
Prompt
Pre-edit Answer
Post-edit Answer
Where are the spanish steps located in italy?
Rome V
Naples X
What is it called when you believe in greek gods?
Hellenism
Hellennism X
Where did they live in sex and the city?
New York City
San York City
What land mass was north america part of about 300 million years ago?
Pangaea V
Lauraangaea X
Who holds the record for most platinum al- bums?
AC/DC V
Michael/DC X
Table 5: Unrelated tuple failure cases
15


Reviews:
[{"review_id": "10TTfEp7jb", "reviewer": "Reviewer_t22i", "summary": "This paper considers a problem of knowledge editing, which involves altering the parametric knowledge of LMs without retraining them from scratch. This work specifically focuses on the scalability of hypernetwork-based approaches, which are generally considered less effective for multiple concurrent edits. The authors claim that there are two major challenges: 1) the parameter shifts could be contradictory between the set of modified facts, and 2) accommodating a large number of edits in a hypernetwork is memory demanding. This work presents an approach that addresses these challenges. \n\nConcretely, this work extends MEND (Mitchell et al., 2022) by introducing additional parameter updates specifically for linear layers in the FFNs. Assuming that the linear layers are key-value memories, the motivation behind this is to find a better single parameter shift matrix S for _m_ updates. This additional step adjust the hypernetwork output (i.e., gradients) which is not a simple sum of gradients for different inputs. When scaling up to a large number of edits, backpropagating from the meta loss to the input is costly (e.g., computing pre and post-edit losses for each edit end to end). The proposed approach decomposes the optimization process by caching pre-edit computation (after finetuning), reducing the memory usage substantially.\n\nThe experimental setup focuses on scalability (i.e., editing thousands of facts at once), and the proposed approach is applied to different model families such as encoder-only (e.g., BERT) and  decoder-only (e.g., GPT-2 and GPT-J 6B). In addition to FT and MEND baselines, GPT-J with MEMIT is included as a baseline. For evaluation, FEVER is used for BERT, and zsRE is used for GPT models, largely following prior work. For evaluation metrics, edit success (ES – how often new facts get higher probability after editing), generalization success (GS – performance on related facts), and locality success (LS – performance of unrelated facts). In summary, the experimental results show that the proposed approach consistently outperforms FT and MEND with BERT and GPT-2, and it has better scalability compared to the original MEND. When it comes with GPT-J, which is a much larger LM, it is always better than MEND but underperforms MEMIT and FT on LS, indicating that the post-edit model forgets unrelated facts.", "questions": "- Section 4.1: The clarity of the notations could be improved, especially the parameter shift matrix S and the different matrix D. It’s unclear which parameters are trainable/frozen from the notations. And, it’s hard to see how those operations are applied to _m_ edits.\n- “in the case of parameter shifts generated by the hyper-network, summing them lacks statistical significance”: This sounds intuitive, but is there any theoretical or empirical research that substantiates this? Yeh et al., (2022) is mainly talking about the cancellation effect in the last layer of a transformer if I understand it correctly.\n- Did you use the original implementation of MEND? If not, it would be nice to show that the results match with your implementation. \n- It would be nice to explain data statistics briefly.", "limitations": "", "rating": 5, "confidence": 4, "soundness": 2, "presentation": 2, "contribution": 2, "strengths": "- This work is tackling a well-motivated problem, scaling up knowledge editing approaches.\n- The motivation behind the proposed approach (adjusting FFN weights, decomposing the optimization process) is clearly explained, and the solutions presented are reasonable.", "weaknesses": "- The scope of the problem (scalability of MEND) could be narrow, and the proposed approach is only applicable for a specific knowledge editing approach.\n- Based on the experimental results, it is difficult to assert that this approach is significantly better than all other knowledge editing approaches in terms of scalability (not only MEND).\n- The poor LS score with GPT-J (6B) shows that this approach still edits unrelated facts.\n- Qualitative analysis is not provided. It’s hard to see when/why this approach is beneficial without seeing error cases.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "jDEeGLedbC", "reviewer": "Reviewer_hVjc", "summary": "This paper proposes an improvement to MEND for large-scale fact editing. Similar to MEND, MALMEN uses a hypernetwork that takes in gradients (with respect to some input/output tuples) and hidden states and outputs a parameter update. The general training objective is similar to MEND, and the primary improvement proposed is a better method for combining multiple \"fact\" updates as opposed to naively summing/accumulating over single updates. They evaluate on standard memory editing tasks (based on FEVER), on BERT-base, GPT-2 and GPT-J", "questions": "- Can you clarify \"truncating the back-propagation at the end of linear layers\"?\n- The line \"Edit first FC in FFN” turns to edit the first linear layer in the FFN of the last 6 Transformer blocks\" is unclear to me. How does the non-ablated MALMEN differ?", "limitations": "", "rating": 10, "confidence": 4, "soundness": 4, "presentation": 4, "contribution": 4, "strengths": "- The paper provides plenty of technical details, and is fairly clear (though somewhat dense)\n- The method is straightforward and intuitive. I am unclear about the broader applicability of memory editing, but the technical details and performance are sufficiently convincing to me that this is a meaningful contribution.", "weaknesses": "- The paper requires quite a bit of background on MEND. This is not inherently a bad thing since the paper is basically a direct modification of MEND, and the paper already spends a good deal of space building the background, but I think providing higher-level intuition in the exposition could help.\n- Section 4.2 wasn't very clear to me (in particular \"truncating the back-propagation at the end of linear layers\"). Figure 2 was significantly clearer, and I wonder if the authors could revisit the section and tweak it for ease of understanding the somewhat complicated procedure for training.\n- The results on scaling to GPT-J seem a little unstable", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "4HonFDT1gs", "reviewer": "Reviewer_8rhk", "summary": "This paper proposes MALMEN, a massive editing method for LLM, which employs the least square method to aggregate parameter shifts inspired from MEMIT, and then applies the parameter updating method by taking the least squared solution as increment of the parameter metric, for minimizing the meta loss. To efficiently design the back propagation for massive editing, the paper separates the backprop on LM and hyper-network such that the back props are proceeded in a cascaded way, maintaining a set of cache values. Experiment results on FEVER and zsRE dataset show that the proposed MALMEN improves MEND on BERT-based and GPT-2, and often improves MEMIT on GPT-J, under some types of edits.", "questions": "In Section 4.2, some derivations are not very clear. \n\n1) how the following is derived? \nDelta_D L_meta = Delta_W L_Meta * (U_l U_l^T + lambda_L I)^-1 U_l\nOther remaining formulas need more explanation on how they are derived. \n\n2) What does mean the method of “Cache all tokens”?", "limitations": "", "rating": 6, "confidence": 4, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "- The proposed combination of the least square method and the loss-based updating for massive editing is quite interesting and novel. \n- The truncated backprop algorithm is solidly designed to improve the efficiency, which is also quite interesting. \n- The experiment results show that the proposed method improves MEND or MEMIT under various settings.,", "weaknesses": "- Instead of the least squared solution, the simple sum-based aggregation is not compared. To prove the effect of the proposed method, this simplified aggregation needs to be compared.\n- The description of Section 4.2 is largely dense, too hard to capture the details. In particular, Figure 2 provides the overall backprop flow, but why the training algorithm using the truncated backprop is not explicitly and clearly provided? \n- In GPT-J (6B), the proposed method doesn’t improve MEMIT, in terms of LS metric. This result needs to be properly discussed.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "N4DYutKaaS", "reviewer": "Reviewer_NRG8", "summary": "This paper addresses the challenge of correcting and updating the knowledge of large language models (LLMs) that have been pre-trained on extensive text data. It introduces a novel approach called the MAssive Language Model Editing Network (MALMEN). MALMEN formulates the parameter shift aggregation as a least square problem, seeking the most effective parameter shifts for all facts to be injected. This approach improves the statistical significance of the editing process, mitigating the issues of gradient accumulation and the cancellation effect. Furthermore, this paper separates the computation between the hyper-network and the language model, enabling the use of arbitrary batch sizes for both neural networks. Exceptional performance on multiple knowledge-intensive tasks is a testament to MALMEN's effectiveness.", "questions": "In Figure 5 and Figure 6, the starting x coordinates are inconsistent, please provide a more detailed description. Is it fair to assume that MALMEN is less effective with fewer edits?", "limitations": "", "rating": 6, "confidence": 3, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "1.This is overall a well-written paper: it tackles a very important problem, formulating the parameter shift aggregation as the least square problem. This approach differs from traditional fine-tuning and overcomes the challenges of scalability and memory usage in existing hyper-network methods.\n\n2.This paper focuses on scalability. MALMEN is designed to edit multiple facts simultaneously, making it more practical for mass editing in real-world scenarios. This is a crucial aspect given the need to update the knowledge of large language models comprehensively.\n\n3.Despite being somewhat math-heavy, the paper is written in a very clear and didactic way. I found it easy to follow and an enjoyable read overall.\n\n4.Comprehensive (although not entirely convincing, see below) experiments on various knowledge-intensive NLP tasks and across different LLM architectures. This demonstrates the effectiveness and versatility of the proposed method.", "weaknesses": "1.Baselines are limited. Why not compare with T-Patcher (Huang et al., 2023), which I believe is more suitable for sequential knowledge editing?\n\n2.The criteria for successful edits are, in my opinion, insufficient, in that they do not consider the portability of the edit. Previous work such as Yao et al., 2023, introducing an additional assessment metric, portability, finding that the model-editing methods lack robustness when applied to related one-hop fact or synonyms. \n\n3.Which layers to apply MALMEN? All layers or some picked layers? Section 5.2 claims that “Edit first FC in FFN” achieves inferior performance. How to select the layer in practical application?\n\n4.The experiments are lacking in qualitative examples, it would be helpful to analyze some success and failure cases to see where the proposed method begins to fail (e.g., with respect to generalization).\n\n5.MALMEN is essentially a combination of meta-learning based (e.g. MEND, Mitchell 2022) and parametric (e.g. ROME, Meng 2022 or MEMIT, Meng 2023) editing ideas that shows some promise. The method is not particularly technically novel (minor point).", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}]

Author rebuttal:

Decision: Accept (poster)