Learning to Edit: Aligning LLMs with Knowledge Editing (2024)

Abstract: Knowledge editing techniques, aiming to efficiently modify a minor proportion of knowledge in large language models (LLMs) without negatively impacting performance across other inputs, have garnered widespread attention. However, existing methods predominantly rely on memorizing the updated knowledge, impeding LLMs from effectively combining the new knowledge with their inherent knowledge when answering questions. To this end, we propose a Learning to Edit (LTE) framework, focusing on teaching LLMs to apply updated knowledge into input questions, inspired by the philosophy of “Teach a man to fish.” LTE features a two-phase process: (i) the Alignment Phase, which fine-tunes LLMs on a meticulously curated parallel dataset to make reliable, in-scope edits while preserving out-of-scope information and linguistic proficiency; and (ii) the Inference Phase, which employs a retrievalbased mechanism for real-time and mass knowledge editing. By comparing our approach with seven advanced baselines across four popular knowledge editing benchmarks and two LLM architectures, we demonstrate LTE’s superiority in knowledge editing performance, robustness in both batch and sequential editing, minimal interference on general tasks, and rapid editing speeds.

heading: 1 Introduction
text: The transformative potential of large language models (LLMs) (Brown et al., 2020; OpenAI, 2023; Touvron et al., 2023) has been unequivocally underscored by their unparalleled efficacy across a myriad of applications (Chen et al., 2021; OpenAI, 2022, 2023). Nonetheless, the dynamic nature of the world necessitates frequent updates to LLMs to rectify outdated information or integrate new knowledge, thereby safeguarding their sustained pertinence. Naively training a new LLM
∗Work done during the internship at Huawei Noah’s Ark Lab. Data and code: https://github.com/YJiangcm/LTE.
Previous Knowledge Editing Methods
from scratch to incorporate updated knowledge could result in substantial computational overhead and is frequently deemed impractical. To this end, the concept of knowledge editing has been introduced (Sinitsin et al., 2020; De Cao et al., 2021), aiming to efficiently modify LLMs’ outputs towards targeted queries while preserving overall performance across other unrelated ones. For example, updating the knowledge of “The current British Prime Minister is Rishi Sunak” not only modifies the response to “Who is married to the PM of the UK?” but leaves unaffected the answer to “When was Rishi Sunak born?”
Some knowledge editing approaches rely on auxiliary modules or models to either predict the LLM’s weight adjustments (De Cao et al., 2021; Mitchell et al., 2022a) or function as scope classifiers for query response applicability (Mitchell et al., 2022b). While these innovations demonstrate potential, they fail to inherit the advanced capabilities of LLMs, thus rendering output quality degeneration. Others attempt to identify and modify parameters related to specific knowledge within
4689
LLMs to update their embedded knowledge (Dai et al., 2022; Meng et al., 2022, 2023). Nonetheless, the correlation between localization and editing efficacy has been scrutinized by (Hase et al., 2023), which suggests that localization results from Causal Tracing are statistically uncorrelated with the success of an edit injecting a new fact into MLP weights. Thus, it is plausible that the detrimental effects of such approaches could be amplified with the scale of LLMs. In essence, these methods predominantly rely on memorizing the updated knowledge (See Figure 1), hindering LLMs from effectively combining the new knowledge with their inherent knowledge when answering the input queries.
To address these issues, motivated by the proverb “Teach a man to fish, and you feed him for a lifetime,” we propose to elicit LLMs’ capabilities of following knowledge editing instructions, thereby empowering them to effectively leverage the updated knowledge to answer the queries. Specifically, we propose a Learning to Edit (LTE) framework to align LLMs with knowledge editing by leveraging supervised fine-tuning (SFT), which has become foundational in tailoring LLMs for desired behaviors (Wei et al., 2022; Mishra et al., 2022). The LTE framework is structured around two pivotal stages: the Alignment Phase and the Inference Phase. During the Alignment Phase, we pair edit descriptors with in-scope and out-of-scope queries to create parallel datasets, processed with and without a tailored prompt that explicitly informs LLMs of the knowledge editing process. By fine-tuning LLMs on this meticulously constructed dataset, we aim to cultivate a trio of essential capabilities within LLMs—In-Scope Capability (generating reliable, logically consistent edits), Out-of-Scope Capability (preserving the integrity of unrelated content), and Linguistic Capability (maintaining linguistic proficiency)—to ensure nuanced application of updated knowledge. Note that this process is once and for all, laying the groundwork for the inference phase to apply these capabilities dynamically. In the Inference Phase, to extend to mass editing, we implement a retrieval-based mechanism to obtain the most pertinent updated knowledge from a memory bank. Such an approach enables LLMs to adapt their responses with the most current information in real time, thereby streamlining both batch and sequential knowledge editing processes.
In this paper, we assess our proposed LTE
method against seven advanced baselines across four benchmarks in single, batch, and sequential editing scenarios. Our findings reveal four major strengths of the LTE method: (i) it establishes a new state-of-the-art (SOTA) in overall knowledge editing performance, surpassing existing methods by a substantial margin of over 20 absolute points in terms of portability; (ii) the robustness of LTE is evident in its ability to handle batch and sequential knowledge editing requests, showing a markedly reduced rate of performance deterioration compared to its counterparts; (iii) it is proficient in facilitating knowledge edits with minimal interference to the model’s cognitive functions across varied unrelated domains. (iv) LTE distinguishes itself by combining the fastest editing speeds with exceptional performance.

