{"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/the-llm-surgeon","title":"The LLM Surgeon","arxiv_id":"2312.17244","date":"2023-12-28","proceeding":null,"authors":["Tycho F. A. van der Ouderaa","Markus Nagel","Mart van Baalen","Yuki M. Asano","Tijmen Blankevoort"],"abstract":"State-of-the-art language models are becoming increasingly large in an effort to achieve the highest performance on large corpora of available textual data. However, the sheer size of the Transformer architectures makes it difficult to deploy models within computational, environmental or device-specific constraints. We explore data-driven compression of existing pretrained models as an alternative to training smaller models from scratch. To do so, we scale Kronecker-factored curvature approximations of the target loss landscape to large language models. In doing so, we can compute both the dynamic allocation of structures that can be removed as well as updates of remaining weights that account for the removal. We provide a general framework for unstructured, semi-structured and structured pruning and improve upon weight updates to capture more correlations between weights, while remaining computationally efficient. Experimentally, our method can prune rows and columns from a range of OPT models and Llamav2-7B by 20%-30%, with a negligible loss in performance, and achieve state-of-the-art results in unstructured and semi-structured pruning of large language models.","url_abs":"https://arxiv.org/abs/2312.17244v2","url_pdf":"https://arxiv.org/pdf/2312.17244v2.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":"the-llm-surgeon","repo_url":"https://github.com/qualcomm-ai-research/llm-surgeon","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause-Clear"}}],"tasks":[],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"opt","method_name":"OPT"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"pruning","method_name":"Pruning"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2312.17244","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2312.17244"}},"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/qualcomm-ai-research/llm-surgeon","reach":{"status":"ok","spdx":"BSD-3-Clause-Clear"}}],"summary":{"ran":4,"unverified":6},"by_repo_kind":{"official":{"samples":10,"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":10,"samples":[{"code_sha256_prefix":"a431af9d814c9eaa","entry":"aug","repo":"qualcomm-ai-research/llm-surgeon","repo_kind":"official","path":"utils.py","file_url":"https://github.com/qualcomm-ai-research/llm-surgeon/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":"BSD-3-Clause-Clear","inline_ok":false,"mcp_get_code":{"code_sha256":"a431af9d814c9eaa"}},{"code_sha256_prefix":"a5d3cbfc9bb4c4f7","entry":"full_to_sub","repo":"qualcomm-ai-research/llm-surgeon","repo_kind":"official","path":"utils.py","file_url":"https://github.com/qualcomm-ai-research/llm-surgeon/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":"BSD-3-Clause-Clear","inline_ok":false,"mcp_get_code":{"code_sha256":"a5d3cbfc9bb4c4f7"}},{"code_sha256_prefix":"c59626c9589b79de","entry":"model_zeros","repo":"qualcomm-ai-research/llm-surgeon","repo_kind":"official","path":"sparsify.py","file_url":"https://github.com/qualcomm-ai-research/llm-surgeon/blob/HEAD/sparsify.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause-Clear","inline_ok":false,"mcp_get_code":{"code_sha256":"c59626c9589b79de"}},{"code_sha256_prefix":"bfea2b492c6547fd","entry":"sub_to_full","repo":"qualcomm-ai-research/llm-surgeon","repo_kind":"official","path":"utils.py","file_url":"https://github.com/qualcomm-ai-research/llm-surgeon/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":"BSD-3-Clause-Clear","inline_ok":false,"mcp_get_code":{"code_sha256":"bfea2b492c6547fd"}},{"code_sha256_prefix":"06c03aee41ce48f9","entry":"add_lora","repo":"qualcomm-ai-research/llm-surgeon","repo_kind":"official","path":"lora.py","file_url":"https://github.com/qualcomm-ai-research/llm-surgeon/blob/HEAD/lora.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause-Clear","inline_ok":false,"mcp_get_code":{"code_sha256":"06c03aee41ce48f9"}},{"code_sha256_prefix":"4b6dab2040cdb423","entry":"get_c4","repo":"qualcomm-ai-research/llm-surgeon","repo_kind":"official","path":"datautils.py","file_url":"https://github.com/qualcomm-ai-research/llm-surgeon/blob/HEAD/datautils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause-Clear","inline_ok":false,"mcp_get_code":{"code_sha256":"4b6dab2040cdb423"}},{"code_sha256_prefix":"cfa4a877e47a4198","entry":"get_model","repo":"qualcomm-ai-research/llm-surgeon","repo_kind":"official","path":"surgeon.py","file_url":"https://github.com/qualcomm-ai-research/llm-surgeon/blob/HEAD/surgeon.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause-Clear","inline_ok":false,"mcp_get_code":{"code_sha256":"cfa4a877e47a4198"}},{"code_sha256_prefix":"70e3f608921fbefa","entry":"get_mods","repo":"qualcomm-ai-research/llm-surgeon","repo_kind":"official","path":"curvature.py","file_url":"https://github.com/qualcomm-ai-research/llm-surgeon/blob/HEAD/curvature.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause-Clear","inline_ok":false,"mcp_get_code":{"code_sha256":"70e3f608921fbefa"}},{"code_sha256_prefix":"e28734bf35f1af35","entry":"get_wikipedia","repo":"qualcomm-ai-research/llm-surgeon","repo_kind":"official","path":"datautils.py","file_url":"https://github.com/qualcomm-ai-research/llm-surgeon/blob/HEAD/datautils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause-Clear","inline_ok":false,"mcp_get_code":{"code_sha256":"e28734bf35f1af35"}},{"code_sha256_prefix":"8f59498c44ab3856","entry":"get_wikitext2","repo":"qualcomm-ai-research/llm-surgeon","repo_kind":"official","path":"datautils.py","file_url":"https://github.com/qualcomm-ai-research/llm-surgeon/blob/HEAD/datautils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause-Clear","inline_ok":false,"mcp_get_code":{"code_sha256":"8f59498c44ab3856"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}