{"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-tuning-adapting-vision-transformers","title":"Sparse-Tuning: Adapting Vision Transformers with Efficient Fine-tuning and Inference","arxiv_id":"2405.14700","date":"2024-05-23","proceeding":null,"authors":["Ting Liu","Xuyang Liu","Siteng Huang","Liangtao Shi","Zunnan Xu","Yi Xin","Quanjun Yin","Xiaohong Liu"],"abstract":"Parameter-efficient fine-tuning (PEFT) has emerged as a popular solution for adapting pre-trained Vision Transformer (ViT) models to downstream applications. While current PEFT methods have achieved parameter efficiency, they overlook the efficiency of computation and GPU memory during both fine-tuning and inference, falling short of practical requirements. In this paper, we propose \\textbf{Sparse-Tuning}, a novel PEFT method that accounts for the information redundancy in images and videos to boost the above efficiency. By sparsely preserving the semantic-relevant tokens and merging irrelevant ones, Sparse-Tuning minimizes the quantity of tokens processed at each layer, leading to a quadratic reduction in computational and memory overhead. To align our token sparsification strategy suitably with fine-tuning purposes, we further design Dense Adapters that establish dense connections from shallow layers to deeper layers. These Dense Adapters integrate multi-level local features to enrich the current tokens, improving both token preservation and model adaptation. Empirical results on VTAB-1K, three image datasets, and two video datasets show that our Sparse-Tuning reduces GFLOPs to \\textbf{62\\%-70\\%} of the original ViT-B while achieving state-of-the-art performance. Source code is available at \\url{https://github.com/liuting20/Sparse-Tuning}.","url_abs":"https://arxiv.org/abs/2405.14700v2","url_pdf":"https://arxiv.org/pdf/2405.14700v2.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-tuning-adapting-vision-transformers","repo_url":"https://github.com/liuting20/sparse-tuning","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":null,"task_name":"GPU"},{"task_slug":"parameter-efficient-fine-tuning","task_name":"parameter-efficient fine-tuning"}],"methods":[{"method_slug":"align","method_name":"ALIGN"},{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"adapter","method_name":"Adapter"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"focus","method_name":"Focus"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"},{"method_slug":"vision-transformer","method_name":"Vision Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2405.14700","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2405.14700"}},"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/liuting20/sparse-tuning","reach":{"status":"ok"}}],"summary":{"ran":4,"ran_fixture":2,"ran_honours":1,"unverified":4},"by_repo_kind":{"official":{"samples":11,"ran":7,"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":11,"samples":[{"code_sha256_prefix":"66733f50aff69220","entry":"adjust_keep_rate","repo":"liuting20/sparse-tuning","repo_kind":"official","path":"models/helpers.py","file_url":"https://github.com/liuting20/sparse-tuning/blob/HEAD/models/helpers.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":"66733f50aff69220"}},{"code_sha256_prefix":"845bd96515f4674f","entry":"auto_load_model","repo":"liuting20/sparse-tuning","repo_kind":"official","path":"utils.py","file_url":"https://github.com/liuting20/sparse-tuning/blob/HEAD/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":"845bd96515f4674f"}},{"code_sha256_prefix":"39eace7e2822504f","entry":"drop_path","repo":"liuting20/sparse-tuning","repo_kind":"official","path":"models/vit_image.py","file_url":"https://github.com/liuting20/sparse-tuning/blob/HEAD/models/vit_image.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"39eace7e2822504f"}},{"code_sha256_prefix":"9b2250a3d13ed688","entry":"get_sinusoid_encoding_table","repo":"liuting20/sparse-tuning","repo_kind":"official","path":"models/vit_video.py","file_url":"https://github.com/liuting20/sparse-tuning/blob/HEAD/models/vit_video.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9b2250a3d13ed688"}},{"code_sha256_prefix":"191b2735955d18f4","entry":"resize_pos_embed","repo":"liuting20/sparse-tuning","repo_kind":"official","path":"models/vit_image.py","file_url":"https://github.com/liuting20/sparse-tuning/blob/HEAD/models/vit_image.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"191b2735955d18f4"}},{"code_sha256_prefix":"a78c001f6f0d381c","entry":"rfft_flop_jit","repo":"liuting20/sparse-tuning","repo_kind":"official","path":"calc_flops.py","file_url":"https://github.com/liuting20/sparse-tuning/blob/HEAD/calc_flops.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":"a78c001f6f0d381c"}},{"code_sha256_prefix":"e294b62d47bcc26f","entry":"speed_test","repo":"liuting20/sparse-tuning","repo_kind":"official","path":"models/helpers.py","file_url":"https://github.com/liuting20/sparse-tuning/blob/HEAD/models/helpers.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":"e294b62d47bcc26f"}},{"code_sha256_prefix":"6d8a1f8a0697180f","entry":"checkpoint_filter_fn","repo":"liuting20/sparse-tuning","repo_kind":"official","path":"models/vit_image.py","file_url":"https://github.com/liuting20/sparse-tuning/blob/HEAD/models/vit_image.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6d8a1f8a0697180f"}},{"code_sha256_prefix":"b700fb0a3496b255","entry":"cosine_scheduler","repo":"liuting20/sparse-tuning","repo_kind":"official","path":"utils.py","file_url":"https://github.com/liuting20/sparse-tuning/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b700fb0a3496b255"}},{"code_sha256_prefix":"ba1356e8ceb654d2","entry":"get_grad_norm_","repo":"liuting20/sparse-tuning","repo_kind":"official","path":"utils.py","file_url":"https://github.com/liuting20/sparse-tuning/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ba1356e8ceb654d2"}},{"code_sha256_prefix":"14b3b13b2e7ee844","entry":"tensor_normalize","repo":"liuting20/sparse-tuning","repo_kind":"official","path":"datasets/kinetics.py","file_url":"https://github.com/liuting20/sparse-tuning/blob/HEAD/datasets/kinetics.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"14b3b13b2e7ee844"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}