{"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/lpvit-low-power-semi-structured-pruning-for","title":"LPViT: Low-Power Semi-structured Pruning for Vision Transformers","arxiv_id":"2407.02068","date":"2024-07-02","proceeding":null,"authors":["Kaixin Xu","Zhe Wang","Chunyun Chen","Xue Geng","Jie Lin","Mohamed M. Sabry Aly","Xulei Yang","Min Wu","XiaoLi Li","Weisi Lin"],"abstract":"Vision transformers have emerged as a promising alternative to convolutional neural networks for various image analysis tasks, offering comparable or superior performance. However, one significant drawback of ViTs is their resource-intensive nature, leading to increased memory footprint, computation complexity, and power consumption. To democratize this high-performance technology and make it more environmentally friendly, it is essential to compress ViT models, reducing their resource requirements while maintaining high performance. In this paper, we introduce a new block-structured pruning to address the resource-intensive issue for ViTs, offering a balanced trade-off between accuracy and hardware acceleration. Unlike unstructured pruning or channel-wise structured pruning, block pruning leverages the block-wise structure of linear layers, resulting in more efficient matrix multiplications. To optimize this pruning scheme, our paper proposes a novel hardware-aware learning objective that simultaneously maximizes speedup and minimizes power consumption during inference, tailored to the block sparsity structure. This objective eliminates the need for empirical look-up tables and focuses solely on reducing parametrized layer connections. Moreover, our paper provides a lightweight algorithm to achieve post-training pruning for ViTs, utilizing second-order Taylor approximation and empirical optimization to solve the proposed hardware-aware objective. Extensive experiments on ImageNet are conducted across various ViT architectures, including DeiT-B and DeiT-S, demonstrating competitive performance with other pruning methods and achieving a remarkable balance between accuracy preservation and power savings. Especially, we achieve up to 3.93x and 1.79x speedups on dedicated hardware and GPUs respectively for DeiT-B, and also observe an inference power reduction by 1.4x on real-world GPUs.","url_abs":"https://arxiv.org/abs/2407.02068v4","url_pdf":"https://arxiv.org/pdf/2407.02068v4.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":"lpvit-low-power-semi-structured-pruning-for","repo_url":"https://github.com/Akimoto-Cris/LPViT","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[],"methods":[{"method_slug":"pruning","method_name":"Pruning"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2407.02068","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2407.02068"}},"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/Akimoto-Cris/LPViT","reach":{"status":"ok"}}],"summary":{"ran":10,"ran_draft_wrong":1,"ran_violates":1},"by_repo_kind":{"official":{"samples":12,"ran":12,"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":12,"samples":[{"code_sha256_prefix":"1f571409b5239217","entry":"blocksparse_attention_mask","repo":"Akimoto-Cris/LPViT","repo_kind":"official","path":"blocksparse_attention_module.py","file_url":"https://github.com/Akimoto-Cris/LPViT/blob/HEAD/blocksparse_attention_module.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1f571409b5239217"}},{"code_sha256_prefix":"de2af715a05df3be","entry":"check_sparsity","repo":"Akimoto-Cris/LPViT","repo_kind":"official","path":"pruning_utils.py","file_url":"https://github.com/Akimoto-Cris/LPViT/blob/HEAD/pruning_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"de2af715a05df3be"}},{"code_sha256_prefix":"181028f4d3a799d6","entry":"check_sparsity_dict","repo":"Akimoto-Cris/LPViT","repo_kind":"official","path":"pruning_utils.py","file_url":"https://github.com/Akimoto-Cris/LPViT/blob/HEAD/pruning_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"181028f4d3a799d6"}},{"code_sha256_prefix":"cccbdd267d4f7850","entry":"extract_mask","repo":"Akimoto-Cris/LPViT","repo_kind":"official","path":"pruning_utils.py","file_url":"https://github.com/Akimoto-Cris/LPViT/blob/HEAD/pruning_utils.py","link_basis":"plan_row","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":"cccbdd267d4f7850"}},{"code_sha256_prefix":"9f7f6915bde67e3d","entry":"get_sparsity","repo":"Akimoto-Cris/LPViT","repo_kind":"official","path":"engine.py","file_url":"https://github.com/Akimoto-Cris/LPViT/blob/HEAD/engine.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9f7f6915bde67e3d"}},{"code_sha256_prefix":"73d3cb525b1c3172","entry":"get_spraseattention_vit_module","repo":"Akimoto-Cris/LPViT","repo_kind":"official","path":"blocksparse_attention_module.py","file_url":"https://github.com/Akimoto-Cris/LPViT/blob/HEAD/blocksparse_attention_module.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"73d3cb525b1c3172"}},{"code_sha256_prefix":"aa9253d77220768c","entry":"get_tau","repo":"Akimoto-Cris/LPViT","repo_kind":"official","path":"engine.py","file_url":"https://github.com/Akimoto-Cris/LPViT/blob/HEAD/engine.py","link_basis":"plan_row","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"aa9253d77220768c"}},{"code_sha256_prefix":"7c73b690d9886b5d","entry":"gumbel_softmax","repo":"Akimoto-Cris/LPViT","repo_kind":"official","path":"sp_vision_transformer.py","file_url":"https://github.com/Akimoto-Cris/LPViT/blob/HEAD/sp_vision_transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7c73b690d9886b5d"}},{"code_sha256_prefix":"743923947c250e6c","entry":"resize_pos_embed","repo":"Akimoto-Cris/LPViT","repo_kind":"official","path":"sp_vision_transformer.py","file_url":"https://github.com/Akimoto-Cris/LPViT/blob/HEAD/sp_vision_transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"743923947c250e6c"}},{"code_sha256_prefix":"e11ddb5cae4f73b4","entry":"scatter","repo":"Akimoto-Cris/LPViT","repo_kind":"official","path":"sp_vision_transformer.py","file_url":"https://github.com/Akimoto-Cris/LPViT/blob/HEAD/sp_vision_transformer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e11ddb5cae4f73b4"}},{"code_sha256_prefix":"09f6b361c824b0d7","entry":"sparse_attention_mask","repo":"Akimoto-Cris/LPViT","repo_kind":"official","path":"blocksparse_attention_module.py","file_url":"https://github.com/Akimoto-Cris/LPViT/blob/HEAD/blocksparse_attention_module.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"09f6b361c824b0d7"}},{"code_sha256_prefix":"49e75bdeacd88ac2","entry":"test","repo":"Akimoto-Cris/LPViT","repo_kind":"official","path":"prune_vit.py","file_url":"https://github.com/Akimoto-Cris/LPViT/blob/HEAD/prune_vit.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"49e75bdeacd88ac2"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}