Introduction
For several years, the Vision Transformer (ViT) has been the dominant architecture in computer vision. However, ViTs face a significant efficiency bottleneck: the self-attention mechanism possesses a quadratic complexity $O(L^2)$ relative to the sequence length (the number of image patches). This scaling behavior leads to explosive computational and memory costs as image resolution increases, hindering the application of ViTs in domains requiring high-resolution processing, such as medical imaging or autonomous driving.
State Space Models (SSMs), particularly the Mamba architecture, have recently emerged as a linear-time $O(L)$ alternative to Transformers in Natural Language Processing. However, adapting SSMs to vision is non-trivial because visual data is 2D and non-causal, unlike the inherently 1D and causal nature of text. Standard unidirectional SSMs struggle to capture the global spatial context necessary for robust visual understanding. To address this, the authors introduce Vision Mamba (Vim), a generic vision backbone based entirely on bidirectional SSMs.
The Vision Mamba Architecture
Vision Mamba replaces the standard Transformer block with a specialized Bidirectional Mamba block. The process begins with patchification, where an input image is split into patches and projected into a 1D sequence of tokens, similar to a ViT. Because SSMs are sensitive to sequence order, learnable position embeddings are added to provide the model with 2D spatial awareness.
The core innovation is the Bidirectional SSM. To overcome the causal limitations of standard Mamba, the Vim block processes the token sequence in two directions simultaneously: a forward pass (tokens $1$ to $M$) and a backward pass (tokens $M$ to $1$). This allows the model to capture spatial relationships from the entire image. Furthermore, Vim utilizes hardware-aware optimizations, leveraging Mamba’s optimized CUDA kernels for "selective scans" and memory recomputation to maintain high efficiency.
Experimental Results
The model was evaluated on standard benchmarks including ImageNet-1K for classification, COCO 2017 for detection, and ADE20K for semantic segmentation. The results demonstrate that Vim is not only more efficient but often more accurate than optimized ViT variants like DeiT.
Efficiency and Scaling
Vim exhibits superior scaling properties. When processing high-resolution images ($1248 \times 1248$), Vim achieves a 2.8x speedup compared to DeiT and reduces GPU memory consumption by 86.8%. While Transformers often hit memory limits (Out of Memory) at these resolutions, Vim's linear complexity allows it to scale gracefully.
Performance Benchmarks
- ImageNet-1K: Vim-Small achieved 80.3% top-1 accuracy, outperforming DeiT-S (79.8%) with a comparable parameter count.
- Semantic Segmentation: On ADE20K, Vim-Ti outperformed DeiT-Ti by 1.8 mIoU.
- Object Detection: On COCO, Vim-Ti surpassed DeiT-Ti by 1.3 box AP.
Key Insights and Future Directions
The success of Vision Mamba suggests that self-attention is not strictly mandatory for achieving high-quality visual representations. A well-designed bidirectional SSM can provide the necessary global context with significantly higher efficiency. The data-dependent "selective" mechanism in Mamba allows the model to focus on relevant tokens, mimicking the functionality of attention weights without the quadratic cost.
Future work includes exploring self-supervised pre-training (e.g., Masked Autoencoders) for Vim, as this study focused primarily on supervised learning. Additionally, the authors see potential in applying Vim to specialized high-resolution fields like computational pathology and aerial photography, as well as developing hierarchical architecture variants to further optimize performance across different scales.
Summary updated