heading: 2 Task Formulation
text: The objective of knowledge editing is to efficiently adjust the behavior of an initial base LLM fθ, where θ represents the model’s parameters, in response to specific edit descriptors {(x∗i , y∗i )}i∈[1,N ]. In this context, x∗i refers to the edit input that triggers the knowledge in LLMs (e.g., The current British Prime Minister is), y∗i is the corresponding edit target (e.g., Rishi Sunak), and N signifies the total number of edit descriptors. The efficacy of knowledge editing is evaluated among four dimensions:
Edit success measures the average accuracy of the post-edit model f∗θ on these edit cases:
E (x∗i ,y ∗ i ) 1{argmax y f∗θ (y|x∗i ) = y∗i } (1)
Portability evaluates how well updated knowledge transfers to related queries, enhancing the model’s utility in varied contexts. For example, correctly answering Who is married to the British Prime Minister? with Akshata Murty post-edit indicates successful knowledge transfer.
Locality assesses the precision of edits, ensuring modifications are confined to targeted areas without affecting unrelated knowledge. For example, ensuring The current British Chancellor remains Jeremy Hunt exemplifies effective locality.
Fluency quantifies the linguistic quality of the model’s output post-edit, focusing on coherence and diversity to avoid repetitive patterns. Following (Zhang et al., 2018), we calculate fluency by
measuring the weighted average of bi- and tri-gram entropies given by −∑k f(k) log2 f(k), where f(·) is the n-gram frequency distribution.

heading: 3 Methodology
text: As illustrated in Figure 2, we propose a Learning to Edit (LTE) framework to align LLMs with ever-changing, complicated, and diverse knowledge editing requests in real-time. This framework consists of two phases: (i) in the Alignment Phase, we enlighten LLMs’ capabilities of applying updated knowledge through the utilization of a knowledge editing prompt “[Updated Information] {edit descriptor}\n[Query] {query}”; (ii) in the Inference Phase, LLMs are enabled to conduct on-the-fly and streaming knowledge editing by retrieving relevant updated knowledge to the query from the stored memory.

