{"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/self-distillation-bridges-distribution-gap-in","title":"Self-Distillation Bridges Distribution Gap in Language Model Fine-Tuning","arxiv_id":"2402.13669","date":"2024-02-21","proceeding":null,"authors":["Zhaorui Yang","Tianyu Pang","Haozhe Feng","Han Wang","Wei Chen","Minfeng Zhu","Qian Liu"],"abstract":"The surge in Large Language Models (LLMs) has revolutionized natural language processing, but fine-tuning them for specific tasks often encounters challenges in balancing performance and preserving general instruction-following abilities. In this paper, we posit that the distribution gap between task datasets and the LLMs serves as the primary underlying cause. To address the problem, we introduce Self-Distillation Fine-Tuning (SDFT), a novel approach that bridges the distribution gap by guiding fine-tuning with a distilled dataset generated by the model itself to match its original distribution. Experimental results on the Llama-2-chat model across various benchmarks demonstrate that SDFT effectively mitigates catastrophic forgetting while achieving comparable or superior performance on downstream tasks compared to the vanilla fine-tuning. Moreover, SDFT demonstrates the potential to maintain the helpfulness and safety alignment of LLMs. Our code is available at https://github.com/sail-sg/sdft.","url_abs":"https://arxiv.org/abs/2402.13669v2","url_pdf":"https://arxiv.org/pdf/2402.13669v2.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":"self-distillation-bridges-distribution-gap-in","repo_url":"https://github.com/sail-sg/sdft","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}}],"tasks":[{"task_slug":"instruction-following","task_name":"Instruction Following"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"safety-alignment","task_name":"Safety Alignment"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.13669","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.13669"}},"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":"deterministic:regex_extraction","url":"https://github.com/sail-sg/sdft","reach":{"status":"ok"}}],"summary":{"ran":11},"by_repo_kind":{"official":{"samples":11,"ran":11,"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":11,"samples":[{"code_sha256_prefix":"8e38a7f4c3b74f9f","entry":"check_magicoder","repo":"sail-sg/sdft","repo_kind":"official","path":"eval/eval_magicoder.py","file_url":"https://github.com/sail-sg/sdft/blob/HEAD/eval/eval_magicoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8e38a7f4c3b74f9f"}},{"code_sha256_prefix":"26b2773e736f78dd","entry":"check_openfunction","repo":"sail-sg/sdft","repo_kind":"official","path":"eval/eval_openfunction.py","file_url":"https://github.com/sail-sg/sdft/blob/HEAD/eval/eval_openfunction.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"26b2773e736f78dd"}},{"code_sha256_prefix":"b9d80359c50174e0","entry":"contains_keywords","repo":"sail-sg/sdft","repo_kind":"official","path":"eval/eval_magicoder.py","file_url":"https://github.com/sail-sg/sdft/blob/HEAD/eval/eval_magicoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b9d80359c50174e0"}},{"code_sha256_prefix":"c70eb4756e638ed0","entry":"eval","repo":"sail-sg/sdft","repo_kind":"official","path":"eval/keyword_eval_safety.py","file_url":"https://github.com/sail-sg/sdft/blob/HEAD/eval/keyword_eval_safety.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c70eb4756e638ed0"}},{"code_sha256_prefix":"73cbe2d0163944c7","entry":"find_answer_key","repo":"sail-sg/sdft","repo_kind":"official","path":"eval/gen_distilled_data.py","file_url":"https://github.com/sail-sg/sdft/blob/HEAD/eval/gen_distilled_data.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"73cbe2d0163944c7"}},{"code_sha256_prefix":"7d02bf0b46db03b1","entry":"find_last_integer","repo":"sail-sg/sdft","repo_kind":"official","path":"eval/utils.py","file_url":"https://github.com/sail-sg/sdft/blob/HEAD/eval/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7d02bf0b46db03b1"}},{"code_sha256_prefix":"f4218ed8a7d62be1","entry":"get_bleu4_array","repo":"sail-sg/sdft","repo_kind":"official","path":"eval/eval_bleu4.py","file_url":"https://github.com/sail-sg/sdft/blob/HEAD/eval/eval_bleu4.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f4218ed8a7d62be1"}},{"code_sha256_prefix":"b193dd7920d260e3","entry":"get_outputs","repo":"sail-sg/sdft","repo_kind":"official","path":"eval/utils.py","file_url":"https://github.com/sail-sg/sdft/blob/HEAD/eval/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b193dd7920d260e3"}},{"code_sha256_prefix":"a1f7d6db520591f5","entry":"is_safe","repo":"sail-sg/sdft","repo_kind":"official","path":"eval/keyword_eval_safety.py","file_url":"https://github.com/sail-sg/sdft/blob/HEAD/eval/keyword_eval_safety.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a1f7d6db520591f5"}},{"code_sha256_prefix":"daf7c701c6269867","entry":"standardize_function_call","repo":"sail-sg/sdft","repo_kind":"official","path":"eval/eval_openfunction.py","file_url":"https://github.com/sail-sg/sdft/blob/HEAD/eval/eval_openfunction.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"daf7c701c6269867"}},{"code_sha256_prefix":"11c643b41155d018","entry":"starts_right","repo":"sail-sg/sdft","repo_kind":"official","path":"eval/eval_magicoder.py","file_url":"https://github.com/sail-sg/sdft/blob/HEAD/eval/eval_magicoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"11c643b41155d018"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}