{"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/pruning-large-language-models-with-semi","title":"Pruning Large Language Models with Semi-Structural Adaptive Sparse Training","arxiv_id":"2407.20584","date":"2024-07-30","proceeding":null,"authors":["Weiyu Huang","Yuezhou Hu","Guohao Jian","Jun Zhu","Jianfei Chen"],"abstract":"The remarkable success of Large Language Models (LLMs) relies heavily on their substantial scale, which poses significant challenges during model deployment in terms of latency and memory consumption. Recently, numerous studies have attempted to compress LLMs using one-shot pruning methods. However, these methods often suffer from considerable performance degradation on complex language understanding tasks, raising concerns about the feasibility of pruning in LLMs. To address this issue, we propose Adaptive Sparse Trainer (AST), a novel and efficient retraining framework tailored for semi-structured sparse models. AST enables models to learn optimal masks during the weight update process without incurring additional computational overhead. Furthermore, we demonstrate that incorporating knowledge distillation significantly improves retraining efficiency and enhances model performance under fixed computational constraints. Additionally, a supplementary set of well-initialized parameters is integrated to further augment the model's efficacy. AST achieves state-of-the-art performance with minimal training cost. When applied to the LLaMA2-7B model, AST reduces the perplexity and zero-shot accuracy gap between dense and 2:4 semi-structured sparse models to 0.6 and 1.16%, respectively, utilizing less than 0.4% of the pretraining tokens and GPU hours. Our work demonstrates the feasibility of deploying semi-structured sparse LLMs and offers a promising alternative for achieving highly compressed models when combined with existing quantization techniques.","url_abs":"https://arxiv.org/abs/2407.20584v3","url_pdf":"https://arxiv.org/pdf/2407.20584v3.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":"pruning-large-language-models-with-semi","repo_url":"https://github.com/thu-ml/adaptive-sparse-trainer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":null,"task_name":"GPU"},{"task_slug":"knowledge-distillation","task_name":"Knowledge Distillation"},{"task_slug":"quantization","task_name":"Quantization"}],"methods":[{"method_slug":"knowledge-distillation","method_name":"Knowledge Distillation"},{"method_slug":"pruning","method_name":"Pruning"},{"method_slug":"set","method_name":"SET"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2407.20584","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2407.20584"}},"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/thu-ml/adaptive-sparse-trainer","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":6,"unverified":2},"by_repo_kind":{"official":{"samples":8,"ran":6,"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":"35c39367fa876cb1","entry":"get_linear_list","repo":"thu-ml/adaptive-sparse-trainer","repo_kind":"official","path":"LLaMA-2-7B/llmshearing/sparse/sparse_utils.py","file_url":"https://github.com/thu-ml/adaptive-sparse-trainer/blob/HEAD/LLaMA-2-7B/llmshearing/sparse/sparse_utils.py","link_basis":"first_harvest_node","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":"35c39367fa876cb1"}},{"code_sha256_prefix":"e30216d468c41586","entry":"get_nested_attr","repo":"thu-ml/adaptive-sparse-trainer","repo_kind":"official","path":"LLaMA-2-7B/llmshearing/sparse/sparse_utils.py","file_url":"https://github.com/thu-ml/adaptive-sparse-trainer/blob/HEAD/LLaMA-2-7B/llmshearing/sparse/sparse_utils.py","link_basis":"first_harvest_node","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":"e30216d468c41586"}},{"code_sha256_prefix":"dbbaeceaff4ae2ef","entry":"get_raw_model","repo":"thu-ml/adaptive-sparse-trainer","repo_kind":"official","path":"utils.py","file_url":"https://github.com/thu-ml/adaptive-sparse-trainer/blob/HEAD/utils.py","link_basis":"first_harvest_node","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":"dbbaeceaff4ae2ef"}},{"code_sha256_prefix":"be527ff62ff13c04","entry":"normal_attn_fn","repo":"thu-ml/adaptive-sparse-trainer","repo_kind":"official","path":"LLaMA-2-7B/llmshearing/models/composer_llama.py","file_url":"https://github.com/thu-ml/adaptive-sparse-trainer/blob/HEAD/LLaMA-2-7B/llmshearing/models/composer_llama.py","link_basis":"first_harvest_node","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":"be527ff62ff13c04"}},{"code_sha256_prefix":"d3bdf5250c6d2cd9","entry":"turn_head_z","repo":"thu-ml/adaptive-sparse-trainer","repo_kind":"official","path":"LLaMA-2-7B/llmshearing/models/composer_llama.py","file_url":"https://github.com/thu-ml/adaptive-sparse-trainer/blob/HEAD/LLaMA-2-7B/llmshearing/models/composer_llama.py","link_basis":"first_harvest_node","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":"d3bdf5250c6d2cd9"}},{"code_sha256_prefix":"86e85f31c3cef174","entry":"turn_mlp_z","repo":"thu-ml/adaptive-sparse-trainer","repo_kind":"official","path":"LLaMA-2-7B/llmshearing/models/composer_llama.py","file_url":"https://github.com/thu-ml/adaptive-sparse-trainer/blob/HEAD/LLaMA-2-7B/llmshearing/models/composer_llama.py","link_basis":"first_harvest_node","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":"86e85f31c3cef174"}},{"code_sha256_prefix":"96c9abdf6be0e778","entry":"eval_ppl","repo":"thu-ml/adaptive-sparse-trainer","repo_kind":"official","path":"LLaMA-2-7B/llmshearing/sparse/sparse_utils.py","file_url":"https://github.com/thu-ml/adaptive-sparse-trainer/blob/HEAD/LLaMA-2-7B/llmshearing/sparse/sparse_utils.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":"96c9abdf6be0e778"}},{"code_sha256_prefix":"95170b214d3dd627","entry":"eval_ppl","repo":"thu-ml/adaptive-sparse-trainer","repo_kind":"official","path":"utils.py","file_url":"https://github.com/thu-ml/adaptive-sparse-trainer/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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"95170b214d3dd627"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}