heading: 3.1 Alignment Phase: Learning to Edit
text: In light of the task formulation in §2, the model editing process profoundly influences predictions across a wide array of inputs directly related to the provided edited knowledge. An optimal knowledge editing method must seamlessly integrate new knowledge into the relevant content within its edit scope, while ensuring the accuracy and integrity of information outside this domain. To navigate the complexities of knowledge editing effectively, we delineate three critical capabilities that LLMs must acquire during the Alignment Phase:
In-Scope Capability requires the model to correctly generate the edit target given the edit input or its paraphrases. It also covers subject aliasing, ensuring the editing of one subject should not vary from its expression. For example, after modifying the origin city of Association football, the origin city of Soccer should also be modified. Furthermore, it necessitates LLMs to conduct compositional reasoning with the changed facts (e.g., when we change the origin city of Association football, the origin city of the sport associated with AC Milan should also be changed, see Figure 2). To empower LLMs with these advanced capabilities during alignment, we meticulously curate training data by adapting or synthesizing content from existing knowledge editing datasets. Our selection includes ZsRE (Levy et al., 2017), RIPPLEEDITS (Cohen et al., 2023), WikiBio (Hartvigsen et al., 2023), and MQUAKE (Zhong et al., 2023b), with each dataset providing edit descriptors linked to multiple queries. These queries are specifically designed to evaluate the nuanced facets of in-scope or outof-scope knowledge editing capabilities. To avoid data leakage, our methodology only incorporates samples from the datasets’ training sets.
Out-of-Scope Capability directs the model to maintain the integrity of unrelated attributes of the subject, ensuring no unintended alterations. For example, as shown in Figure 2, changing the origin city of Association football should not mod-
ify its governing body. Additionally, it requires LLMs to adeptly handle one-to-many relationships, ensuring that original connections are retained unless specifically altered. We utilize the same data sources as that of In-Scope Capability. However, due to the absence of out-of-scope instances in datasets like ZsRE and MQUAKE, we employ GPT-4 to generate corresponding queries and answers based on the edit descriptors, further details of which are provided in Appendix A.1.
Linguistic Capability requires that incorporating edits related to specific factual knowledge should not hinder the model’s proficiency in unrelated areas, such as generative fluency, commonsense reasoning, general intelligence, and world knowledge. Thus, we identify a limitation within existing datasets: the predominance of fill-in-theblank cloze queries may not adequately challenge the LLMs’ linguistic capabilities across diverse areas, such as conversational contexts, where answers may inherently be more elaborate. To address this, we integrate edit descriptors from COUNTERFACT (Meng et al., 2022) and utilize GPT-4 to generate free-text, in-scope query-answer pairs (See Appendix A.2). This approach not only diversifies the training data but also enhances the models’ ability to generate more contextually rich answers. GPT-4 is further employed to verify the relevance of generated answers to the edit descriptors, with a mechanism to filter out unsatisfactory cases. Additionally, we incorporate natural language instructions from Evol-Instruct (Xu et al., 2023) as out-of-scope queries to maintain the LLMs’ broad linguistic capabilities.
Parallel Data Construction Our approach involves the creation of parallel datasets by pairing each edit descriptor with corresponding in-scope and out-of-scope queries. These are then processed with and without the incorporation of our tailored knowledge editing prompt (See Figure 2). This parallel construction serves multiple purposes. First, it reinforces LLM’s capacity to discern when to utilize updated knowledge by comparing in-scope and out-of-scope queries with editing. Second, it accentuates the subtle distinctions between with and without editing for in-scope queries, enabling LLM to apply knowledge edits more effectively. Lastly, it educates LLM on maintaining the integrity of out-of-scope information by presenting it with comparisons that demonstrate when not to
alter this knowledge. In total, we construct 60k parallel data for training, the detailed data statistics are listed in Appendix A.3. During training, we compute the loss only on the answer tokens, i.e., it learns to generate answers conditioned on the Updated Information and Query.

heading: 3.2 Inference Phase: On-the-fly Edit
text: Here we propose an efficient mechanism that extends LTE to batch and streaming knowledge editing scenarios. Inspired by retrievalaugmented generation (RAG) (Lewis et al., 2020; Xu et al., 2022), we utilize an off-the-shelf retrieval model multi-qa-mpnet-base-dot-v1 (Reimers and Gurevych, 2019) to embed all the edit descriptors and create a vector memory to store the representations. When given a query, we also get the representation of the query by the retriever and search the top-k (k = 3 in our experiments) similar edit descriptors from the vector memory. Then, the query and the retrieved edit descriptors are fed into the LLM to obtain the answer. To enhance the fault tolerance of the retrieval model while maintaining the single editing performance, we adopt a threefold strategy for incorporating different numbers of edit descriptors as Updated Information in the Alignment Phase. Firstly, in 50% of cases, we directly use the exact edit descriptor. Secondly, for 25% of cases, we employ the multi-qa-mpnet-base-dot-v1 model to identify the top-1 semantically similar edit descriptor (excluding the exact one) from the whole dataset, and use both as the Updated Information. Lastly, for the remaining 25%, we retrieve the top 2 semantically similar descriptors, excluding the exact one, using all three as the Updated Information. This approach introduces variability during training, significantly enhancing the model’s robustness and improving mass edit capabilities in inference.

