Sparse-Tuning: Adapting Vision Transformers with Efficient Fine-tuning and Inference

Ting Liu, Xuyang Liu, Liangtao Shi, Zunnan Xu, Yue Hu, Siteng Huang, Yi Xin, Bineng Zhong, Donglin Wang

TL;DR

Sparse-Tuning is a novel parameter-efficient fine-tuning (PEFT) framework for Vision Transformers (ViTs) that simultaneously accelerates both training and inference. By pairing plug-and-play token sparsification with a novel cross-layer "Dense Adapter" design, it slashes computational complexity (GFLOPs) to 66% of a standard ViT-B while delivering state-of-the-art accuracy across multiple image and video benchmarks.

What Problem Does This Paper Address?

Adapting massive, pre-trained Vision Transformers (ViTs) to downstream tasks is computationally expensive. While Parameter-Efficient Fine-Tuning (PEFT) methods—such as LoRA, Adapters, and Visual Prompt Tuning (VPT)—successfully reduce the number of trainable parameters during training, they do nothing to speed up the model during inference. The entire sequence of image patches (tokens) must still pass through every layer of the network.

Token Sparsification (TS) techniques can accelerate inference by pruning or merging redundant tokens (like background patches). However, simply slapping TS onto existing PEFT methods causes severe performance degradation. Because token dropping permanently discards spatial information, deeper layers are left with only coarse, holistic features. This disrupts the model's original attention distribution and hurts accuracy. Sparse-Tuning bridges this gap, achieving high parameter efficiency during training alongside high computational efficiency during inference without sacrificing performance.

Methods

The Sparse-Tuning framework consists of two core components working in tandem:

  1. Token Sparsification (TS) Modules: Plug-and-play modules (such as EViT or ToMe) are inserted at specific layers to progressively remove or merge redundant tokens, directly reducing the computational workload.
  2. Dense Adapters (DA): To counteract the information loss caused by token dropping, the authors introduce a new adapter architecture. Unlike traditional intra-layer adapters that only process features within a single layer, Dense Adapters establish cross-layer connections. They aggregate multi-level features from shallower layers (which still retain full spatial details) and inject them into the remaining tokens of deeper layers.
Fig. 2: Overall framework. We freeze the pre-trained ViT-B/16 and update the proposed Dense Adapters (DAs) to efficiently fine-tune the pre-trained ViT. By selectively adapting tokens to focus on informative regions, Sparse-Tuning significantly reduces the computational cost of redundant tokens, thereby enhancing efficiency during both fine-tuning and inference stages. Token sparsification is the process of removing redundant tokens.

Specifically, the $N$-th Dense Adapter projects and fuses features from layers $N$, $N-1$, and $N-3$ within its low-dimensional bottleneck space before up-projecting them back to the transformer's dimension. This architecture ensures that fine-grained spatial details bypass the token-dropping bottlenecks.

Datasets

The authors evaluated Sparse-Tuning across a comprehensive suite of benchmarks:

  • VTAB-1K: A challenging low-data benchmark containing 19 diverse visual tasks with only 1,000 training samples each.
  • Full-scale Image Datasets: CIFAR-100, SVHN, and Food-101.
  • Video Action Recognition Datasets: Kinetics-400 (K400) and Something-Something V2 (SSv2).
  • Segmentation Datasets: Object and VOC20 (used to test open-vocabulary generalization capabilities).

Key Insights and Ideas

  • Information Preservation via Cross-Layer Routing: Instead of trying to prevent token dropping, Sparse-Tuning accepts the information loss but routes the missing fine-grained details around the bottleneck using shallow-to-deep dense connections.
  • Fusing in the Bottleneck Space: The authors experimented with different architectural variants for feature fusion. They discovered that projecting multi-level features into the same low-dimensional bottleneck space before fusing them yields the best results. Direct early fusion (adding features before the adapter) or late fusion (adding outputs of parallel adapters) obscures critical information because the features occupy different representational spaces.
  • The Middle-Layer Sweet Spot: Sparsifying tokens too early (e.g., in layers 2 or 3) degrades performance because early attention maps are unreliable. Sparsifying too late yields minimal computational savings. The optimal configuration starts token sparsification at the 4th encoder layer, repeating it at an interval of every 3 layers (layers 4, 7, and 10).

Key Results

Sparse-Tuning demonstrates clear advantages over full fine-tuning and alternative PEFT methods across training time, inference speed, memory footprint, and accuracy.

Fig. 1: Comparisons of Sparse-Tuning with other mainstream PEFT methods on CIFAR-100 dataset. Sparse-Tuning enhances performance while remarkably reducing training and inference time, GPU memory consumption, and computational complexity, achieving both fine-tuning and inference efficiency of the pre-trained ViT.
  • Computation and Speed: For a ViT-B backbone, Sparse-Tuning reduces computational complexity to 11.70 GFLOPs (roughly 66% of the original 17.58 GFLOPs) and cuts inference time nearly in half compared to standard adapters.
  • Memory Footprint: It reduces training memory to 8.89 GB (compared to ~13-14 GB for LoRA and AdaptFormer) and inference memory to 1.53 GB.
  • Downstream Accuracy: On CIFAR-100, Sparse-Tuning achieves 92.31% accuracy, outperforming full fine-tuning (90.91%) and the previous state-of-the-art dynamic tuning method, DyT (91.01%).
  • Scalability: When scaled up to a massive ViT-L backbone, Sparse-Tuning cuts GFLOPs by up to 50% while outperforming full fine-tuning and alternative adapters.

Limitations and Future Work

The primary limitation of the current framework is its use of a fixed token keeping rate ($r$) across all inputs. Regardless of whether an image is highly complex or features a simple, uniform background, the same percentage of tokens is discarded.

To address this, the authors propose several directions for future work:

  • Developing dynamic and adaptive token retention strategies that adjust the filtering ratio in real-time based on input complexity.
  • Optimizing the cross-frame and cross-view feature fusion mechanisms within Dense Adapters to better handle temporal continuity in complex video tasks like video generation and object tracking.
  • Adapting the framework for resource-constrained edge devices and exploring its utility in large multi-modal language models.

Summary updated

BibTeX
@misc{liu2024sparse,
  author = {Ting Liu and Xuyang Liu and Liangtao Shi and Zunnan Xu and Yue Hu and Siteng Huang and Yi Xin and Bineng Zhong and Donglin Wang},
  title = {{Sparse-Tuning: Adapting Vision Transformers with Efficient Fine-tuning and Inference}},
  year = {2024},
  eprint = {2405.14700},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.14700},
}
Figure