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

Accelerating Vision Transformers with Adaptive Patch Sizes

Rohan Choudhury, JungEun Kim, Jinhyung Park, Eunho Yang, Laszlo A. Jeni, Kris Kitani

TL;DR

Vision Transformers (ViTs) are computationally expensive due to fixed-size image patches, especially for high-resolution images. This paper introduces Adaptive Patch Transformers (APT), which dynamically adjusts patch sizes based on image content, using larger patches for simple regions and smaller ones for complex areas. APT significantly accelerates ViT training and inference (up to 40-50%) without sacrificing accuracy, and can be applied to pre-trained models with minimal fine-tuning.

What Problem Does This Paper Address?

Standard Vision Transformers (ViTs) divide input images into a grid of uniformly sized patches. This approach, while effective, leads to a quadratic increase in computational cost with respect to the number of patches (and thus image resolution) due to the self-attention mechanism. For high-resolution images, this results in excessively long sequences of tokens, much of which can be redundant, especially in homogeneous image regions. Existing methods for reducing token count often involve fixed ratios or complex pruning mechanisms that can be suboptimal or introduce their own inefficiencies. The paper aims to address this by making the patchification process itself adaptive to image content, similar to how language models use variable-length subword tokens.

Methods

The core innovation is the Adaptive Patch Transformer (APT). Instead of a fixed patch size, APT determines patch sizes dynamically based on image content.

  1. Entropy-based Patch Size Allocation: APT calculates the entropy of image patches at multiple scales. Regions with low entropy (indicating homogeneity and redundancy) are assigned larger patch sizes, while regions with high entropy (indicating complexity and detail) receive smaller patches. This is achieved by iteratively dividing the image and assigning patch sizes based on a tunable entropy threshold.
  2. Patch Aggregation: To handle patches of different sizes within the same model, APT employs a novel aggregation mechanism. Smaller patches are embedded directly. Larger patches are first split into their constituent smaller patches, which are then embedded and aggregated using a convolutional layer. This aggregated representation is then combined with a resized version of the original large patch using a zero-initialized MLP. This zero-initialization is crucial, allowing the model to gradually incorporate high-resolution details during fine-tuning without degrading performance from the start.
  3. Dynamic Input Sizes and Sequence Packing: Since APT results in a variable number of tokens per image, the method uses sequence packing and block-diagonal masks to efficiently process batches of varying sequence lengths, compatible with optimized attention backends like FlashAttention.
  4. Positional Encodings: Positional encodings are handled via interpolation to maintain spatial consistency across different patch sizes.

Datasets

  • ImageNet-1K: Used for training and evaluation in image classification experiments.
  • COCO: Used for object detection experiments.
  • ADE20K: Used for semantic segmentation experiments.
  • LLaVA-1.5: Used for visual question answering (VQA) experiments.

No new benchmarks were introduced.

Key Insights and Ideas

  • Content-Aware Patching is Key: The most significant insight is that image content is highly variable in its complexity, and a uniform patch size is inherently inefficient. Adapting patch size based on local image entropy directly addresses this redundancy.
  • Zero-Initialization for Seamless Adaptation: The use of a zero-initialized MLP for aggregating information from different patch sizes is critical. It allows APT to be applied to pre-trained ViTs and achieve good performance with minimal or no fine-tuning, as the new layers start with minimal impact.
  • Efficiency Beyond ImageNet: APT's benefits extend beyond standard image classification to dense prediction tasks like object detection and semantic segmentation, which are often more sensitive to spatial details.
  • Input-Level Merging is More Efficient: The paper argues that input-level adaptive patch selection (like APT) is more efficient and reliable than layer-level token merging for accelerating ViTs.

Key Results

  • Speedup: APT achieves significant speedups: up to 40% for ViT-L and 50% for ViT-H on ImageNet inference and training. For high-resolution dense tasks, speedups of up to 30% were observed.
  • Accuracy Preservation: APT matches or sometimes exceeds the performance of standard ViTs across various tasks and resolutions, even after just one epoch of fine-tuning on pre-trained models.
  • Fine-tuning Efficiency: APT models can converge in as little as 1 epoch when fine-tuned from a pre-trained checkpoint, significantly reducing training time.
  • Downstream Task Performance: APT demonstrated effectiveness in Visual QA, Object Detection, and Semantic Segmentation, maintaining accuracy while reducing computational cost. For instance, it reduced input tokens by 30% for object detection and 28-32% for semantic segmentation without performance degradation.

Limitations and Future Work

  • Heuristic-Based Patch Selection: APT relies on a hand-crafted entropy-based heuristic for determining patch sizes. The authors suggest this could be improved by aligning it more directly with downstream task preferences.
  • Empirically-Tuned Thresholds: The entropy threshold parameter is empirically tuned, which can add friction to adoption.
  • Image Generation: While APT works for image understanding, it is not yet directly applied to image generation tasks, which often involve extremely high-resolution images and large models. Future work could explore its application in this domain.
  • Further Optimization: The authors suggest exploring alternative measures for patch compressibility and further optimizing the patch aggregation mechanism.

Summary updated

BibTeX
@inproceedings{choudhury2026accelerating,
  author = {Rohan Choudhury and JungEun Kim and Jinhyung Park and Eunho Yang and Laszlo A. Jeni and Kris Kitani},
  title = {{Accelerating Vision Transformers with Adaptive Patch Sizes}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=vqeZag7jHY},
}
Figure