A General and Efficient Training for Transformer via Token Expansion

Wenxuan Huang, Yunhang Shen, Jiao Xie, Baochang Zhang, Gaoqi He +3 more
3/31/2024
cs.LGcs.AIcs.CL

Official code: Osilly/TokenExpansion (47 stars, MIT, last commit 2024-04-22).

Abstract

The remarkable performance of Vision Transformers (ViTs) typically requires an extremely large training cost. Existing methods have attempted to accelerate the training of ViTs, yet typically disregard method universality with accuracy dropping. Meanwhile, they break the training consistency of the original transformers, including the consistency of hyper-parameters, architecture, and strategy, which prevents them from being widely applied to different Transformer networks. In this paper, we propose a novel token growth scheme Token Expansion (termed ToE) to achieve consistent training acceleration for ViTs. We introduce an "initialization-expansion-merging" pipeline to maintain the integrity of the intermediate feature distribution of original transformers, preventing the loss of crucial learnable information in the training process. ToE can not only be seamlessly integrated into the training and fine-tuning process of transformers (e.g., DeiT and LV-ViT), but also effective for efficient training frameworks (e.g., EfficientTrain), without twisting the original training hyper-parameters, architecture, and introducing additional training strategies. Extensive experiments demonstrate that ToE achieves about 1.3x faster for the training of ViTs in a lossless manner, or even with performance gains over the full-token training baselines. Code is available at https://github.com/Osilly/TokenExpansion .

View on arXivView PDF

Code Implementations(1)

MIT

[CVPR 2024] The official pytorch implementation of "A General and Efficient Training for Transformer via Token Expansion".

473Shell, PythonNov 12, 20232 years agoMIT

Similar Papers

Cite this paper

@article{huang2024general,
  title  = {A General and Efficient Training for Transformer via Token Expansion},
  author = {Wenxuan Huang and Yunhang Shen and Jiao Xie and Baochang Zhang and Gaoqi He and Ke Li and Xing Sun and Shaohui Lin},
  year   = {2024},
  eprint = {2404.00672},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.00672v1},
  journal = {CVPR 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/2404.00672.svg)](https://codeofpaper.com/paper/2404.00672)

Discussion