heading: 4 Experiments

heading: 4.1 Experimental Setup
text: We select LLaMA2-Chat-7B (Touvron et al., 2023) and Qwen-Chat-7B (Bai et al., 2023) as base models for knowledge editing, as these models are widely used for English and Chinese chatbot applications, respectively. We implement our LTE method by standard fine-tuning on the 60k constructed data in §3.1. Additionally, we explore an alternative implementation of LTE, employing Low-Rank Adaptation (LoRA) (Hu et al., 2022),
noted for its efficiency and reduced memory requirements. This variant is referred to as LTELoRA. The detailed implementation specifics are listed in Appendix B.
For the evaluation datasets and metrics, we follow KnowEdit (Zhang et al., 2024) and use the test sets of four popular benchmarks, including WikiDatarecent (Cohen et al., 2023), ZsRE (Levy et al., 2017), WikiBio (Hartvigsen et al., 2023), and WikiDatacounterfact (Cohen et al., 2023). All the experiments are conducted by using EasyEdit (Wang et al., 2023b) toolkit. We choose seven knowledge editing methods as baselines:
• SERAC (Mitchell et al., 2022b) builds a counterfact model by retaining the base model and training a classifier to determine whether to use the counterfact model to answer the query.
• ICE (Cohen et al., 2023) prepends a prompt “Imagine that {edit descriptor}” before
the query. It does not introduce changes to the model parameters, but rather generation is conditioned on the new fact.
• MEND (Mitchell et al., 2022a) transforms the fine-tuning gradient of an updated fact by decomposing the weight matrix into rank-1 form with the pre-trained hyper-network.
• ROME (Meng et al., 2022) learns to locate factual retrievals of a specific set of MLP modules and update knowledge by directly writing in new key-value pairs in the MLP module.
• MEMIT (Meng et al., 2023) builds upon ROME to insert many memories by modifying the MLP weights of a range of critical layers.
• FT-L (Meng et al., 2022) directly fine-tunes a single layer’s FFN, and the layer is the casual tracing results in ROME.
• FT fine-tunes all the parameters of the base model on the edit descriptor by applying Adam with early stopping.

heading: 4.2 Results of Single Editing
text: Table 1 presents the performance comparison under the single editing setting, where LTE eliminates the need for retrieval. It can be observed that LTE remarkably surpasses conventional methods in terms of edit success, portability, and fluency. Besides, LTE-LoRA—an efficient variant of LTE—closely mirrors its performance except for fluency, which can be attributed to the inherent limitations of the LoRA technique. Notably, LTE exhibits a 21.37% and 18.49% improvement over the current SOTA method SERAC on LLaMA2Chat-7B and Qwen-Chat-7B, respectively. This substantial enhancement can be attributed to the comprehensive utilization of LLMs’ understanding and reasoning capabilities, which effectively lever-
age context to integrate new knowledge seamlessly. The ICE method, while leveraging the innate incontext comprehension capacity of LLMs for generating conditioned output on new knowledge, significantly trails our proposed LTE method. This could be because ICE lacks instructing LLMs in effectively applying knowledge through fine-tuning (See more ablation analysis in Table 3). Nevertheless, LTE shows a marginal deficit in locality compared to the best results (e.g., 6.71% lower than MEND on LLaMA2 and 2.23% lower than FT-L on Qwen). A potential explanation may lie in the introduction of a knowledge editing prompt in the input, causing a slight disruption during the generation process. Yet, these divergences are often minor linguistic variants. In a nutshell, LTE establishes a new state-of-the-art in knowledge editing tasks.

