[Paper Review] Chasing Sparsity in Vision Transformers: An End-to-End Exploration
This paper introduces end-to-end sparse training for Vision Transformers (ViTs) to reduce training memory and inference costs while preserving accuracy, via dynamic sparse subnetworks, structured sparsity, and data-architecture co-sparsity.
Vision transformers (ViTs) have recently received explosive popularity, but their enormous model sizes and training costs remain daunting. Conventional post-training pruning often incurs higher training budgets. In contrast, this paper aims to trim down both the training memory overhead and the inference complexity, without sacrificing the achievable accuracy. We carry out the first-of-its-kind comprehensive exploration, on taking a unified approach of integrating sparsity in ViTs "from end to end". Specifically, instead of training full ViTs, we dynamically extract and train sparse subnetworks, while sticking to a fixed small parameter budget. Our approach jointly optimizes model parameters and explores connectivity throughout training, ending up with one sparse network as the final output. The approach is seamlessly extended from unstructured to structured sparsity, the latter by considering to guide the prune-and-grow of self-attention heads inside ViTs. We further co-explore data and architecture sparsity for additional efficiency gains by plugging in a novel learnable token selector to adaptively determine the currently most vital patches. Extensive results on ImageNet with diverse ViT backbones validate the effectiveness of our proposals which obtain significantly reduced computational cost and almost unimpaired generalization. Perhaps most surprisingly, we find that the proposed sparse (co-)training can sometimes improve the ViT accuracy rather than compromising it, making sparsity a tantalizing "free lunch". For example, our sparsified DeiT-Small at (5%, 50%) sparsity for (data, architecture), improves 0.28% top-1 accuracy, and meanwhile enjoys 49.32% FLOPs and 4.40% running time savings. Our codes are available at https://github.com/VITA-Group/SViTE.
Motivation & Objective
- Motivate and enable end-to-end sparsity in ViTs to reduce training memory and inference cost.
- Develop sparse ViT training methods that maintain or improve accuracy under fixed parameter budgets.
- Extend sparsity from unstructured to structured forms for hardware efficiency.
- Co-explore data sparsity with architecture sparsity to gain additional efficiency.
- Demonstrate effectiveness on ImageNet across DeiT backbones with substantial FLOPs and latency savings.
Proposed method
- Introduce Sparse Vision Transformer Exploration (SViTE) to train sparse ViTs with a fixed parameter budget.
- Extend SViTE to Structured Sparse ViT Exploration (S2ViTE) by guiding prune-and-grow of self-attention heads for hardware-friendly sparsity.
- Add Sparse Vision Transformer Co-Exploration (SViTE+) by jointly selecting informative input tokens and sparsifying the model.
- Use a Taylor-expansion based proxy to score head importance and L1 norms to score MLP neurons for pruning.
- Incorporate a learnable token selector with Gumbel-Softmax and straight-through tricks to select top-k informative patches, enabling data sparsity.
Experimental results
Research questions
- RQ1Can end-to-end sparse training produce ViTs with substantial FLOPs and parameter reductions without sacrificing accuracy?
- RQ2Does structured sparsity (e.g., pruning attention heads) offer hardware-friendly gains compared to unstructured sparsity?
- RQ3Can co-exploration of data sparsity (token selection) and architecture sparsity yield additional efficiency gains without harming performance?
- RQ4Do sparse ViT models generalize better due to implicit regularization and potentially improve accuracy under certain sparsity regimes?
- RQ5How do sparsity strategies perform across DeiT-Tiny/Small/Base backbones on ImageNet?
Key findings
- SViTE yields sparse DeiTs with notable FLOPs reductions (e.g., 25.56%–57.50% depending on backbone and sparsity) with negligible accuracy loss (often within 0.5%).
- SViTE+, with token selection, achieves up to 4.40% accuracy improvement at 50% data sparsity and 5% model sparsity on DeiT-Small, with 49.32% FLOPs savings and 4.40% running time reduction.
- S2ViTE with structured sparsity matches or surpasses unstructured variants, and can outperform dense baselines while delivering substantial running-time reductions (e.g., up to 24.70% reductions reported).
- Data sparsity acts as a regularizer; SViTE+-Small can reduce tokens by up to 10% with corresponding running-time and FLOPs savings and sometimes improved accuracy.
- Structured sparsity (S2ViTE) can outperform SSP in several settings, and S2ViTE-Base at 40% structured sparsity surpasses the dense DeiT-Base by up to 1.24% in accuracy while reducing FLOPs by ~34%.
- Across DeiT-Tiny/Small/Base on ImageNet-1K, the proposed methods provide consistent efficiency gains with competitive or improved accuracy, and even smaller sparse networks can outperform larger dense counterparts.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.