Dynamic Tuning Towards Parameter and Inference Efficiency for ViT Adaptation

Wangbo Zhao, Jiasheng Tang, Yizeng Han, Yibing Song, Kai Wang, Gao Huang, Fan Wang, Yang You

Fine-tuning massive pre-trained models is the bread and butter of modern AI. To keep costs down, researchers have flocked to Parameter-Efficient Fine-Tuning (PEFT) methods like LoRA or Adapters. These methods are great at reducing the number of parameters you need to update, but they have a hidden secret: they don't actually make the model faster during inference. In fact, by adding extra adapter layers, they often make it slightly slower.

A new paper introduces Dynamic Tuning (DyT), a framework that finally tackles both parameter and inference efficiency for Vision Transformers (ViTs).

TL;DR

Dynamic Tuning (DyT) is a novel adaptation strategy that reduces both the number of trainable parameters and the computational cost (FLOPs) during inference. By using a "token dispatcher" to identify and allow less important image patches to skip heavy transformer blocks, DyT achieves superior accuracy on benchmarks like VTAB-1K while using only 71% of the computation required by standard PEFT methods.

The Problem: Inference Inefficiency in PEFT

Vision Transformers (ViTs) are computationally expensive because they process every image patch (token) through every layer of the network. While PEFT methods like LoRA or VPT reduce the "tuning" burden (how many weights you change), the "inference" burden remains the same. Whether a token represents a clear subject or a blurry background, it still undergoes the same heavy matrix multiplications in every block.

Existing "dynamic" networks often use token pruning (deleting tokens), but this is destructive and makes the model incompatible with "dense" tasks like semantic segmentation, where you need every token to reconstruct the full image. The authors set out to find a way to save computation without losing tokens or sacrificing accuracy.

The Solution: Dynamic Tuning (DyT)

Overview of the Dynamic Tuning (DyT) framework during fine-tuning and inference.

The core of DyT is a "divide and conquer" strategy for image tokens:

  1. Token Dispatcher (TD): For each transformer block, a tiny linear layer learns to predict an activation probability for each token.
  2. The Skip Mechanism:
    • Informative Tokens: Patches identified as important pass through the original heavy Transformer block (Attention + MLP) and a lightweight parallel adapter.
  3. Redundant Tokens: Patches identified as less important skip the heavy Transformer block entirely and are processed only by the lightweight adapter.
  4. Differentiable Training: To train the discrete "skip or no-skip" decision, the authors use the Gumbel-Sigmoid trick, allowing the model to learn which tokens to skip via standard backpropagation.
  5. MoE-Adapter: For complex tasks like video recognition, the authors replace the standard adapter with a Mixture-of-Experts (MoE) version. This increases the model's capacity to learn task-specific features without adding significant computational overhead.

The authors explored several variants and found that skipping the MLP block specifically ("MLP Dispatch") provided the best balance of speed and accuracy.

Key Insights

  • Token Redundancy is Layer-Dependent: Visualizations revealed that the model tends to activate more tokens in the early layers to gather general knowledge and deactivates them in higher layers as it focuses on task-specific features. In some datasets, the activation rate in the final layer was 0%, meaning the entire final MLP block could be skipped without losing accuracy.
  • Skipping > Pruning: Unlike pruning methods that delete background tokens, DyT keeps all tokens alive in the adapter path. This preserves the spatial structure needed for tasks like segmentation.
  • The "Teacher" Effect: During training, the authors found that using the "complete" model (where no tokens skip) as a teacher to distill knowledge into the "dynamic" model significantly boosted performance.

Key Results

Comparison of FLOPs and Accuracy on VTAB-1K.

The researchers validated DyT across a massive range of visual tasks, including image classification (VTAB-1K, CIFAR-100), video recognition (Kinetics-400), and dense prediction (ADE20K).

  • Efficiency: On the VTAB-1K benchmark, DyT achieved an average accuracy of 77.14%, outperforming LoRA (74.60%) and VPT (71.96%) while using 29% fewer FLOPs.
  • Video Performance: On the SSv2 video dataset, DyT reduced computation by 37 GFLOPs compared to standard fine-tuning while maintaining competitive accuracy.
  • Segmentation: On ADE20K, DyT outperformed full fine-tuning while reducing computation by 21 GFLOPs.
  • Throughput: On a Tesla V100 GPU, DyT reached a throughput of 912 img/s, compared to ~806 img/s for standard full tuning or LoRA.

Future Directions

The authors acknowledge that DyT is currently optimized for vision tasks. While the concept of token skipping is theoretically applicable to Large Language Models (LLMs), the redundancy patterns in text are different from images. Future work involves extending DyT to multi-modal models (like CLIP or Flamingo) and exploring how dynamic tuning can be integrated with even larger-scale foundation models where inference costs are the primary bottleneck for deployment.

Summary updated

BibTeX
@inproceedings{zhao2024dynamic,
  author = {Wangbo Zhao and Jiasheng Tang and Yizeng Han and Yibing Song and Kai Wang and Gao Huang and Fan Wang and Yang You},
  title = {{Dynamic Tuning Towards Parameter and Inference Efficiency for ViT Adaptation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=e0SQ6wsHjv},
}
Figure