{"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/miniplm-knowledge-distillation-for-pre","title":"MiniPLM: Knowledge Distillation for Pre-Training Language Models","arxiv_id":"2410.17215","date":"2024-10-22","proceeding":null,"authors":["Yuxian Gu","Hao Zhou","Fandong Meng","Jie zhou","Minlie Huang"],"abstract":"Knowledge distillation (KD) is widely used to train small, high-performing student language models (LMs) using large teacher LMs. While effective in fine-tuning, KD during pre-training faces challenges in efficiency, flexibility, and effectiveness. Existing methods either incur high computational costs due to online teacher inference, require tokenization matching between teacher and student LMs, or risk losing the difficulty and diversity of the teacher-generated training data. To address these issues, we propose MiniPLM, a KD framework for pre-training LMs by refining the training data distribution with the teacher's knowledge. For efficiency, MiniPLM performs offline teacher LM inference, allowing KD for multiple student LMs without adding training-time costs. For flexibility, MiniPLM operates solely on the training corpus, enabling KD across model families. For effectiveness, MiniPLM leverages the differences between large and small LMs to enhance the difficulty and diversity of the training data, helping student LMs acquire versatile and sophisticated knowledge. Extensive experiments demonstrate that MiniPLM boosts the student LMs' performance on 9 widely used downstream tasks, improves the language modeling capabilities, and reduces pre-training computation. The benefit of MiniPLM extends to large pre-training scales, evidenced by the extrapolation of the scaling curves. Further analysis reveals that MiniPLM supports KD across model families and enhances the utilization of pre-training data. Our model, code, and data are available at https://github.com/thu-coai/MiniPLM.","url_abs":"https://arxiv.org/abs/2410.17215v2","url_pdf":"https://arxiv.org/pdf/2410.17215v2.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":"miniplm-knowledge-distillation-for-pre","repo_url":"https://github.com/thu-coai/miniplm","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"diversity","task_name":"Diversity"},{"task_slug":"knowledge-distillation","task_name":"Knowledge Distillation"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2410.17215","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2410.17215"}},"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/thu-coai/MiniPLM","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/thu-coai/miniplm","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":12},"by_repo_kind":{"official":{"samples":12,"ran":0,"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":"30b0df65999d2740","entry":"add_data_args","repo":"thu-coai/MiniPLM","repo_kind":"official","path":"arguments.py","file_url":"https://github.com/thu-coai/MiniPLM/blob/HEAD/arguments.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":"30b0df65999d2740"}},{"code_sha256_prefix":"0bc5687474aef13d","entry":"add_model_args","repo":"thu-coai/MiniPLM","repo_kind":"official","path":"arguments.py","file_url":"https://github.com/thu-coai/MiniPLM/blob/HEAD/arguments.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":"0bc5687474aef13d"}},{"code_sha256_prefix":"12b30d3c2c4c55cf","entry":"add_runtime_args","repo":"thu-coai/MiniPLM","repo_kind":"official","path":"arguments.py","file_url":"https://github.com/thu-coai/MiniPLM/blob/HEAD/arguments.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":"12b30d3c2c4c55cf"}},{"code_sha256_prefix":"b3338fae912274b3","entry":"best_fitting_dtype","repo":"thu-coai/MiniPLM","repo_kind":"official","path":"data_utils/indexed_dataset.py","file_url":"https://github.com/thu-coai/MiniPLM/blob/HEAD/data_utils/indexed_dataset.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":"b3338fae912274b3"}},{"code_sha256_prefix":"18d94355ea8f1c39","entry":"code","repo":"thu-coai/MiniPLM","repo_kind":"official","path":"data_utils/distributed_indexed.py","file_url":"https://github.com/thu-coai/MiniPLM/blob/HEAD/data_utils/distributed_indexed.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":"18d94355ea8f1c39"}},{"code_sha256_prefix":"bdf28f9492a770dc","entry":"data_file_path","repo":"thu-coai/MiniPLM","repo_kind":"official","path":"data_utils/distributed_indexed.py","file_url":"https://github.com/thu-coai/MiniPLM/blob/HEAD/data_utils/distributed_indexed.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":"bdf28f9492a770dc"}},{"code_sha256_prefix":"ae64ae2a98def56a","entry":"get_distribution","repo":"thu-coai/MiniPLM","repo_kind":"official","path":"utils.py","file_url":"https://github.com/thu-coai/MiniPLM/blob/HEAD/utils.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":"ae64ae2a98def56a"}},{"code_sha256_prefix":"8b1a74a6db32c163","entry":"index_file_path","repo":"thu-coai/MiniPLM","repo_kind":"official","path":"data_utils/distributed_indexed.py","file_url":"https://github.com/thu-coai/MiniPLM/blob/HEAD/data_utils/distributed_indexed.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":"8b1a74a6db32c163"}},{"code_sha256_prefix":"8c2ad3ddcd7a09d7","entry":"infer_dataset_impl","repo":"thu-coai/MiniPLM","repo_kind":"official","path":"data_utils/indexed_dataset.py","file_url":"https://github.com/thu-coai/MiniPLM/blob/HEAD/data_utils/indexed_dataset.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":"8c2ad3ddcd7a09d7"}},{"code_sha256_prefix":"fa072231e5230b82","entry":"make_builder","repo":"thu-coai/MiniPLM","repo_kind":"official","path":"data_utils/indexed_dataset.py","file_url":"https://github.com/thu-coai/MiniPLM/blob/HEAD/data_utils/indexed_dataset.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":"fa072231e5230b82"}},{"code_sha256_prefix":"7fa1678cee06fa0a","entry":"sample","repo":"thu-coai/MiniPLM","repo_kind":"official","path":"utils.py","file_url":"https://github.com/thu-coai/MiniPLM/blob/HEAD/utils.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":"7fa1678cee06fa0a"}},{"code_sha256_prefix":"22469ee6c0ed3e2a","entry":"sample_from_draft_model","repo":"thu-coai/MiniPLM","repo_kind":"official","path":"utils.py","file_url":"https://github.com/thu-coai/MiniPLM/blob/HEAD/utils.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":"22469ee6c0ed3e2a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}