heading: 4.3 Results of Mass Editing
text: Prior research predominantly confines the scope of knowledge editing to a mere handful of facts or focuses only on single editing cases. This approach starkly contrasts with the dynamic and multifaceted nature of real-world applications, where there is a pressing need to enrich models with multiple pieces of knowledge, either concurrently (simultaneously) or in a phased manner (sequentially). In this section, our study embarks on a comprehensive investigation, undertaking both batch and sequential editing experiments.
Batch Editing We compare LTE and LTELoRA with several batch-editing-supportive methods (SERAC, MEMIT, and FT-L) on LLaMA2Chat-7B and display the results in Figure 3. It is particularly noteworthy that the performance metrics of edit success and fluency for our proposed LTE and LTE-LoRA methodologies exhibit excep-
tional stability, maintaining robustness for up to 1,000 batch edits. A decline in performance metrics such as portability and locality is observed across all methods as the batch size increases. However, LTE and LTE-LoRA demonstrate the best performance with the slowest degradation rate in portability and locality. These results underscore the enhanced robustness of our methods, even when subjected to extensive editing operations.
Sequential Editing Sequential editing is a critical process where models must retain previous modifications while integrating new edits effectively. Figure 4 illustrates the comparative performance of various models in the context of sequential editing tasks across different data stream sizes. ROME and MEMIT demonstrate noteworthy efficacy for a sequential number n ≤ 100, yet their performance exhibits a marked decline as n expands to 500. This decline can be attributed to the cumulative deviations from the model’s original state, which ultimately lead to a degradation in performance. In contrast, LTE and LTE-LoRA leverage retrieval mechanisms from the stored memory, circumventing the need for subsequent parameter modifications, which endows them with more consistent performance with varying data stream sizes. Notably, LTE and LTE-LoRA showcase significant improvements over the current SOTA method SERAC. This shows their enhanced resilience and adaptability, making them more suited for extensive data streams.

heading: 4.4 Results of General Tasks
text: In this section, we investigate the impact of applying LTE on the performance of a language model across various domains. Our main goal is to determine whether the Alignment Phase of LTE, which alters the parameters of the initial model, inadvertently compromises the model’s competence in unrelated domains. To this end, we
have selected an array of benchmarks encompassing commonsense reasoning, general intelligence, and extensive world knowledge. These benchmarks comprise CommonSenseQA (Talmor et al., 2019), PIQA (Bisk et al., 2020), XSum (Narayan et al., 2018), MMLU (Hendrycks et al., 2021), AGIEval (Zhong et al., 2023a), and AlpacaEval (Li et al., 2023). All evaluations are conducted using the OpenCompass tool (Contributors, 2023). Table 2 indicates that, from a comprehensive standpoint, models subjected to LTE exhibit performance levels comparable to their unmodified counterparts. Moreover, the general linguistic abilities remain unaffected by the inclusion of the knowledge editing prompt. Nonetheless, a performance decrement is noted in CommonsenseQA and PIQA after the LTE application. Despite these findings, an overarching analysis reveals notable consistency in performance. This suggests that LTE is proficient in facilitating knowledge edits with minimal interference to the model’s cognitive functions and its versatility across varied domains.

heading: 5 Analysis

heading: 5.1 Ablation Study
text: Here we assess the indispensability of components within the Alignment and Inference phases. Our experiments span four benchmarks, utilizing the LLaMA2-Chat-7B as the base model. As depicted in Table 3, the exclusion of certain training data segments leads to a significant decline in single editing effectiveness. Notably, distinct types of training data bolster specific capabilities. In-scope data predominantly enhances edit success and portability, while out-of-scope data chiefly fosters locality. Free-text QA data appears to bolster overall linguistic proficiency. Eliminating the threefold strategy incurs a modest reduction in performance. Furthermore, employing the knowledge editing prompt without training results in substantially
poorer performance compared to scenarios that include training. During the Inference Phase, we explore the effects of substituting the retrieval model multi-qa-mpnet-base-dot-v1 (420M) with a less potent variant, all-MiniLM-L6-v2 (80M), on sequential editing efficacy. As indicated in Table 4, the choice of retrieval model exerts minimal impact on performance. Additionally, we assess how the number of retrieved edit descriptors influences results. A reduction in the value of k from 3 to 1 is associated with a minor performance decrement.

heading: 5.2 Time Analysis
text: Table 5 illustrates the time required for various knowledge editing methods from providing the edited case to obtaining the final answer. Models such as MEND and SERAC demonstrate rapid editing capabilities once their auxiliary models are adequately trained. In contrast, ROME and MEMIT exhibit slower processing speeds due to the intensive computation involved in calculating key vectors and optimizing value vectors. Additionally, these methods necessitate a pre-computation of the covariance statistics for the Wikitext, which is also time-consuming and can potentially take hours to days to complete. Furthermore, while FT-L and FT are relatively quick, their memorization-based fine-tuning strategies yield suboptimal knowledge
editing outcomes. Our proposed LTE method, however, stands out by achieving the swiftest editing speeds coupled with superior performance. After the Alignment Phase (which takes about 9 hours in our experiments), LTE enables instantaneous editing similar to ICE by appending a knowledge editing prompt to the input prefix. Despite a marginally increased inference time, the overall time expenditure is significantly reduced, underscoring the efficiency and effectiveness of LTE.

