{"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/shaving-weights-with-occam-s-razor-bayesian","title":"Shaving Weights with Occam's Razor: Bayesian Sparsification for Neural Networks Using the Marginal Likelihood","arxiv_id":"2402.15978","date":"2024-02-25","proceeding":null,"authors":["Rayen Dhahri","Alexander Immer","Betrand Charpentier","Stephan Günnemann","Vincent Fortuin"],"abstract":"Neural network sparsification is a promising avenue to save computational time and memory costs, especially in an age where many successful AI models are becoming too large to na\\\"ively deploy on consumer hardware. While much work has focused on different weight pruning criteria, the overall sparsifiability of the network, i.e., its capacity to be pruned without quality loss, has often been overlooked. We present Sparsifiability via the Marginal likelihood (SpaM), a pruning framework that highlights the effectiveness of using the Bayesian marginal likelihood in conjunction with sparsity-inducing priors for making neural networks more sparsifiable. Our approach implements an automatic Occam's razor that selects the most sparsifiable model that still explains the data well, both for structured and unstructured sparsification. In addition, we demonstrate that the pre-computed posterior Hessian approximation used in the Laplace approximation can be re-used to define a cheap pruning criterion, which outperforms many existing (more expensive) approaches. We demonstrate the effectiveness of our framework, especially at high sparsity levels, across a range of different neural network architectures and datasets.","url_abs":"https://arxiv.org/abs/2402.15978v2","url_pdf":"https://arxiv.org/pdf/2402.15978v2.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":"shaving-weights-with-occam-s-razor-bayesian","repo_url":"https://github.com/fortuinlab/spam-pruning","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[],"methods":[{"method_slug":"pruning","method_name":"Pruning"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.15978","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.15978"}},"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/fortuinlab/spam-pruning","reach":null},{"provenance":"deterministic:regex_extraction","url":"https://github.com/kazukiosawa/asdl","reach":null}],"summary":{"ran_honours":3,"ran_draft_wrong":3,"unverified":1},"by_repo_kind":{"official":{"samples":7,"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":7,"samples":[{"code_sha256_prefix":"b81882decca625ee","entry":"get_num_params","repo":"fortuinlab/spam-pruning","repo_kind":"official","path":"experiment/src/marglikopt.py","file_url":"https://github.com/fortuinlab/spam-pruning/blob/HEAD/experiment/src/marglikopt.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":2,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b81882decca625ee"}},{"code_sha256_prefix":"6be4055fc03ae57c","entry":"create_mask_from_scores","repo":"fortuinlab/spam-pruning","repo_kind":"official","path":"experiment/src/structured_sparsity.py","file_url":"https://github.com/fortuinlab/spam-pruning/blob/HEAD/experiment/src/structured_sparsity.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6be4055fc03ae57c"}},{"code_sha256_prefix":"9d92e467fe9c8557","entry":"get_sparsity","repo":"fortuinlab/spam-pruning","repo_kind":"official","path":"experiment/src/marglikopt.py","file_url":"https://github.com/fortuinlab/spam-pruning/blob/HEAD/experiment/src/marglikopt.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9d92e467fe9c8557"}},{"code_sha256_prefix":"6bf1a03a315b9487","entry":"get_sparsity_all","repo":"fortuinlab/spam-pruning","repo_kind":"official","path":"experiment/src/marglikopt.py","file_url":"https://github.com/fortuinlab/spam-pruning/blob/HEAD/experiment/src/marglikopt.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6bf1a03a315b9487"}},{"code_sha256_prefix":"5e99d300d3e38f67","entry":"linearize","repo":"fortuinlab/spam-pruning","repo_kind":"official","path":"experiment/src/structured_sparsity.py","file_url":"https://github.com/fortuinlab/spam-pruning/blob/HEAD/experiment/src/structured_sparsity.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5e99d300d3e38f67"}},{"code_sha256_prefix":"e659be0b4a3b9f45","entry":"structured_prune","repo":"fortuinlab/spam-pruning","repo_kind":"official","path":"experiment/src/structured_sparsity.py","file_url":"https://github.com/fortuinlab/spam-pruning/blob/HEAD/experiment/src/structured_sparsity.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e659be0b4a3b9f45"}},{"code_sha256_prefix":"9d1412b481c73d71","entry":"get_threshs","repo":"fortuinlab/spam-pruning","repo_kind":"official","path":"experiment/src/sparsify_v2.py","file_url":"https://github.com/fortuinlab/spam-pruning/blob/HEAD/experiment/src/sparsify_v2.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9d1412b481c73d71"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}