{"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/sparse-expansion-and-neuronal-disentanglement","title":"Sparse Expansion and Neuronal Disentanglement","arxiv_id":"2405.15756","date":"2024-05-24","proceeding":null,"authors":["Shashata Sawmya","Linghao Kong","Ilia Markov","Dan Alistarh","Nir Shavit"],"abstract":"We show how to improve the inference efficiency of an LLM by expanding it into a mixture of sparse experts, where each expert is a copy of the original weights, one-shot pruned for a specific cluster of input values. We call this approach $\\textit{Sparse Expansion}$. We show that, for models such as Llama 2 70B, as we increase the number of sparse experts, Sparse Expansion outperforms all other one-shot sparsification approaches for the same inference FLOP budget per token, and that this gap grows as sparsity increases, leading to inference speedups. But why? To answer this, we provide strong evidence that the mixture of sparse experts is effectively $\\textit{disentangling}$ the input-output relationship of every individual neuron across clusters of inputs. Specifically, sparse experts approximate the dense neuron output distribution with fewer weights by decomposing the distribution into a collection of simpler ones, each with a separate sparse dot product covering it. Interestingly, we show that the Wasserstein distance between a neuron's output distribution and a Gaussian distribution is an indicator of its entanglement level and contribution to the accuracy of the model. Every layer of an LLM has a fraction of highly entangled Wasserstein neurons, and model performance suffers more when these are sparsified as opposed to others. The code for Sparse Expansion is available at: https://github.com/Shavit-Lab/Sparse-Expansion .","url_abs":"https://arxiv.org/abs/2405.15756v2","url_pdf":"https://arxiv.org/pdf/2405.15756v2.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":"sparse-expansion-and-neuronal-disentanglement","repo_url":"https://github.com/shavit-lab/sparse-expansion","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"disentanglement","task_name":"Disentanglement"}],"methods":[{"method_slug":"llama","method_name":"LLaMA"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2405.15756","atlas_url":"https://app.syntology.ai/?focus=2405.15756","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2405.15756"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/shavit-lab/sparse-expansion","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":1,"ran":3,"unverified":5},"by_repo_kind":{"official":{"samples":9,"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":0,"samples":[{"code_sha256_prefix":"a9e7f2cdf016b88b","entry":"find_layers","repo":"shavit-lab/sparse-expansion","repo_kind":"official","path":"utils/modelutils.py","file_url":"https://github.com/shavit-lab/sparse-expansion/blob/HEAD/utils/modelutils.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a9e7f2cdf016b88b"}},{"code_sha256_prefix":"1e547e8d369f2be4","entry":"maybe_0th_element","repo":"shavit-lab/sparse-expansion","repo_kind":"official","path":"llama_finetune.py","file_url":"https://github.com/shavit-lab/sparse-expansion/blob/HEAD/llama_finetune.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1e547e8d369f2be4"}},{"code_sha256_prefix":"50ceff9d34d96d60","entry":"quantize","repo":"shavit-lab/sparse-expansion","repo_kind":"official","path":"utils/quant.py","file_url":"https://github.com/shavit-lab/sparse-expansion/blob/HEAD/utils/quant.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"50ceff9d34d96d60"}},{"code_sha256_prefix":"1c09038e6654a6f8","entry":"sparsity_type","repo":"shavit-lab/sparse-expansion","repo_kind":"official","path":"utils/parser.py","file_url":"https://github.com/shavit-lab/sparse-expansion/blob/HEAD/utils/parser.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1c09038e6654a6f8"}},{"code_sha256_prefix":"c6dd03f3342d1724","entry":"get_llama","repo":"shavit-lab/sparse-expansion","repo_kind":"official","path":"utils/modelutils.py","file_url":"https://github.com/shavit-lab/sparse-expansion/blob/HEAD/utils/modelutils.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":"c6dd03f3342d1724"}},{"code_sha256_prefix":"a7cbf4fc49c71e03","entry":"get_ptb","repo":"shavit-lab/sparse-expansion","repo_kind":"official","path":"utils/datautils.py","file_url":"https://github.com/shavit-lab/sparse-expansion/blob/HEAD/utils/datautils.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":"a7cbf4fc49c71e03"}},{"code_sha256_prefix":"34a49223d77496fe","entry":"get_pythia","repo":"shavit-lab/sparse-expansion","repo_kind":"official","path":"utils/modelutils.py","file_url":"https://github.com/shavit-lab/sparse-expansion/blob/HEAD/utils/modelutils.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":"34a49223d77496fe"}},{"code_sha256_prefix":"1e2490fb310d6a27","entry":"get_tokenizer","repo":"shavit-lab/sparse-expansion","repo_kind":"official","path":"utils/datautils.py","file_url":"https://github.com/shavit-lab/sparse-expansion/blob/HEAD/utils/datautils.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":"1e2490fb310d6a27"}},{"code_sha256_prefix":"380c081883a25dfd","entry":"get_wikitext2","repo":"shavit-lab/sparse-expansion","repo_kind":"official","path":"utils/datautils.py","file_url":"https://github.com/shavit-lab/sparse-expansion/blob/HEAD/utils/datautils.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":"380c081883a25dfd"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}