AdaPerceiver: Transformers with Adaptive Width, Depth, and Tokens

Purvish Jajal, Nick John Eliopoulos, Benjamin Shiue-Hal Chou, George K. Thiruvathukal, Yung-Hsiang Lu, James C. Davis

TL;DR

AdaPerceiver is the first transformer architecture to offer unified, runtime-configurable adaptivity across three distinct computational axes: width, depth, and tokens, all within a single model. By leveraging a clever "once-for-all" training strategy, it expands the accuracy-throughput Pareto frontier, matching the performance of massive models like ViT-H while utilizing up to 26× fewer encoder FLOPs on dense prediction tasks.

What Problem Does This Paper Address?

While modern Vision Transformers (ViTs) achieve state-of-the-art performance, they are notoriously rigid. Once trained, their computational cost is fixed: every input image gets processed with the exact same number of layers, tokens, and channels. In real-world deployments, however, hardware capabilities and latency constraints vary drastically—from edge devices to cloud servers.

Prior attempts at creating "elastic" or adaptive models typically only adapt along one or two dimensions (e.g., adjusting only the token count or only the network width). Jointly optimizing across width, depth, and tokens introduces a massive combinatorial explosion during training. This paper tackles that challenge, introducing a unified framework that can dynamically scale all three axes at inference time without requiring separate models or expensive retraining.

Methods

AdaPerceiver builds upon the PerceiverIO architecture, which uses an encode-process-decode paradigm. The core advantage of Perceiver architectures is that they decouple the number of input and output tokens from the internal "latent stream" tokens.

To achieve multi-axis adaptivity within this latent stream, the authors introduce three key architectural components:

  1. Token Adaptivity via Block Mask Attention: Instead of standard bidirectional attention, AdaPerceiver uses a structured attention mask where later token groups can attend to earlier ones, but not vice versa. This allows the model to simulate multiple token granularities simultaneously within a single forward pass.
  2. Width Adaptivity via Matryoshka FFNs: The feed-forward networks use nested hidden dimensions, allowing the embedding size to be sliced at runtime (e.g., choosing between 416, 624, or 832 dimensions).
  3. Depth Adaptivity via Early Exiting: Intermediate layers are supervised during training, enabling the model to halt processing early for simpler inputs.
Figure 1. Overview of Adaptive Perceiver (AdaPerceiver). (a) AdaPerceiver architecture. The AdaPerceiver architecture consists of three streams: input, output and latent. Cross-attention blocks map input tokens to latent tokens and read out latent tokens to output tokens. The latent stream allows for an adaptive embedding and adaptive token dimensions. (b) The AdaPerceiver block follows a standard pre-norm transformer architecture [15], but replaces bi-directional self-attention with block mask attention (c). Its feed-forward network (FFN) is similar to MatFormer [13], enabling adaptive embedding dimensions. (c) Block mask attention, is akin to self-attention in ViTs [15] but instead applies Rotary Positional Encoding (RoPE) on the Q and K matrices [36] and masks attention maps as shown in (d). This design enables adaptive token dimensions. (d) Visualization of block masking for N tokens: Red denotes masked tokens, while other colours indicate unmasked tokens. Masking restricts attention interactions at each latent token granularity, ensuring that later tokens can attend to earlier ones, but not vice versa. We elaborate in Sec. 3. N.B. The log2-spaced token granularity is arbitrary.

Crucially, the authors design a once-for-all training recipe. By structuring the network with block masking and sub-network sampling, multiple configurations are optimized in a single forward pass, bypassing the combinatorial training complexity that plagued prior multi-axis methods.

Datasets

The model was pre-trained and distilled using ImageNet-12K. Evaluation and fine-tuning were performed across three major benchmarks:

  • ImageNet-1K for image classification.
  • ADE20K for semantic segmentation.
  • NYUv2 for indoor depth estimation.

Key Insights and Ideas

  • Decoupling Input and Output Tokens: A major "aha" moment for dense prediction tasks is that AdaPerceiver can process a very small number of internal latent tokens (for speed) while still decoding back to a high-resolution output token set (for spatial accuracy). This breaks the rigid coupling found in models like FlexiViT.
  • Extrapolation via 1D RoPE: By using 1D Rotary Positional Embeddings (RoPE) on a single broadcasted latent vector, the latent space remains abstract and modality-agnostic. Remarkably, this allows the model to extrapolate to token counts higher than it ever saw during training (e.g., up to 512 or 1024 tokens) while maintaining highly stable and consistent feature representations.

Key Results

  • ImageNet-1K Classification: AdaPerceiver pushes the Pareto frontier forward. In its high-accuracy configuration, it achieves 85.4% accuracy with 36% higher throughput than FlexiViT-L.
  • Dense Prediction Efficiency: On ADE20K semantic segmentation, AdaPerceiver scores 43.9 mIoU—just 0.3 points behind the massive ViT-H/14—while using 26× fewer encoder FLOPs (158 vs. 4313 GFLOPs). A similar 96% FLOP reduction is achieved on NYUv2 depth estimation.
  • Dynamic Policies: When paired with a reinforcement learning or early-exit policy to choose configurations on a per-input basis, AdaPerceiver cuts FLOPs by 24% to 33% while maintaining baseline ImageNet accuracy within $\pm0.1$ percentage points.

Limitations and Future Work

Despite its strong results, the authors note a few limitations:

  • Distillation Dependency: The training pipeline relies heavily on logit and feature distillation from a strong pre-trained teacher (ViT-H). Performance when training entirely from scratch remains unexplored.
  • Memory Overhead: While computationally efficient during a single forward pass, the joint training regime carries high peak memory costs.
  • Simple Decoders: For dense prediction tasks, the model was evaluated using a basic linear probe. Testing AdaPerceiver with state-of-the-art decoders is an open avenue to uncover its true upper-bound performance.

Summary updated

BibTeX
@inproceedings{jajal2026adaperceiver,
  author = {Purvish Jajal and Nick John Eliopoulos and Benjamin Shiue-Hal Chou and George K. Thiruvathukal and Yung-Hsiang Lu and James C. Davis},
  title = {{AdaPerceiver: Transformers with Adaptive Width, Depth, and Tokens}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2026},
  url = {https://openreview.net/forum?id=5u7BYEz77F},
}
Figure