heading: 5.3 Out-of-Distribution Generalization
text: To evaluate LTE’s performance in out-ofdistribution (OOD) scenarios, we conducted rigorous experiments on ConvSent (Mitchell et al., 2022b), a sentiment editing task featuring diverse data distributions, alongside established benchmarks. As shown in Table 6, our LTE exhibits superior performance with the slowest degradation rate on batch editing. Moreover, LTE’s retriever achieves impressive retrieval accuracy (Top-3 P@1) scores of 88.34, 87.08, 84.27, and 82.25, respectively. These comprehensive experiments serve to validate not only the efficacy but also the robustness of our LTE method, even in the face of OOD challenges.

heading: 5.4 Case Study
text: Table 7 shows the performance of different knowledge editing methods in a single case. This comparison reveals that LTE stands out for applying edited knowledge to answer the query “The name of the award the spouse of Melissa Mathison won is” that necessitates compositional reasoning
while maintaining the fluency of the generated text. In contrast, other approaches, including SERAC, ICE, ROME, MEMIT, and FT-L, not only fail to answer the query correctly but generate repeated or inconsistent text sometimes. This case study further validates LTE’s advances in utilizing new knowledge to answer input queries.

heading: 6 Related Work
text: Knowledge Editing Prior knowledge editing studies resort to auxiliary models for efficient updating and refining of LLMs. For example, SERAC (Mitchell et al., 2022b) builds a distinct counterfact model without changing the original LLM and employs a scope classifier to determine whether to use the counterfact model to answer the question. KE (De Cao et al., 2021) and MEND (Mitchell et al., 2022a) leverage a hypernetwork to predict the weight update of the LLM. While these methods have shown some promising results, they fail to utilize the inherent formidable capabilities of LLMs. More recent works such as KN (Dai et al., 2022), ROME (Meng et al., 2022), and MEMIT (Meng et al., 2023) adopt interpretability techniques to identify parameters corresponding to specific knowledge and update them to alter LLM’s knowledge. Nevertheless, the correlation between localization and editing efficacy has been questioned (Hase et al., 2023). Diverging from these methodologies, we explicitly teach LLMs how to apply updated knowledge rather than mere memorization, which taps into the full potential of LLMs, fostering a more dynamic and effective
knowledge editing process.
LLM Alignment LLM alignment (Gabriel, 2020), which aims to calibrate LLMs’ behaviors with human values and preferences, is essential for their application in real-world scenarios. A prominent technique in this area is supervised finetuning (SFT) (Wei et al., 2022; Mishra et al., 2022), which involves fine-tuning powerful LLMs using datasets composed of natural language instructions. Notably, SFT is instrumental in improving LLMs’ understanding and adherence to human instructions, laying the groundwork for many subsequent alignment strategies such as reinforcement learning from human feedback (RLHF) (Ouyang et al., 2022; Rafailov et al., 2023). Thus, plenty of efforts have focused on applying SFT for alignment using either human-annotated or synthetic data (Wei et al., 2022; Wang et al., 2023c; Jiang et al., 2023; Xu et al., 2023; Wang et al., 2023d).

