Slicing Vision Transformer for Flexible Inference

Yitian Zhang, Huseyin Coskun, Xu Ma, Huan Wang, Ke Ma +4 more
12/6/2024
cs.CVcs.LG

No official code found. Best implementation: BeSpontaneous/Scala-pytorch (11 stars, MIT, last commit 2024-12-06).

Abstract

Vision Transformers (ViT) is known for its scalability. In this work, we target to scale down a ViT to fit in an environment with dynamic-changing resource constraints. We observe that smaller ViTs are intrinsically the sub-networks of a larger ViT with different widths. Thus, we propose a general framework, named Scala, to enable a single network to represent multiple smaller ViTs with flexible inference capability, which aligns with the inherent design of ViT to vary from widths. Concretely, Scala activates several subnets during training, introduces Isolated Activation to disentangle the smallest sub-network from other subnets, and leverages Scale Coordination to ensure each sub-network receives simplified, steady, and accurate learning objectives. Comprehensive empirical validations on different tasks demonstrate that with only one-shot training, Scala learns slimmable representation without modifying the original ViT structure and matches the performance of Separate Training. Compared with the prior art, Scala achieves an average improvement of 1.6% on ImageNet-1K with fewer parameters.

View on arXivView PDF

Code Implementations(1)

MIT

Scala(NeurIPS 2024)

110Shell, PythonDec 6, 20241 years agoMIT

Similar Papers

Cite this paper

@article{zhang2024slicing,
  title  = {Slicing Vision Transformer for Flexible Inference},
  author = {Yitian Zhang and Huseyin Coskun and Xu Ma and Huan Wang and Ke Ma and Xi and Chen and Derek Hao Hu and Yun Fu},
  year   = {2024},
  eprint = {2412.04786},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2412.04786},
  url    = {http://arxiv.org/abs/2412.04786v1},
  journal = {NEURIPS 2024 2024}
}

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/2412.04786.svg)](https://codeofpaper.com/paper/2412.04786)

Discussion