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

Multi-Scale Vision Longformer: A New Vision Transformer for High-Resolution Image Encoding

Pengchuan Zhang, Xiyang Dai, Jianwei Yang, Bin Xiao, Lu Yuan, Lei Zhang, Jianfeng Gao

TL;DR

The Multi-Scale Vision Longformer (ViL) adapts the "local attention + global memory" mechanism from NLP to computer vision, enabling linear computational complexity relative to token count. By combining this efficient attention with a hierarchical multi-stage architecture, ViL scales effectively to high-resolution images, outperforming vanilla ViTs and traditional CNNs on dense prediction tasks like object detection and segmentation.

What Problem Does This Paper Address?

Vision Transformers (ViTs) excel at capturing long-range dependencies in images, but they suffer from a massive scalability bottleneck: standard self-attention has a quadratic computational and memory complexity ($O(N^2)$) relative to the number of tokens. When processing high-resolution images, the token count scales quadratically with the image resolution, meaning the overall complexity explodes quartically ($O(R^4)$).

This makes vanilla ViTs prohibitively expensive for dense downstream vision tasks like object detection, instance segmentation, and human pose estimation, which inherently require high-resolution feature maps. The authors aim to bridge this gap by designing a transformer architecture that retains global context without the devastating computational tax.

Methods

The authors introduce Multi-Scale Vision Longformer (ViL), which addresses the complexity bottleneck through two core architectural innovations:

  1. Multi-Scale Stacked Architecture: Instead of a single flat network, ViL stacks multiple "Efficient ViT" (E-ViT) stages sequentially (typically four stages). Early stages operate on high-resolution feature maps with a small hidden dimension, while later stages process downsampled, low-resolution maps with larger hidden dimensions, mirroring traditional CNN pyramids like ResNet.
Figure 1. A Multi-scale vision Transformers (bottom) by stacking 4 E-ViT modules (Top). An E-ViT (a × n / p) module is a ViT encoder with an efficient attention mechanism a, n efficient trans- former blocks, input patch size p. We add a LayerNorm after the patch embedding. We add ng extra global tokens, as a form of global memory, and simply throw them away when going to the next stage.
  1. Vision Longformer Attention: To achieve linear complexity, the authors adapt the 1-D Longformer attention from NLP into a 2-D spatial variant. It splits attention into two parts:
  2. Local Attention: Local tokens only attend to their immediate spatial neighbors within a $w \times w$ window.
  3. Global Memory: A small set of global tokens ($n_g$) can attend to all tokens, and all tokens can attend back to them, acting as an efficient global communication hub.

Additionally, the authors incorporate Relative Positional Bias (RPB) to inject translational invariance into the transformer blocks and develop an optimized sliding-chunk CUDA implementation (SCw/Handgrad) to minimize memory overhead during training.

Datasets

The model's performance was validated across several standard benchmarks:

  • ImageNet-1K: Used for training and evaluating image classification from scratch.
  • ImageNet-21K: Used for large-scale pre-training of the Medium and Base model variants.
  • COCO val2017: Used to evaluate downstream performance on object detection and instance segmentation using RetinaNet and Mask R-CNN frameworks.

Key Insights and Ideas

  • Preserving High-Resolution Context: Unlike concurrent efficient attention mechanisms like Linformer or Spatial Reduction Attention (SRA) which downsample or project key/value states to low resolutions, Vision Longformer retains high-resolution key and value feature maps. This prevents the loss of fine-grained spatial details crucial for localization tasks.
  • The Power of Inductive Bias: The "local attention + global memory" structure acts as a powerful inductive bias for vision, mimicking the localized receptive fields of CNNs while maintaining a cheap highway for global context.
  • Relative vs. Absolute Positions: Switching from absolute 2-D positional embeddings to Relative Positional Bias (RPB) yields significant performance boosts, especially when transferring models to higher resolutions for object detection.

Key Results

  • ImageNet Classification: ViL consistently outperforms vanilla ViT and DeiT across various scales. For instance, ViL-Small-RPB achieves 82.4% top-1 accuracy on ImageNet-1K with 24.6M parameters, outperforming DeiT-Small (79.9%).
Table 2: Flat vs Multi-scale Models performance
  • Pre-training Boost: When pre-trained on ImageNet-21K and fine-tuned at $384 \times 384$ resolution, ViL-Base-RPB reaches 86.2% top-1 accuracy, showing excellent parameter efficiency compared to massive models like BiT.
  • Downstream Vision Tasks: On COCO object detection using RetinaNet (1x schedule), ViL-Small-RPB scores 44.2 AP, significantly beating its ResNet50 (36.3 AP) and PVT-Small (40.4 AP) counterparts.

Limitations and Future Work

  • Data Hunger at Scale: Similar to vanilla ViTs, scaling from the Medium to the Base variant yields marginal improvements when trained purely on ImageNet-1K; large-scale pre-training (ImageNet-21K) remains necessary to unlock the full potential of larger configurations.
  • Implementation Complexity: Achieving true linear complexity in practice requires custom CUDA kernels or highly optimized sliding-chunk implementations, making it less plug-and-play than standard global self-attention in vanilla deep learning frameworks.

Summary updated

BibTeX
@inproceedings{zhang2021multi,
  author = {Pengchuan Zhang and Xiyang Dai and Jianwei Yang and Bin Xiao and Lu Yuan and Lei Zhang and Jianfeng Gao},
  title = {{Multi-Scale Vision Longformer: A New Vision Transformer for High-Resolution Image Encoding}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  doi = {10.1109/iccv48922.2021.00299},
}
Figure