Unified Visual Transformer Compression

Shixing Yu, Tianlong Chen, Jiayi Shen, Huan Yuan, Jianchao Tan +3 more
3/15/2022
cs.LGcs.CV
transformer-attentiondistillation

Official code: VITA-Group/UVC (54 stars, Python, MIT, last commit 2023-12-01).

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.

Show full abstract

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}.

View on arXivView PDF

Code Implementations(1)

VITA-Group/UVCOfficial100%
MIT

[ICLR 2022] "Unified Vision Transformer Compression" by Shixing Yu*, Tianlong Chen*, Jiayi Shen, Huan Yuan, Jianchao Tan, Sen Yang, Ji Liu, Zhangyang Wang

544Python, Jupyter NotebookDec 11, 20213 years agoMIT
admmcompressionefficient-transformersvision-transformer

Similar Papers

Cite this paper

@article{yu2022unified,
  title  = {Unified Visual Transformer Compression},
  author = {Shixing Yu and Tianlong Chen and Jiayi Shen and Huan Yuan and Jianchao Tan and Sen Yang and Ji Liu and Zhangyang Wang},
  year   = {2022},
  eprint = {2203.08243},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2203.08243}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2203.08243.svg)](https://codeofpaper.com/paper/2203.08243)

Discussion