TL;DR
AdaPerceiver is the first transformer architecture to offer unified, runtime-configurable adaptivity across three major computational axes: depth, width, and tokens. By training a single shared-weight model with an efficient "once-for-all" recipe, it expands the accuracy-throughput Pareto frontier—matching massive models like ViT-H on dense prediction tasks while using up to 26× fewer encoder FLOPs.
What Problem Does This Paper Address?
Modern Vision Transformers (ViTs) achieve incredible performance, but they are computationally rigid. Once trained, every single input—whether it's a simple blank background or a highly complex scene—is processed using the exact same number of layers, tokens, and channels.
When deploying models to diverse hardware (from edge devices to cloud servers) or under fluctuating latency constraints, we need models that can dynamically scale their compute budget. While prior work has introduced "elastic" or adaptive models, they typically restrict adaptivity to just one or two dimensions (e.g., only adjusting token count or only scaling depth and width). Jointly optimizing all three axes is combinatorially challenging, usually requiring expensive multiple forward passes or noisy stochastic sampling during training.
Methods
AdaPerceiver solves this by building on top of the PerceiverIO architecture, which uses an encode-process-decode paradigm. The core trick is that PerceiverIO decouples the input and output token counts from the internal processing stream by mapping inputs into a fixed set of latent tokens.
The authors introduce adaptivity directly into this latent stream across three dimensions:
- Token Adaptivity (Varying Latent Tokens): To support a variable number of latent tokens without separate forward passes, the authors introduce Block Mask Attention. This structured masking technique constrains self-attention so that later token groups can attend to earlier ones, but not vice versa. Combined with 1D Rotary Positional Embeddings (RoPE), this allows the model to simulate multiple token granularities simultaneously in a single forward pass.
- Width Adaptivity (Varying Embedding Dimensions): The model utilizes Matryoshka Feed-Forward Networks (FFNs), where smaller hidden dimensions are nested within larger ones, allowing tensor slicing at inference time.
- Depth Adaptivity (Varying Layers): Early-exiting is implemented throughout the latent stream, allowing the model to output predictions from intermediate layers.
Once-for-All Training
Instead of a combinatorially explosive training regime, AdaPerceiver uses a structured "once-for-all" training recipe. Because of the block masking and early-exiting design, a single encoder forward pass yields features that support multiple token and depth configurations simultaneously. Width is trained implicitly by randomly sampling a hidden dimension configuration for each example. To stabilize training, the authors employ logit and feature distillation from a frozen, pre-trained ViT-H teacher.
Datasets
The model's performance was validated across several standard vision benchmarks:
- ImageNet-12K: Used for large-scale pre-training (150 epochs).
- ImageNet-1K: Used to evaluate image classification and configuration selection policies.
- ADE20K: Used to evaluate semantic segmentation performance.
- NYUv2: Used to evaluate monocular depth estimation.
Key Insights and Ideas
- The Power of Latent Decoupling: Traditional ViTs cannot easily scale token counts inline because the spatial structure is tied to the architecture. By forcing computation into an abstract, modality-agnostic latent space, AdaPerceiver can treat token count purely as a compute knob.
- Asymmetric Axis Impacts: The authors observed that different tasks care about different axes. For image classification, reducing tokens has a much lower impact on accuracy than reducing width or depth. However, for dense prediction tasks like depth estimation, maintaining embedding width is crucial for performance.
- Extrapolation via RoPE: Because the model uses relative 1D RoPE rather than fixed absolute positional embeddings, it can naturally extrapolate to process more latent tokens at inference time than it ever saw during training, maintaining highly stable feature representations.
Key Results
AdaPerceiver demonstrates excellent Pareto-optimality across all evaluated tasks:
- ImageNet-1K Classification: AdaPerceiver achieves a top accuracy of 85.4%, matching large models while delivering 36% higher throughput than FlexiViT-L. In its high-throughput configuration, it processes 5,378 images/sec, matching FlexiViT-B while scoring 0.2 percentage points higher in accuracy.
- Dense Prediction (ADE20K & NYUv2): On semantic segmentation, AdaPerceiver scores 43.9 mIoU (just 0.3 below ViT-H/14) while using 26× fewer encoder FLOPs (158 vs. 4,313 GFLOPs). On depth estimation, it actually outperforms or matches ViT-H variants while maintaining this massive compute reduction.
- Policy-Driven Adaptivity: When paired with a reinforcement learning (RL) or early-exit policy to choose the best configuration per image, AdaPerceiver cuts FLOPs by 24% to 33% on ImageNet-1K with virtually zero loss in accuracy ($\pm0.1$ percentage points).
Limitations and Future Work
Despite its strengths, the authors note a few limitations:
- Distillation Dependency: The training recipe relies heavily on a high-quality pre-trained teacher model (ViT-H) for distillation to ease convergence. Training entirely from scratch remains an open challenge.
- Memory Overhead: While computationally efficient in terms of forward passes, the joint training regime demands significant GPU memory during the backward pass.
- Simple Decoders: For dense prediction tasks, the model was evaluated using a basic linear probe rather than a state-of-the-art decoder, meaning its true upper-bound performance on these tasks is still unknown.
Summary updated