heading: 7 Conclusion
text: We present the Learning to Edit (LTE) framework, a novel approach for effective, efficient knowledge editing of LLMs. LTE equips LLMs with the ability to apply updated knowledge through a two-phase process: an Alignment Phase that teaches essential knowledge editing capabilities, and an Inference Phase that implements retrieval-based, on-the-fly knowledge editing. Our framework demonstrates superior performance in knowledge editing tasks, outperforming existing methods in robustness and speed across various benchmarks.
Limitations
This section outlines the limitations of our proposed LTE approach, despite its validated efficacy across diverse model architectures, evaluation datasets, and knowledge editing settings.
Firstly, the LTE framework necessitates a onetime fine-tuning process during the Alignment Phase. Although this process is a prerequisite, it facilitates real-time knowledge editing during the Inference Phase. We further elucidate that employing LoRA as an alternative to standard fine-tuning presents a viable, resource-efficient approach without compromising performance (See §4). This innovation highlights the LTE’s flexibility in adapting to various computational constraints.
Furthermore, our investigation primarily focuses on factual knowledge editing, yet the purview of model editing extends to encompassing personality traits, emotional responses, opinions, and beliefs (Zhang et al., 2024). These dimensions, while partially explored, represent areas ripe for future research. Additionally, the prospect of multilingual (Wang et al., 2023a) and multimodal (Cheng et al., 2023) editing underscores the necessity for broader exploration, pointing towards an expansive horizon for model editing applications.
Finally, the proprietary nature of leading LLMs, such as ChatGPT and GPT-4, poses a significant challenge for applying knowledge editing techniques due to restricted access to their underlying parameters. Nonetheless, OpenAI’s API provision for models including gpt-3.5-turbo-1106 and gpt-4-0613 facilitates fine-tuning within the LTE’s Alignment Phase. Although our current work does not extend to these black-box models, addressing this limitation represents a critical avenue for future research, potentially unlocking new methods for model customization and improvement.
Ethics Statement
Knowledge editing encompasses the methodologies employed to efficiently modify LLMs’ behaviors within specific domains while preserving overall performance across various inputs. It is critical to acknowledge that, if executed with malevolent intent, knowledge editing possesses the potential to compel models to produce outputs that are harmful or inappropriate. Consequently, it is imperative to enforce safe and responsible knowledge editing practices. The implementation of these techniques must be underpinned by stringent ethical standards,
accompanied by robust safeguards designed to deter misuse and the generation of detrimental outcomes. To this end, all data constructed for this study have undergone meticulous scrutiny by human evaluators to eliminate any instances of malicious editing or offensive content, thereby ensuring the integrity and safety of the model’s outputs.

heading: Acknowledgments
text: W. Wang was supported by HKUST(GZ) Grant G0101000028, CCF-HuaweiDBC202302, Guangzhou Municipal Science and Technology Project (No. 2023A03J0003, 2023A03J0013 and 2024A03J0621).

heading: A Details of Training Data Construction
text: A.1 Synthetics of Out-of-scope Examples As shown in Figure 5, we employ a few-shot manual demonstration as a prompt to guide GPT-4 in producing the desired query and answer.
A.2 Synthetics of Free-text In-scope Question-answering Pairs
In our methodology, we initially engage GPT-4 with five meticulously crafted demonstrations, as depicted in Figure 6. This step is designed to elicit a query that pertains directly to the edit descriptor. Following this, we direct GPT-4 to formulate an answer to the query, drawing upon the edit descriptor for content, as illustrated in Figure 7. The final step in Figure 8 involves a verification process by GPT-4 to ascertain the congruence of the answer with the edit descriptor, leading to the exclusion of instances where the criteria are not met (approximately 15%).
A.3 Training Data Statistics Table 8 lists the statistics of our curated training data, which encompasses 60k samples from five data sources. In the construction of our dataset, we employ a rigorous sampling methodology, exclusively selecting instances from the training sets provided by the data sources.
B Implementation Details
The training procedure was executed on 4 NVIDIA A100 GPUs, each equipped with 80GB of memory. The duration required to train a single instance of the model, specifically the LLaMA2-Chat-7B, was approximately 9 hours. Detailed specifications of the hyperparameters employed for both standard fine-tuning and LoRA are provided in Table 9.

heading: Future Work
text: These dimensions, while partially explored, represent areas ripe for future research. Additionally, the prospect of multilingual (Wang et al. , 2023a) and multimodal (Cheng et al. , 2023) editing underscores the necessity for broader exploration, pointing towards an expansive horizon for model editing applications. Finally, the proprietary nature of leading LLMs, such as ChatGPT and GPT-4, poses a significant challenge for applying knowledge editing techniques due to restricted access to their underlying parameters. Nonetheless, OpenAI’s API provision for models including gpt-3. 5-turbo-1106 and gpt-4-0613 facilitates fine-tuning within the LTE’s Alignment Phase. Although our current work does not extend to these black-box models, addressing this limitation represents a critical avenue for future research, potentially unlocking new methods for model customization and improvement