Lune

NeurIPS2024Top-tier venue

HydraViT: Stacking Heads for a Scalable ViT

Janek Haberer, Ali Hojjat, Olaf Landsiedel

Abstract

The architecture of Vision Transformers (ViTs), particularly the Multi-head Attention (MHA) mechanism, imposes substantial hardware demands. Deploying ViTs on devices with varying constraints, such as mobile phones, requires multiple models of different sizes. However, this approach has limitations, such as training and storing each required model separately. This paper introduces HydraViT, a novel approach that addresses these limitations by stacking attention heads to achieve a scalable ViT. By repeatedly changing the size of the embedded dimensions throughout each layer and their corresponding number of attention heads in MHA during training, HydraViT induces multiple subnetworks. Thereby, HydraViT achieves adaptability across a wide spectrum of hardware environments while maintaining performance. Our experimental results demonstrate the efficacy of HydraViT in achieving a scalable ViT with up to 10 subnetworks, covering a wide range of resource constraints. HydraViT achieves up to 5 p.p. more accuracy with the same GMACs and up to 7 p.p. more accuracy with the same throughput on ImageNet-1K compared to the baselines, making it an effective solution for scenarios where hardware availability is diverse or varies over time. The source code is available at https://github.com/ds-kiel/HydraViT.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • MLP-Mixer: An all-MLP Architecture for Vision cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale cites A Simple Framework for Contrastive Learning of Visual Representations
  • EA-Vit: Efficient Adaptation for Elastic Vision Transformer cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites MLP-Mixer: An all-MLP Architecture for Vision
  • Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • ThinkingViT: Matryoshka Thinking Vision Transformer for Elastic Inference cites A Simple Framework for Contrastive Learning of Visual Representations
  • ThinkingViT: Matryoshka Thinking Vision Transformer for Elastic Inference cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • ThinkingViT: Matryoshka Thinking Vision Transformer for Elastic Inference cites The Many Faces of Robustness: A Critical Analysis of Out-of-Distribution Generalization
  • ThinkingViT: Matryoshka Thinking Vision Transformer for Elastic Inference cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. ThinkingViT: Matryoshka Thinking Vision Transformer for Elastic InferenceAli Hojjat, Janek Haberer, Sören Pirk, Olaf LandsiedelCVPR 2026 · 6 citations
  2. EA-Vit: Efficient Adaptation for Elastic Vision TransformerChen Zhu, Wangbo Zhao, Huiwen Zhang, Yuhao Zhou et al.ICCV 2025 · 2 citations

Builds on20

  1. Swin Transformer: Hierarchical Vision Transformer using Shifted WindowsZe Liu, Yutong Lin, Yue Cao, Han Hu et al.ICCV 2021 · 31,683 citations
  2. A Simple Framework for Contrastive Learning of Visual RepresentationsTing Chen, Simon Kornblith, Mohammad Norouzi, Geoffrey E. HintonICML 2020 · 24,064 citations
  3. An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
  4. MLP-Mixer: An all-MLP Architecture for VisionIlya O. Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer et al.NeurIPS 2021 · 3,862 citations
  5. The Many Faces of Robustness: A Critical Analysis of Out-of-Distribution GeneralizationDan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath et al.ICCV 2021 · 2,294 citations

Related papers

  1. Slicing Vision Transformer for Flexible InferenceYitian Zhang, Huseyin Coskun, Xu Ma, Huan Wang et al.NeurIPS 2024 · 4 citations
  2. Linearly Decomposing and Recomposing Vision Transformers for Diverse-Scale ModelsShuxia Lin, Miaosen Zhang, Ruiming Chen, Xu Yang et al.NeurIPS 2024 · 7 citations
  3. Scalable Vision Transformers with Hierarchical PoolingZizheng Pan, Bohan Zhuang, Jing Liu, Haoyu He et al.ICCV 2021 · 154 citations
  4. FlexiViT: One Model for All Patch SizesLucas Beyer, Pavel Izmailov, Alexander Kolesnikov, Mathilde Caron et al.CVPR 2023
  5. Mobile Attention: Mobile-Friendly Linear-Attention for Vision TransformersZhiyu Yao, Jian Wang, Haixu Wu, Jingdong Wang et al.ICML 2024 · 6 citations
Dusk over the sea between two cliffs drawn in fine vertical lines