{"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/backdoor-removal-for-generative-large","title":"Simulate and Eliminate: Revoke Backdoors for Generative Large Language Models","arxiv_id":"2405.07667","date":"2024-05-13","proceeding":null,"authors":["Haoran Li","Yulin Chen","Zihao Zheng","Qi Hu","Chunkit Chan","Heshan Liu","Yangqiu Song"],"abstract":"With rapid advances, generative large language models (LLMs) dominate various Natural Language Processing (NLP) tasks from understanding to reasoning. Yet, language models' inherent vulnerabilities may be exacerbated due to increased accessibility and unrestricted model training on massive data. A malicious adversary may publish poisoned data online and conduct backdoor attacks on the victim LLMs pre-trained on the poisoned data. Backdoored LLMs behave innocuously for normal queries and generate harmful responses when the backdoor trigger is activated. Despite significant efforts paid to LLMs' safety issues, LLMs are still struggling against backdoor attacks. As Anthropic recently revealed, existing safety training strategies, including supervised fine-tuning (SFT) and Reinforcement Learning from Human Feedback (RLHF), fail to revoke the backdoors once the LLM is backdoored during the pre-training stage. In this paper, we present Simulate and Eliminate (SANDE) to erase the undesired backdoored mappings for generative LLMs. We initially propose Overwrite Supervised Fine-tuning (OSFT) for effective backdoor removal when the trigger is known. Then, to handle scenarios where trigger patterns are unknown, we integrate OSFT into our two-stage framework, SANDE. Unlike other works that assume access to cleanly trained models, our safety-enhanced LLMs are able to revoke backdoors without any reference. Consequently, our safety-enhanced LLMs no longer produce targeted responses when the backdoor triggers are activated. We conduct comprehensive experiments to show that our proposed SANDE is effective against backdoor attacks while bringing minimal harm to LLMs' powerful capability.","url_abs":"https://arxiv.org/abs/2405.07667v2","url_pdf":"https://arxiv.org/pdf/2405.07667v2.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":"backdoor-removal-for-generative-large","repo_url":"https://github.com/HKUST-KnowComp/SANDE","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2405.07667","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2405.07667"}},"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/HKUST-KnowComp/SANDE","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":7},"by_repo_kind":{"official":{"samples":7,"ran":7,"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":"f217ff4ee51b4a30","entry":"exist_and_not_none","repo":"HKUST-KnowComp/SANDE","repo_kind":"official","path":"dataset.py","file_url":"https://github.com/HKUST-KnowComp/SANDE/blob/HEAD/dataset.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":"f217ff4ee51b4a30"}},{"code_sha256_prefix":"f7c48c9631124114","entry":"get_eval_ds_config","repo":"HKUST-KnowComp/SANDE","repo_kind":"official","path":"deepspeed_utils.py","file_url":"https://github.com/HKUST-KnowComp/SANDE/blob/HEAD/deepspeed_utils.py","link_basis":"harvester_set","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":"f7c48c9631124114"}},{"code_sha256_prefix":"e075b810b6afd6d1","entry":"get_optimizer_grouped_parameters","repo":"HKUST-KnowComp/SANDE","repo_kind":"official","path":"deepspeed_utils.py","file_url":"https://github.com/HKUST-KnowComp/SANDE/blob/HEAD/deepspeed_utils.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":"e075b810b6afd6d1"}},{"code_sha256_prefix":"53710fec31027c67","entry":"get_tokenizer","repo":"HKUST-KnowComp/SANDE","repo_kind":"official","path":"eval_utility.py","file_url":"https://github.com/HKUST-KnowComp/SANDE/blob/HEAD/eval_utility.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":"53710fec31027c67"}},{"code_sha256_prefix":"05904ae9639815b8","entry":"get_train_ds_config","repo":"HKUST-KnowComp/SANDE","repo_kind":"official","path":"deepspeed_utils.py","file_url":"https://github.com/HKUST-KnowComp/SANDE/blob/HEAD/deepspeed_utils.py","link_basis":"harvester_set","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":"05904ae9639815b8"}},{"code_sha256_prefix":"775a2e3aee27b5c8","entry":"preprocess_data","repo":"HKUST-KnowComp/SANDE","repo_kind":"official","path":"dataset.py","file_url":"https://github.com/HKUST-KnowComp/SANDE/blob/HEAD/dataset.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":"775a2e3aee27b5c8"}},{"code_sha256_prefix":"c48a5c183e44469e","entry":"zero_pad_sequences","repo":"HKUST-KnowComp/SANDE","repo_kind":"official","path":"dataset.py","file_url":"https://github.com/HKUST-KnowComp/SANDE/blob/HEAD/dataset.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":"c48a5c183e44469e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}