Vision Transformer with Super Token Sampling

Huaibo Huang, Xiaoqiang Zhou, Jie Cao, Ran He, Tieniu TanarXiv 2022 · DOI

TL;DR

The Super Token Vision Transformer (STViT) introduces a novel "Super Token Attention" (STA) mechanism that samples semantically meaningful clusters of pixels—super tokens—to perform global self-attention. This approach allows the model to capture long-range dependencies even in shallow layers with high efficiency, achieving state-of-the-art results on ImageNet-1K (86.4% top-1) and robust performance in object detection and segmentation.

Introduction: The Global Context Bottleneck

Standard Vision Transformers (ViTs) face a significant computational bottleneck: the cost of self-attention grows quadratically with the number of tokens (pixels/patches). In the early, "shallow" layers of a network, images contain a massive amount of local redundancy.

To manage this, existing models like the Swin Transformer use "window-based" local attention, which restricts a token's view to its immediate neighbors. While efficient, this sacrifices the model's ability to capture global context early in the network. The authors of STViT address a critical question: Can we achieve efficient global context modeling at the very beginning of a neural network without the quadratic price tag?

Methodology: Super Token Attention (STA)

The authors propose Super Token Attention (STA), inspired by the concept of "superpixels" in traditional computer vision. This mechanism effectively decomposes a massive $N \times N$ attention matrix into a multiplication of a sparse association map and a much smaller $m \times m$ attention matrix, providing a "global view" at a fraction of the cost. The process follows three main steps:

  1. Super Token Sampling (STS): Instead of treating every patch as an independent token, the model learns a sparse association map. It groups similar visual tokens into a smaller set of "super tokens." To maintain efficiency, each visual token only associates with a 3x3 neighborhood of potential super tokens.
  2. Self-Attention on Super Tokens: The model performs standard multi-head self-attention (MHSA) on these condensed super tokens. Because the number of super tokens ($m$) is much smaller than the original number of tokens ($N$), the computational cost drops significantly.
  3. Token Upsampling (TU): The refined information from the super token space is mapped back to the original high-resolution token space using the learned association map.
Visualization of the super token sampling process, showing how initial grid-based tokens are refined into learned, semantically meaningful clusters.

Architecture and Key Insights

The full STViT architecture is a hierarchical "hybrid" model. It utilizes a convolutional stem followed by "STT blocks" that combine Convolutional Position Embedding (CPE), the STA mechanism, and a Convolutional Feed-Forward Network (ConvFFN) to balance local feature extraction with global modeling.

  • Semantic Tessellation: Super tokens act as a semantically meaningful tessellation of the image. By attending to these clusters rather than individual pixels, the model focuses on the "big picture" (e.g., the head of a bird vs. the background) rather than redundant local textures.
  • Redundancy Reduction: In shallow layers, standard global attention is often highly redundant, as most tokens primarily attend to their immediate neighbors. Super tokens naturally suppress this redundancy by grouping similar features together before the attention step.

Experimental Results

STViT demonstrates a superior accuracy-to-complexity trade-off compared to popular backbones like Swin, ConvNeXt, and CSWin across several industry-standard benchmarks.

ImageNet-1K Top-1 Accuracy vs. FLOPs comparison, highlighting STViT's superior performance relative to other state-of-the-art architectures.
  • ImageNet-1K: The large model (STViT-L) achieved 86.4% top-1 accuracy at 384x384 resolution. The base model (STViT-B) reached 84.8%, outperforming Swin-B (83.3%) with a similar parameter count.
  • Object Detection (COCO): STViT-B achieved 53.9 box AP, surpassing Swin-B by 2.0 points.
  • Semantic Segmentation (ADE20K): STViT-B reached 51.9 mIoU, a significant +3.1 improvement over its Swin-T counterpart.
  • Efficiency: STViT-S achieves the same accuracy as Focal-S but with half the parameters and nearly triple the throughput.

Limitations and Future Work

While STViT offers impressive theoretical efficiency, the authors acknowledge that some operations in STA, such as Fold and Unfold used for sparse sampling, are not yet as highly optimized for GPUs as standard convolutions. Consequently, actual wall-clock speedups may vary depending on hardware. Future work includes exploring performance on larger-scale datasets like ImageNet-21K and further optimizing the implementation for production environments.

Summary updated

BibTeX
@misc{huang2022vision,
  author = {Huaibo Huang and Xiaoqiang Zhou and Jie Cao and Ran He and Tieniu Tan},
  title = {{Vision Transformer with Super Token Sampling}},
  year = {2022},
  eprint = {2211.11167},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2211.11167},
}
Figure