{"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/unified-visual-transformer-compression-1","title":"Unified Visual Transformer Compression","arxiv_id":"2203.08243","date":"2022-03-15","proceeding":"ICLR 2022 4","authors":["Shixing Yu","Tianlong Chen","Jiayi Shen","Huan Yuan","Jianchao Tan","Sen yang","Ji Liu","Zhangyang Wang"],"abstract":"Vision transformers (ViTs) have gained popularity recently. Even without customized image operators such as convolutions, ViTs can yield competitive performance when properly trained on massive data. However, the computational overhead of ViTs remains prohibitive, due to stacking multi-head self-attention modules and else. Compared to the vast literature and prevailing success in compressing convolutional neural networks, the study of Vision Transformer compression has also just emerged, and existing works focused on one or two aspects of compression. This paper proposes a unified ViT compression framework that seamlessly assembles three effective techniques: pruning, layer skipping, and knowledge distillation. We formulate a budget-constrained, end-to-end optimization framework, targeting jointly learning model weights, layer-wise pruning ratios/masks, and skip configurations, under a distillation loss. The optimization problem is then solved using the primal-dual algorithm. Experiments are conducted with several ViT variants, e.g. DeiT and T2T-ViT backbones on the ImageNet dataset, and our approach consistently outperforms recent competitors. For example, DeiT-Tiny can be trimmed down to 50\\% of the original FLOPs almost without losing accuracy. Codes are available online:~\\url{https://github.com/VITA-Group/UVC}.","url_abs":"https://arxiv.org/abs/2203.08243v1","url_pdf":"https://arxiv.org/pdf/2203.08243v1.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":"unified-visual-transformer-compression-1","repo_url":"https://github.com/VITA-Group/UVC","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"knowledge-distillation","task_name":"Knowledge Distillation"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"convolution","method_name":"Convolution"},{"method_slug":"deit","method_name":"DeiT"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"feedforward-network","method_name":"Feedforward Network"},{"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":"pruning","method_name":"Pruning"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"t2t-vit","method_name":"T2T-ViT"},{"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=2203.08243","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2203.08243"}},"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/VITA-Group/UVC","reach":null}],"summary":{"ran":5,"ran_draft_wrong":3,"ran_violates":1,"unverified":7},"by_repo_kind":{"official":{"samples":13,"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":3,"samples":[{"code_sha256_prefix":"bfc8fe0ddf96d4c7","entry":"Attention","repo":"VITA-Group/UVC","repo_kind":"official","path":"UVC/models/modeling.py","file_url":"https://github.com/VITA-Group/UVC/blob/HEAD/UVC/models/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bfc8fe0ddf96d4c7"}},{"code_sha256_prefix":"3215e1b62b114566","entry":"Mlp","repo":"VITA-Group/UVC","repo_kind":"official","path":"UVC/models/modeling.py","file_url":"https://github.com/VITA-Group/UVC/blob/HEAD/UVC/models/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3215e1b62b114566"}},{"code_sha256_prefix":"df180144004badc3","entry":"PreActBottleneck","repo":"VITA-Group/UVC","repo_kind":"official","path":"UVC/models/modeling.py","file_url":"https://github.com/VITA-Group/UVC/blob/HEAD/UVC/models/modeling.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":"df180144004badc3"}},{"code_sha256_prefix":"e91e85b73a67665a","entry":"ResNetV2","repo":"VITA-Group/UVC","repo_kind":"official","path":"UVC/models/modeling.py","file_url":"https://github.com/VITA-Group/UVC/blob/HEAD/UVC/models/modeling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e91e85b73a67665a"}},{"code_sha256_prefix":"eadbbe03b5b32f01","entry":"StdConv2d","repo":"VITA-Group/UVC","repo_kind":"official","path":"UVC/models/modeling.py","file_url":"https://github.com/VITA-Group/UVC/blob/HEAD/UVC/models/modeling.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":"eadbbe03b5b32f01"}},{"code_sha256_prefix":"b0f916df39e78ae5","entry":"conv1x1","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"b0f916df39e78ae5"}},{"code_sha256_prefix":"4e5bf13dbdc4f008","entry":"conv3x3","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"4e5bf13dbdc4f008"}},{"code_sha256_prefix":"aa9253d77220768c","entry":"get_tau","repo":"vita-group/uvc","repo_kind":"official","path":"UVC/joint_train.py","file_url":"https://github.com/vita-group/uvc/blob/HEAD/UVC/joint_train.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"aa9253d77220768c"}},{"code_sha256_prefix":"80da1ef156cc3a88","entry":"get_uvc_layers","repo":"vita-group/uvc","repo_kind":"official","path":"UVC/post_train.py","file_url":"https://github.com/vita-group/uvc/blob/HEAD/UVC/post_train.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"80da1ef156cc3a88"}},{"code_sha256_prefix":"195dcd4e31d9f812","entry":"Block","repo":"VITA-Group/UVC","repo_kind":"official","path":"UVC/models/modeling.py","file_url":"https://github.com/VITA-Group/UVC/blob/HEAD/UVC/models/modeling.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":"195dcd4e31d9f812"}},{"code_sha256_prefix":"8020519bcd7e5931","entry":"Embeddings","repo":"VITA-Group/UVC","repo_kind":"official","path":"UVC/models/modeling.py","file_url":"https://github.com/VITA-Group/UVC/blob/HEAD/UVC/models/modeling.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":"8020519bcd7e5931"}},{"code_sha256_prefix":"f5a8c54634cf9950","entry":"Encoder","repo":"VITA-Group/UVC","repo_kind":"official","path":"UVC/models/modeling.py","file_url":"https://github.com/VITA-Group/UVC/blob/HEAD/UVC/models/modeling.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":"f5a8c54634cf9950"}},{"code_sha256_prefix":"a4485af62ba072e0","entry":"Transformer","repo":"VITA-Group/UVC","repo_kind":"official","path":"UVC/models/modeling.py","file_url":"https://github.com/VITA-Group/UVC/blob/HEAD/UVC/models/modeling.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":"a4485af62ba072e0"}},{"code_sha256_prefix":"4900a340f86d38d4","entry":"VisionTransformer","repo":"VITA-Group/UVC","repo_kind":"official","path":"UVC/models/modeling.py","file_url":"https://github.com/VITA-Group/UVC/blob/HEAD/UVC/models/modeling.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":"4900a340f86d38d4"}},{"code_sha256_prefix":"3e8918f575824271","entry":"complex_accuracy","repo":"vita-group/uvc","repo_kind":"official","path":"UVC/joint_train.py","file_url":"https://github.com/vita-group/uvc/blob/HEAD/UVC/joint_train.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":"3e8918f575824271"}},{"code_sha256_prefix":"3c241ecfe3749a6d","entry":"simple_accuracy","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"3c241ecfe3749a6d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}