{"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/exploring-learngene-via-stage-wise-weight","title":"Exploring Learngene via Stage-wise Weight Sharing for Initializing Variable-sized Models","arxiv_id":"2404.16897","date":"2024-04-25","proceeding":null,"authors":["Shi-Yu Xia","Wenxuan Zhu","Xu Yang","Xin Geng"],"abstract":"In practice, we usually need to build variable-sized models adapting for diverse resource constraints in different application scenarios, where weight initialization is an important step prior to training. The Learngene framework, introduced recently, firstly learns one compact part termed as learngene from a large well-trained model, after which learngene is expanded to initialize variable-sized models. In this paper, we start from analysing the importance of guidance for the expansion of well-trained learngene layers, inspiring the design of a simple but highly effective Learngene approach termed SWS (Stage-wise Weight Sharing), where both learngene layers and their learning process critically contribute to providing knowledge and guidance for initializing models at varying scales. Specifically, to learn learngene layers, we build an auxiliary model comprising multiple stages where the layer weights in each stage are shared, after which we train it through distillation. Subsequently, we expand these learngene layers containing stage information at their corresponding stage to initialize models of variable depths. Extensive experiments on ImageNet-1K demonstrate that SWS achieves consistent better performance compared to many models trained from scratch, while reducing around 6.6x total training costs. In some cases, SWS performs better only after 1 epoch tuning. When initializing variable-sized models adapting for different resource constraints, SWS achieves better results while reducing around 20x parameters stored to initialize these models and around 10x pre-training costs, in contrast to the pre-training and fine-tuning approach.","url_abs":"https://arxiv.org/abs/2404.16897v1","url_pdf":"https://arxiv.org/pdf/2404.16897v1.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":[],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2404.16897","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2404.16897"}},"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/AlphaXia/SWS","reach":null}],"summary":{"ran":3,"unverified":4},"by_repo_kind":{"found_in_text":{"samples":7,"ran":3,"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":"64976ec8888722fc","entry":"RepeatedModuleList","repo":"AlphaXia/SWS","repo_kind":"found_in_text","path":"SWS_vit.py","file_url":"https://github.com/AlphaXia/SWS/blob/HEAD/SWS_vit.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":"64976ec8888722fc"}},{"code_sha256_prefix":"29a374042377c6d7","entry":"RepeatedModuleList_norm","repo":"AlphaXia/SWS","repo_kind":"found_in_text","path":"SWS_vit.py","file_url":"https://github.com/AlphaXia/SWS/blob/HEAD/SWS_vit.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":"29a374042377c6d7"}},{"code_sha256_prefix":"0d6ecc7d0008b522","entry":"SWS_Attention","repo":"AlphaXia/SWS","repo_kind":"found_in_text","path":"SWS_vit.py","file_url":"https://github.com/AlphaXia/SWS/blob/HEAD/SWS_vit.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":"0d6ecc7d0008b522"}},{"code_sha256_prefix":"5eabd45424bf9f22","entry":"RepeatedLEBlock","repo":"AlphaXia/SWS","repo_kind":"found_in_text","path":"SWS_vit.py","file_url":"https://github.com/AlphaXia/SWS/blob/HEAD/SWS_vit.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":"5eabd45424bf9f22"}},{"code_sha256_prefix":"18de19c2cb8d3fef","entry":"SWS_Block","repo":"AlphaXia/SWS","repo_kind":"found_in_text","path":"SWS_vit.py","file_url":"https://github.com/AlphaXia/SWS/blob/HEAD/SWS_vit.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":"18de19c2cb8d3fef"}},{"code_sha256_prefix":"4c8baad6b19e7abd","entry":"SWS_Mlp","repo":"AlphaXia/SWS","repo_kind":"found_in_text","path":"SWS_vit.py","file_url":"https://github.com/AlphaXia/SWS/blob/HEAD/SWS_vit.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":"4c8baad6b19e7abd"}},{"code_sha256_prefix":"be0e5172207a25d4","entry":"VisionTransformer","repo":"AlphaXia/SWS","repo_kind":"found_in_text","path":"SWS_vit.py","file_url":"https://github.com/AlphaXia/SWS/blob/HEAD/SWS_vit.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":"be0e5172207a25d4"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}