Dual Vision Transformer

Ting Yao, Yehao Li, Yingwei Pan, Yu Wang, Xiao-Ping Zhang, Tao Mei

TL;DR

Dual Vision Transformer (Dual-ViT) introduces a novel two-pathway architecture to slash the computational cost of self-attention without sacrificing accuracy. By running a "semantic pathway" (for global context) and a "pixel pathway" (for fine details) in parallel, it achieves state-of-the-art performance—reaching 85.7% top-1 accuracy on ImageNet with significantly fewer parameters and FLOPs than previous heavyweights like VOLO.

What Problem Does This Paper Address?

The "Achilles' heel" of standard Vision Transformers (ViTs) is the self-attention mechanism. Its computational complexity grows quadratically ($O(n^2)$) with the number of input tokens (pixels/patches). While this allows the model to capture long-range dependencies, it makes processing high-resolution images incredibly slow and memory-intensive.

Previous solutions tried to fix this by down-sampling images (Pyramid Vision Transformers) or restricting attention to local windows (Swin Transformers). However, these methods often create a "lose-lose" scenario: down-sampling discards fine-grained details, while local windows miss the "big picture" global context. The authors of Dual-ViT set out to find a way to keep both global semantics and local details efficiently.

Methods

The core innovation is the Dual Block, which replaces standard Transformer blocks in the high-resolution early stages of the network. It consists of two interacting pathways:

  1. Semantic Pathway: This pathway compresses the input into a small set of "semantic queries" (learned parameters). These queries interact with each other via self-attention to form a global summary of the image. Because the number of these queries is small, this pathway is very fast.
  2. Pixel Pathway: This pathway processes the full-resolution feature map. Instead of attending to every other pixel, it uses the global summary from the semantic pathway as a "prior." It performs cross-attention between the pixels and the semantic tokens, allowing every pixel to "see" the global context without the $O(n^2)$ cost.

In the later, lower-resolution stages, the model uses a Merge Block. This block concatenates the tokens from both pathways and performs standard self-attention, allowing the global and local information to fully integrate before the final classification.

Datasets

The authors evaluated Dual-ViT across three primary computer vision benchmarks:

  • ImageNet-1K: For image classification (1.28 million training images).
  • MS COCO: For object detection and instance segmentation.
  • ADE20K: For semantic segmentation (challenging pixel-level labeling).

No new datasets were introduced; the focus was on outperforming existing models on these industry-standard benchmarks.

Key Insights and Ideas

  • Global-to-Local Dependency: The "aha moment" here is treating global semantics as a prior for local feature extraction. By letting the global pathway "guide" the pixel pathway, the model reduces the search space for local features, making the learning process more efficient.
  • Parallel Processing: Unlike models that alternate between global and local attention (like Twins or RegionViT), Dual-ViT runs them in parallel. This allows gradients to flow through both pathways simultaneously during training, which the authors claim helps compensate for information lost during compression.
  • Parametric Queries: Using learned, parametric queries to represent semantics—rather than just down-sampling the input—provides more flexibility. The model learns what is important to summarize rather than just averaging blocks of pixels.

Key Results

Dual-ViT demonstrates a superior "accuracy-to-latency" trade-off:

  • Efficiency: Dual-ViT-L achieved 85.7% top-1 accuracy on ImageNet. Compared to the previous SOTA model, VOLO-D4, it used 41.1% fewer FLOPs and 37.8% fewer parameters.
  • Downstream Tasks: On COCO object detection, Dual-ViT-S outperformed PVTv2 by 1.2% mAP while using 48% fewer parameters.
  • Qualitative Saliency: Using Score-CAM visualizations, the authors showed that Dual-ViT's attention maps are much more "on-target," tightly covering the actual objects in an image compared to the more scattered attention of its predecessors.

Limitations and Future Work

While the paper highlights significant gains, a few areas remain for exploration:

  • Complexity of Implementation: The dual-pathway design is more architecturally complex than a standard ViT, which might make it harder to optimize for specific hardware backends compared to simpler "vanilla" structures.
  • Scaling the Semantic Queries: The paper uses a fixed number of semantic tokens. Future work could investigate whether dynamically scaling the number of queries based on image complexity (e.g., a busy street vs. a clear sky) could yield further efficiencies.
  • Training Data: Like most Transformers, Dual-ViT likely requires the heavy data augmentation strategies mentioned (CutOut, RandAug) to perform well, as it lacks the inductive biases of CNNs.

Summary updated

BibTeX
@article{yao2023dual,
  author = {Ting Yao and Yehao Li and Yingwei Pan and Yu Wang and Xiao-Ping Zhang and Tao Mei},
  title = {{Dual Vision Transformer}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2023},
  doi = {10.1109/tpami.2023.3268446},
}
Figure