{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/learning-to-edit-aligning-llms-with-knowledge","title":"Learning to Edit: Aligning LLMs with Knowledge Editing","arxiv_id":"2402.11905","date":"2024-02-19","proceeding":null,"authors":["Yuxin Jiang","YuFei Wang","Chuhan Wu","Wanjun Zhong","Xingshan Zeng","Jiahui Gao","Liangyou Li","Xin Jiang","Lifeng Shang","Ruiming Tang","Qun Liu","Wei Wang"],"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 retrieval-based 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. The data and code are available at https://github.com/YJiangcm/LTE.","url_abs":"https://arxiv.org/abs/2402.11905v2","url_pdf":"https://arxiv.org/pdf/2402.11905v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"learning-to-edit-aligning-llms-with-knowledge","repo_url":"https://github.com/yjiangcm/lte","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"philosophy","task_name":"Philosophy"},{"task_slug":"knowledge-editing","task_name":"knowledge editing"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.11905","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.11905"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yjiangcm/lte","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_draft_wrong":3,"ran":2,"unverified":8},"by_repo_kind":{"official":{"samples":13,"ran":5,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"27659a9c234ffb11","entry":"binary_log_probs","repo":"yjiangcm/lte","repo_kind":"official","path":"EasyEdit/easyeditor/trainer/losses.py","file_url":"https://github.com/yjiangcm/lte/blob/HEAD/EasyEdit/easyeditor/trainer/losses.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"27659a9c234ffb11"}},{"code_sha256_prefix":"920b394e7ad80c53","entry":"hierarchical_subsequence","repo":"yjiangcm/lte","repo_kind":"official","path":"EasyEdit/easyeditor/util/nethook.py","file_url":"https://github.com/yjiangcm/lte/blob/HEAD/EasyEdit/easyeditor/util/nethook.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"920b394e7ad80c53"}},{"code_sha256_prefix":"8b733c9fc590e4c1","entry":"preprocess","repo":"yjiangcm/lte","repo_kind":"official","path":"Qwen/finetune.py","file_url":"https://github.com/yjiangcm/lte/blob/HEAD/Qwen/finetune.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"8b733c9fc590e4c1"}},{"code_sha256_prefix":"70f6ab8bde55420e","entry":"recursive_copy","repo":"yjiangcm/lte","repo_kind":"official","path":"EasyEdit/easyeditor/util/nethook.py","file_url":"https://github.com/yjiangcm/lte/blob/HEAD/EasyEdit/easyeditor/util/nethook.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"70f6ab8bde55420e"}},{"code_sha256_prefix":"440ff98c2b1ae1aa","entry":"subsequence","repo":"yjiangcm/lte","repo_kind":"official","path":"EasyEdit/easyeditor/util/nethook.py","file_url":"https://github.com/yjiangcm/lte/blob/HEAD/EasyEdit/easyeditor/util/nethook.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"440ff98c2b1ae1aa"}},{"code_sha256_prefix":"385a35a03fe04cde","entry":"add_extra_stop_words","repo":"yjiangcm/lte","repo_kind":"official","path":"Qwen/openai_api.py","file_url":"https://github.com/yjiangcm/lte/blob/HEAD/Qwen/openai_api.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"385a35a03fe04cde"}},{"code_sha256_prefix":"d2e4c1979dd70b9a","entry":"get_model","repo":"yjiangcm/lte","repo_kind":"official","path":"EasyEdit/easyeditor/trainer/models.py","file_url":"https://github.com/yjiangcm/lte/blob/HEAD/EasyEdit/easyeditor/trainer/models.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d2e4c1979dd70b9a"}},{"code_sha256_prefix":"2defe42cf1a7f301","entry":"get_tokenizer","repo":"yjiangcm/lte","repo_kind":"official","path":"EasyEdit/easyeditor/trainer/models.py","file_url":"https://github.com/yjiangcm/lte/blob/HEAD/EasyEdit/easyeditor/trainer/models.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"2defe42cf1a7f301"}},{"code_sha256_prefix":"bcc592aa5c1e2bb3","entry":"kl_loc_loss","repo":"yjiangcm/lte","repo_kind":"official","path":"EasyEdit/easyeditor/trainer/losses.py","file_url":"https://github.com/yjiangcm/lte/blob/HEAD/EasyEdit/easyeditor/trainer/losses.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bcc592aa5c1e2bb3"}},{"code_sha256_prefix":"b10fc288b8419c43","entry":"load_model_on_gpus","repo":"yjiangcm/lte","repo_kind":"official","path":"Qwen/utils.py","file_url":"https://github.com/yjiangcm/lte/blob/HEAD/Qwen/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b10fc288b8419c43"}},{"code_sha256_prefix":"caf658f0bdfae9a9","entry":"multiclass_log_probs","repo":"yjiangcm/lte","repo_kind":"official","path":"EasyEdit/easyeditor/trainer/losses.py","file_url":"https://github.com/yjiangcm/lte/blob/HEAD/EasyEdit/easyeditor/trainer/losses.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"caf658f0bdfae9a9"}},{"code_sha256_prefix":"180743305f0b74c8","entry":"preprocess","repo":"yjiangcm/lte","repo_kind":"official","path":"Qwen/run_gptq.py","file_url":"https://github.com/yjiangcm/lte/blob/HEAD/Qwen/run_gptq.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"180743305f0b74c8"}},{"code_sha256_prefix":"469cf12b400c2c5a","entry":"trim_stop_words","repo":"yjiangcm/lte","repo_kind":"official","path":"Qwen/openai_api.py","file_url":"https://github.com/yjiangcm/lte/blob/HEAD/Qwen/openai_api.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"469cf12b400c2c5a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}