{"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/to-forget-or-not-towards-practical-knowledge","title":"To Forget or Not? Towards Practical Knowledge Unlearning for Large Language Models","arxiv_id":"2407.01920","date":"2024-07-02","proceeding":null,"authors":["Bozhong Tian","Xiaozhuan Liang","Siyuan Cheng","Qingbin Liu","Mengru Wang","Dianbo Sui","Xi Chen","Huajun Chen","Ningyu Zhang"],"abstract":"Large Language Models (LLMs) trained on extensive corpora inevitably retain sensitive data, such as personal privacy information and copyrighted material. Recent advancements in knowledge unlearning involve updating LLM parameters to erase specific knowledge. However, current unlearning paradigms are mired in vague forgetting boundaries, often erasing knowledge indiscriminately. In this work, we introduce KnowUnDo, a benchmark containing copyrighted content and user privacy domains to evaluate if the unlearning process inadvertently erases essential knowledge. Our findings indicate that existing unlearning methods often suffer from excessive unlearning. To address this, we propose a simple yet effective method, MemFlex, which utilizes gradient information to precisely target and unlearn sensitive parameters. Experimental results show that MemFlex is superior to existing methods in both precise knowledge unlearning and general knowledge retaining of LLMs. Code and dataset are released at https://github.com/zjunlp/KnowUnDo.","url_abs":"https://arxiv.org/abs/2407.01920v2","url_pdf":"https://arxiv.org/pdf/2407.01920v2.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":"to-forget-or-not-towards-practical-knowledge","repo_url":"https://github.com/zjunlp/knowundo","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"general-knowledge","task_name":"General Knowledge"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2407.01920","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2407.01920"}},"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/zjunlp/knowundo","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":3,"ran_draft_wrong":1,"unverified":5},"by_repo_kind":{"official":{"samples":9,"ran":4,"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":"b07fba5194f89d4c","entry":"compute_info","repo":"zjunlp/knowundo","repo_kind":"official","path":"pretrain/localization.py","file_url":"https://github.com/zjunlp/knowundo/blob/HEAD/pretrain/localization.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b07fba5194f89d4c"}},{"code_sha256_prefix":"798c7fa0566c9a0c","entry":"compute_kl","repo":"zjunlp/knowundo","repo_kind":"official","path":"llm_unlearn/methods/ascent_plus_KLdivergence.py","file_url":"https://github.com/zjunlp/knowundo/blob/HEAD/llm_unlearn/methods/ascent_plus_KLdivergence.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"798c7fa0566c9a0c"}},{"code_sha256_prefix":"649fc48067a48529","entry":"find_all_linear_names","repo":"zjunlp/knowundo","repo_kind":"official","path":"pretrain/pretrain.py","file_url":"https://github.com/zjunlp/knowundo/blob/HEAD/pretrain/pretrain.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"649fc48067a48529"}},{"code_sha256_prefix":"0d97632222d2ac81","entry":"replicate_samples","repo":"zjunlp/knowundo","repo_kind":"official","path":"pretrain/data_module.py","file_url":"https://github.com/zjunlp/knowundo/blob/HEAD/pretrain/data_module.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0d97632222d2ac81"}},{"code_sha256_prefix":"669009a59e41c2c9","entry":"add_dataset_index","repo":"zjunlp/knowundo","repo_kind":"official","path":"pretrain/config.py","file_url":"https://github.com/zjunlp/knowundo/blob/HEAD/pretrain/config.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"669009a59e41c2c9"}},{"code_sha256_prefix":"835be88a656b57c2","entry":"compute_cosine_similarity","repo":"zjunlp/knowundo","repo_kind":"official","path":"pretrain/localization.py","file_url":"https://github.com/zjunlp/knowundo/blob/HEAD/pretrain/localization.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"835be88a656b57c2"}},{"code_sha256_prefix":"7dec325d088c0b76","entry":"convert_raw_data_to_model_format","repo":"zjunlp/knowundo","repo_kind":"official","path":"pretrain/data_module.py","file_url":"https://github.com/zjunlp/knowundo/blob/HEAD/pretrain/data_module.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7dec325d088c0b76"}},{"code_sha256_prefix":"6f99db2c45b39255","entry":"convert_to_model_format_with_random_label","repo":"zjunlp/knowundo","repo_kind":"official","path":"pretrain/data_module.py","file_url":"https://github.com/zjunlp/knowundo/blob/HEAD/pretrain/data_module.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6f99db2c45b39255"}},{"code_sha256_prefix":"06448b0513272463","entry":"get_model_identifiers_from_yaml","repo":"zjunlp/knowundo","repo_kind":"official","path":"pretrain/config.py","file_url":"https://github.com/zjunlp/knowundo/blob/HEAD/pretrain/config.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"06448b0513272463"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}