Vision Transformers with Mixed-Resolution Tokenization

Tomer Ronen, Omer Levy, Avram Golbert

Abstract

Standard Vision Transformers (ViTs) utilize a uniform grid for image tokenization, treating all spatial regions with equal computational weight regardless of their semantic importance. This paper introduces Quadformer, a novel architecture that employs a mixed-resolution tokenization scheme. By utilizing a Quadtree-based decomposition guided by a semantic saliency scorer, Quadformer allocates higher resolution (more tokens) to critical image regions and lower resolution to backgrounds. Our results on ImageNet-1k demonstrate that this approach achieves superior accuracy-to-compute trade-offs compared to vanilla ViTs, particularly as model scale increases.

Introduction

In the domain of computer vision, the Vision Transformer (ViT) has become a dominant architecture. However, its fundamental tokenization strategy—slicing an image into a rigid grid of equal-sized patches—remains a source of computational inefficiency. In a typical natural image, semantic information is rarely distributed uniformly; a bird in flight contains significantly more critical detail than the surrounding sky. While Natural Language Processing (NLP) has long benefited from variable-length subword tokenization, vision models have largely adhered to fixed-size grids.

Quadformer bridges this gap by introducing a spatially-aware, variable-resolution tokenization scheme. By "routing" the model's limited token capacity to high-saliency areas, Quadformer optimizes the information density of the input sequence, leading to improved performance without a proportional increase in computational cost.

Methodology

The Quadformer architecture replaces the standard patch embedding layer with a dynamic mosaic generation process consisting of two primary components: a Quadtree algorithm and a saliency scoring mechanism.

The Quadtree Algorithm

The Quadtree is a classic hierarchical data structure used to partition 2D space. Quadformer begins with a coarse grid and recursively divides the most "important" patches into four smaller quadrants. This process continues until a pre-defined token budget is reached, resulting in a mosaic of patches with varying dimensions (e.g., 64x64, 32x32, and 16x16 pixels).

Saliency Scorers

The effectiveness of the Quadtree decomposition depends on the metric used to identify which patches require higher resolution. The authors evaluated three distinct scoring methods:

  1. Pixel-Blur Scorer: Calculates the Mean Squared Error (MSE) between an original patch and its blurred counterpart. While effective at identifying high-frequency textures, it often fails to distinguish between complex backgrounds and actual objects of interest.
  2. Feature-Based Scorer: A novel approach using a lightweight backbone (ShuffleNetV2) to compare neural features of original versus blurred patches. This method identifies "semantic information loss," allowing the model to prioritize regions that contribute most to classification accuracy.
  3. Oracle Scorer: Utilizes Grad-CAM to identify regions the model requires for correct prediction. This serves as a theoretical upper bound for the performance of mixed-resolution tokenization.

Architectural Integration

Because the resulting patches are no longer aligned to a regular grid, Quadformer utilizes 2D position embeddings to preserve spatial relationships. Regardless of their original size in the image, all patches are resized to a fixed 16x16 representation before being projected into the Transformer's embedding space, ensuring compatibility with standard ViT blocks.

Experimental Results

Performance on ImageNet-1k

Quadformer was evaluated using ViT-Small, ViT-Base, and ViT-Large architectures. When controlling for the number of patches or Giga-Multiply-Accumulate operations (GMACs), Quadformer consistently outperformed vanilla ViTs. Notably, for the ViT-Large architecture, Quadformer achieved an absolute accuracy increase of 0.88%.

Inference Efficiency

A critical concern with dynamic tokenization is the overhead of the saliency scorer. However, the research indicates that for larger models, this overhead is negligible. For ViT-Large, the saliency logic accounts for only 4% of the total runtime. Even when including this overhead, Quadformer outperformed vanilla ViTs by 0.42% at equivalent inference latencies.

The Potential of Saliency

Experiments with the Grad-CAM Oracle scorer revealed a massive 4% accuracy gap over standard ViTs. This suggests that the primary bottleneck for mixed-resolution tokenization is the quality of the saliency estimator; as these algorithms improve, the performance gains of the Quadformer approach are expected to scale significantly.

Discussion and Insights

Semantic vs. Structural Saliency

A key finding of this work is the distinction between structural detail and semantic importance. Classification models do not necessarily require high resolution for every high-frequency texture (like grass or water). The feature-based scorer's success stems from its ability to ignore high-frequency noise in favor of object-related features, proving that "meaning" is more important than "detail" for efficient tokenization.

Grid-Agnostic Transformers

The success of Quadformer highlights the inherent flexibility of the Transformer architecture. Unlike Convolutional Neural Networks (CNNs), which are constrained by rigid spatial kernels, Transformers are fundamentally sequence-processing engines. By updating position embeddings, the architecture can process a non-uniform mosaic as effectively as a standard grid.

Limitations and Future Work

The primary limitation of Quadformer is the computational overhead in smaller models. In ViT-Small, the saliency scorer can account for up to 44% of the total runtime, which can offset the efficiency gains of reduced token counts. Future research will focus on developing even more efficient saliency estimators and expanding the mixed-resolution approach to dense prediction tasks such as object detection, segmentation, and image generation, where localized high resolution is even more critical.

Summary updated

BibTeX
@inproceedings{ronen2023vision,
  author = {Tomer Ronen and Omer Levy and Avram Golbert},
  title = {{Vision Transformers with Mixed-Resolution Tokenization}},
  booktitle = {Workshops @ CVPR},
  year = {2023},
}
Figure