NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Searching Intrinsic Dimensions of Vision Transformers

Fanghui Xue, Biao Yang, Yingyong Qi, Jack XinarXiv 2022

Introduction

Vision Transformers (ViTs) have emerged as powerful alternatives to traditional Convolutional Neural Networks (CNNs), often achieving superior performance in complex computer vision tasks. However, their high computational cost, primarily driven by the self-attention mechanism, poses significant challenges for deployment on resource-constrained edge devices. While pruning is a standard technique for compressing CNNs, its application to Transformers is less straightforward, especially when moving beyond simple image classification to high-resolution tasks like object detection.

This paper introduces SiDT (Searching Intrinsic Dimensions of Transformers), a novel pruning method designed to identify the "intrinsic dimensions" necessary for ViTs to function effectively. By leveraging sparsity-driven optimization, SiDT can prune up to 40% of a model’s parameters with minimal performance loss, and in some instances, even improve accuracy.

Methodology

The SiDT framework operates through a structured four-stage process aimed at identifying and removing redundant linear embeddings within the Transformer architecture.

The SiDT framework: (a) illustrates the four-stage pipeline from architecture setup to fine-tuning; (b) details the mechanism of assigning learnable scores to each dimension of the linear embeddings.
  1. Search Stage: The authors introduce learnable "architecture parameters" represented by a diagonal matrix $A$. This matrix is applied to the Query ($Q$), Key ($K$), and Value ($V$) embeddings in the Multi-Head Self-Attention (MSA) modules, as well as the hidden layers of the Multi-Layer Perceptron (MLP) modules.
  2. Sparsity Training: The model is trained using a composite loss function that includes the standard task loss and an $\ell_1$ regularization term on the architecture parameters. This regularization encourages the model to drive the scores of redundant dimensions toward zero.
  3. Pruning: Dimensions associated with the lowest architecture scores are removed according to a target pruning ratio.
  4. Fine-tuning: To recover any potential accuracy loss, the pruned model undergoes a "warm start" re-training phase.

A key innovation of SiDT is the application of a uniform scoring matrix across all attention heads and windows. This design choice significantly reduces the search space for architecture parameters, leading to a more stable and efficient optimization process compared to methods that prune individual features.

Experiments and Results

The effectiveness of SiDT was evaluated on two major benchmarks: CIFAR-100 for image classification and COCO for object detection and instance segmentation (using a Swin-T backbone).

Image Classification (CIFAR-100)

On the CIFAR-100 dataset, SiDT demonstrated that large Transformers are often over-parameterized. The baseline Swin-T model achieved 81.78% accuracy. Remarkably, with 20% of dimensions pruned, the accuracy increased to 82.75%, suggesting that pruning can act as a regularizer to prevent overfitting. Even at a high pruning ratio of 80%, the model maintained a respectable 79.35% accuracy while reducing computational costs from 4.49G FLOPs to 0.92G FLOPs.

Object Detection (COCO)

For object detection on the COCO dataset, a 20% pruned Swin-T backbone matched the baseline performance (approximately 50.4 mAP for boxes and 43.7 mAP for masks). Increasing the pruning ratio to 40% resulted in a performance drop of less than 1.5%, demonstrating the robustness of the pruned backbone when integrated into complex detection heads like Cascade Mask R-CNN.

Discussion and Conclusion

The results support the hypothesis that neural networks possess an "intrinsic dimension"—a minimum width required to solve a given task. SiDT provides a systematic approach to finding this limit for Transformers. By pruning linear embeddings directly, the method reduces both parameter count and FLOPs in the attention mechanism, enhancing the versatility of Transformer backbones for various downstream tasks.

While SiDT shows promise, future work could expand its evaluation to other architectures like ViT or DeiT and include "wall-clock" latency measurements on specific edge hardware to better understand real-world performance gains. Nonetheless, SiDT represents a significant step toward making high-performance Vision Transformers more accessible for deployment on mobile and embedded systems.

Summary updated

BibTeX
@misc{xue2022searching,
  author = {Fanghui Xue and Biao Yang and Yingyong Qi and Jack Xin},
  title = {{Searching Intrinsic Dimensions of Vision Transformers}},
  year = {2022},
  eprint = {2204.07722},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2204.07722},
}
Figure