{"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/retraining-free-merging-of-sparse-mixture-of","title":"Retraining-Free Merging of Sparse MoE via Hierarchical Clustering","arxiv_id":"2410.08589","date":"2024-10-11","proceeding":null,"authors":["I-Chun Chen","Hsu-Shen Liu","Wei-Fang Sun","Chen-Hao Chao","Yen-Chang Hsu","Chun-Yi Lee"],"abstract":"Sparse Mixture-of-Experts (SMoE) models represent a significant advancement in large language model (LLM) development through their efficient parameter utilization. These models achieve substantial performance improvements at reduced inference costs. However, the deployment of SMoE models faces constraints from extensive memory requirements of expert components in resource-limited environments. To address these limitations, this paper introduces Hierarchical Clustering for Sparsely activated Mixture of Experts (HC-SMoE), a task-agnostic expert merging framework for parameter reduction without retraining. HC-SMoE introduces a novel hierarchical clustering approach based on expert outputs to ensure merging robustness independent of routing decisions. The proposed output-based clustering method enables effective capture of functional relationships between experts for large-scale architectures. We provide theoretical analysis and comprehensive evaluations across multiple zero-shot language tasks to demonstrate HC-SMoE's effectiveness in state-of-the-art models including Qwen and Mixtral. The experimental results validate HC-SMoE's superior performance and practical applicability for real-world deployments.","url_abs":"https://arxiv.org/abs/2410.08589v2","url_pdf":"https://arxiv.org/pdf/2410.08589v2.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":"retraining-free-merging-of-sparse-mixture-of","repo_url":"https://github.com/wazenmai/hc-smoe","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"clustering","task_name":"Clustering"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"large-language-model","task_name":"Large Language Model"},{"task_slug":"mixture-of-experts","task_name":"Mixture-of-Experts"}],"methods":[{"method_slug":"set","method_name":"SET"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2410.08589","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2410.08589"}},"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/wazenmai/HC-SMoE","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/wazenmai/hc-smoe","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":8,"ran_fixture":4,"ran_draft_wrong":3,"unverified":7},"by_repo_kind":{"official":{"samples":22,"ran":15,"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":"2663637656dd4380","entry":"apply_mask","repo":"wazenmai/HC-SMoE","repo_kind":"official","path":"hcsmoe/merging/grouping_mixtral.py","file_url":"https://github.com/wazenmai/HC-SMoE/blob/HEAD/hcsmoe/merging/grouping_mixtral.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":"2663637656dd4380"}},{"code_sha256_prefix":"8af6d52439df5ac1","entry":"bhattacharyya_distance","repo":"wazenmai/HC-SMoE","repo_kind":"official","path":"hcsmoe/merging/overlap.py","file_url":"https://github.com/wazenmai/HC-SMoE/blob/HEAD/hcsmoe/merging/overlap.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":"8af6d52439df5ac1"}},{"code_sha256_prefix":"89eaaed986467ca4","entry":"compute_distance","repo":"wazenmai/hc-smoe","repo_kind":"official","path":"hcsmoe/merging/clustering.py","file_url":"https://github.com/wazenmai/hc-smoe/blob/HEAD/hcsmoe/merging/clustering.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"89eaaed986467ca4"}},{"code_sha256_prefix":"445a25a3378933c0","entry":"compute_silhouette_score","repo":"wazenmai/hc-smoe","repo_kind":"official","path":"hcsmoe/merging/clustering.py","file_url":"https://github.com/wazenmai/hc-smoe/blob/HEAD/hcsmoe/merging/clustering.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"445a25a3378933c0"}},{"code_sha256_prefix":"9e3b2b903c89aa39","entry":"compute_silhouette_score","repo":"wazenmai/hc-smoe","repo_kind":"official","path":"hcsmoe/merging/clustering.py","file_url":"https://github.com/wazenmai/hc-smoe/blob/HEAD/hcsmoe/merging/clustering.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9e3b2b903c89aa39"}},{"code_sha256_prefix":"cd57bc0268739af9","entry":"compute_switch_permutation_by_weight_matching","repo":"wazenmai/HC-SMoE","repo_kind":"official","path":"hcsmoe/merging/permutation.py","file_url":"https://github.com/wazenmai/HC-SMoE/blob/HEAD/hcsmoe/merging/permutation.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":"cd57bc0268739af9"}},{"code_sha256_prefix":"644aac920c458274","entry":"hijack","repo":"wazenmai/HC-SMoE","repo_kind":"official","path":"hcsmoe/merging/grouping_mixtral.py","file_url":"https://github.com/wazenmai/HC-SMoE/blob/HEAD/hcsmoe/merging/grouping_mixtral.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":"644aac920c458274"}},{"code_sha256_prefix":"c20ae1a60dcd8e85","entry":"hijack","repo":"wazenmai/HC-SMoE","repo_kind":"official","path":"hcsmoe/merging/grouping_qwen.py","file_url":"https://github.com/wazenmai/HC-SMoE/blob/HEAD/hcsmoe/merging/grouping_qwen.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":"c20ae1a60dcd8e85"}},{"code_sha256_prefix":"4047127dc3316fbe","entry":"linkage_step","repo":"wazenmai/hc-smoe","repo_kind":"official","path":"hcsmoe/merging/clustering.py","file_url":"https://github.com/wazenmai/hc-smoe/blob/HEAD/hcsmoe/merging/clustering.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4047127dc3316fbe"}},{"code_sha256_prefix":"09fbe56b373956ff","entry":"overlap_rate","repo":"wazenmai/HC-SMoE","repo_kind":"official","path":"hcsmoe/merging/overlap.py","file_url":"https://github.com/wazenmai/HC-SMoE/blob/HEAD/hcsmoe/merging/overlap.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":"09fbe56b373956ff"}},{"code_sha256_prefix":"ff29e60e8a9b900a","entry":"overlap_rate_bhattacharyya","repo":"wazenmai/HC-SMoE","repo_kind":"official","path":"hcsmoe/merging/overlap.py","file_url":"https://github.com/wazenmai/HC-SMoE/blob/HEAD/hcsmoe/merging/overlap.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":"ff29e60e8a9b900a"}},{"code_sha256_prefix":"881d32a340b4337a","entry":"pairwise_distances","repo":"wazenmai/hc-smoe","repo_kind":"official","path":"hcsmoe/merging/clustering.py","file_url":"https://github.com/wazenmai/hc-smoe/blob/HEAD/hcsmoe/merging/clustering.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"881d32a340b4337a"}},{"code_sha256_prefix":"ed870812c5e5c849","entry":"permute_switch_mlp_dense_expert_","repo":"wazenmai/HC-SMoE","repo_kind":"official","path":"hcsmoe/merging/permutation.py","file_url":"https://github.com/wazenmai/HC-SMoE/blob/HEAD/hcsmoe/merging/permutation.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":"ed870812c5e5c849"}},{"code_sha256_prefix":"ac28dcec5c8aa992","entry":"remove_col","repo":"wazenmai/HC-SMoE","repo_kind":"official","path":"hcsmoe/merging/grouping_mixtral.py","file_url":"https://github.com/wazenmai/HC-SMoE/blob/HEAD/hcsmoe/merging/grouping_mixtral.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ac28dcec5c8aa992"}},{"code_sha256_prefix":"d7c56984b5555b6e","entry":"safe_average","repo":"wazenmai/hc-smoe","repo_kind":"official","path":"hcsmoe/merging/clustering.py","file_url":"https://github.com/wazenmai/hc-smoe/blob/HEAD/hcsmoe/merging/clustering.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d7c56984b5555b6e"}},{"code_sha256_prefix":"5f5c679efbd91d5c","entry":"align_switch_permutation_for_all_experts_by_weight_matching","repo":"wazenmai/HC-SMoE","repo_kind":"official","path":"hcsmoe/merging/permutation.py","file_url":"https://github.com/wazenmai/HC-SMoE/blob/HEAD/hcsmoe/merging/permutation.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":"5f5c679efbd91d5c"}},{"code_sha256_prefix":"e4b8bffda1c924f8","entry":"evaluate_minipile_perplexity","repo":"wazenmai/HC-SMoE","repo_kind":"official","path":"hcsmoe/evaluation/minipile.py","file_url":"https://github.com/wazenmai/HC-SMoE/blob/HEAD/hcsmoe/evaluation/minipile.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":"e4b8bffda1c924f8"}},{"code_sha256_prefix":"2a3e7e560f218cc4","entry":"generate_random_group_labels","repo":"wazenmai/HC-SMoE","repo_kind":"official","path":"hcsmoe/merging/utils.py","file_url":"https://github.com/wazenmai/HC-SMoE/blob/HEAD/hcsmoe/merging/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":"2a3e7e560f218cc4"}},{"code_sha256_prefix":"2ce9c4afb75f7a42","entry":"get_minipile_dataloder","repo":"wazenmai/HC-SMoE","repo_kind":"official","path":"hcsmoe/evaluation/minipile.py","file_url":"https://github.com/wazenmai/HC-SMoE/blob/HEAD/hcsmoe/evaluation/minipile.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":"2ce9c4afb75f7a42"}},{"code_sha256_prefix":"41388c0799d06a0b","entry":"group_experts_by_clustering","repo":"wazenmai/hc-smoe","repo_kind":"official","path":"hcsmoe/merging/clustering.py","file_url":"https://github.com/wazenmai/hc-smoe/blob/HEAD/hcsmoe/merging/clustering.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":"41388c0799d06a0b"}},{"code_sha256_prefix":"83e8336dcb695d24","entry":"hierarchical_clustering_dynamic","repo":"wazenmai/hc-smoe","repo_kind":"official","path":"hcsmoe/merging/clustering.py","file_url":"https://github.com/wazenmai/hc-smoe/blob/HEAD/hcsmoe/merging/clustering.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":"83e8336dcb695d24"}},{"code_sha256_prefix":"1ea84b1496629450","entry":"safe_average","repo":"wazenmai/HC-SMoE","repo_kind":"official","path":"hcsmoe/merging/clustering.py","file_url":"https://github.com/wazenmai/HC-SMoE/blob/HEAD/hcsmoe/merging/clustering.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":"1ea84b1496629450"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}