{"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/progressive-gradient-flow-for-robust-n-m","title":"Progressive Gradient Flow for Robust N:M Sparsity Training in Transformers","arxiv_id":"2402.04744","date":"2024-02-07","proceeding":null,"authors":["Abhimanyu Rajeshkumar Bambhaniya","Amir Yazdanbakhsh","Suvinay Subramanian","Sheng-Chun Kao","Shivani Agrawal","Utku Evci","Tushar Krishna"],"abstract":"N:M Structured sparsity has garnered significant interest as a result of relatively modest overhead and improved efficiency. Additionally, this form of sparsity holds considerable appeal for reducing the memory footprint owing to their modest representation overhead. There have been efforts to develop training recipes for N:M structured sparsity, they primarily focus on low-sparsity regions ($\\sim$50\\%). Nonetheless, performance of models trained using these approaches tends to decline when confronted with high-sparsity regions ($>$80\\%). In this work, we study the effectiveness of existing sparse training recipes at \\textit{high-sparsity regions} and argue that these methods fail to sustain the model quality on par with low-sparsity regions. We demonstrate that the significant factor contributing to this disparity is the presence of elevated levels of induced noise in the gradient magnitudes. To mitigate this undesirable effect, we employ decay mechanisms to progressively restrict the flow of gradients towards pruned elements. Our approach improves the model quality by up to 2$\\%$ and 5$\\%$ in vision and language models at high sparsity regime, respectively. We also evaluate the trade-off between model accuracy and training compute cost in terms of FLOPs. At iso-training FLOPs, our method yields better performance compared to conventional sparse training recipes, exhibiting an accuracy improvement of up to 2$\\%$. The source code is available at https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity.","url_abs":"https://arxiv.org/abs/2402.04744v1","url_pdf":"https://arxiv.org/pdf/2402.04744v1.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":"progressive-gradient-flow-for-robust-n-m","repo_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[],"methods":[{"method_slug":"focus","method_name":"Focus"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.04744","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.04744"}},"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/abhibambhaniya/progressive_gradient_flow_nm_sparsity","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_honours":3,"ran":12,"unverified":2},"by_repo_kind":{"official":{"samples":17,"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":"410bffb8a07b52e3","entry":"count_params","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"benchmark.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/benchmark.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":2,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"410bffb8a07b52e3"}},{"code_sha256_prefix":"33bca8cbc866bf64","entry":"checkpoint_metric","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"avg_checkpoints.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/avg_checkpoints.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"33bca8cbc866bf64"}},{"code_sha256_prefix":"e69e9b0108bef81c","entry":"cmd_from_args","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"bulk_runner.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/bulk_runner.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":"e69e9b0108bef81c"}},{"code_sha256_prefix":"50d653ee6a59955c","entry":"cuda_timestamp","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"benchmark.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/benchmark.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"50d653ee6a59955c"}},{"code_sha256_prefix":"91c27523dde7eb4a","entry":"hard_sigmoid_jit","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"timm/layers/activations_jit.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/timm/layers/activations_jit.py","link_basis":"harvester_set","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":"91c27523dde7eb4a"}},{"code_sha256_prefix":"5bed58ca17652913","entry":"map_mx_to_torch_model","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"convert/convert_from_mxnet.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/convert/convert_from_mxnet.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5bed58ca17652913"}},{"code_sha256_prefix":"801c85b8903bfff5","entry":"mish","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"timm/layers/activations.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/timm/layers/activations.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"801c85b8903bfff5"}},{"code_sha256_prefix":"14eddd8cc4c65fe0","entry":"mish_jit","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"timm/layers/activations_jit.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/timm/layers/activations_jit.py","link_basis":"harvester_set","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":"14eddd8cc4c65fe0"}},{"code_sha256_prefix":"d83b6ecf3cdc1d6a","entry":"sigmoid","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"timm/layers/activations.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/timm/layers/activations.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d83b6ecf3cdc1d6a"}},{"code_sha256_prefix":"717e4d22b6d103e6","entry":"swish","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"timm/layers/activations.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/timm/layers/activations.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"717e4d22b6d103e6"}},{"code_sha256_prefix":"8e341f8585b3fe94","entry":"swish_jit","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"timm/layers/activations_jit.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/timm/layers/activations_jit.py","link_basis":"harvester_set","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":"8e341f8585b3fe94"}},{"code_sha256_prefix":"ccf59d4aa2ccacdb","entry":"swish_jit_bwd","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"timm/layers/activations_me.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/timm/layers/activations_me.py","link_basis":"harvester_set","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":"ccf59d4aa2ccacdb"}},{"code_sha256_prefix":"2d53e47b891cd927","entry":"swish_jit_fwd","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"timm/layers/activations_me.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/timm/layers/activations_me.py","link_basis":"harvester_set","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":"2d53e47b891cd927"}},{"code_sha256_prefix":"51a2f9920a170144","entry":"swish_me","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"timm/layers/activations_me.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/timm/layers/activations_me.py","link_basis":"harvester_set","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":"51a2f9920a170144"}},{"code_sha256_prefix":"475160c5a1a1225a","entry":"timestamp","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"benchmark.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/benchmark.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"475160c5a1a1225a"}},{"code_sha256_prefix":"8024519a2a934824","entry":"clean_checkpoint","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"clean_checkpoint.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/clean_checkpoint.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":"8024519a2a934824"}},{"code_sha256_prefix":"dddaf76c153d839d","entry":"validate","repo":"abhibambhaniya/progressive_gradient_flow_nm_sparsity","repo_kind":"official","path":"validate.py","file_url":"https://github.com/abhibambhaniya/progressive_gradient_flow_nm_sparsity/blob/HEAD/validate.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":"dddaf76c153d839d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}