Vision Mamba: Applying SSMs to Image Tasks

Vision Mamba refers to the adaptation of State Space Models (SSMs) — specifically the Mamba selective SSM architecture — to computer vision tasks including image classification, object detection, and dense prediction. The architecture addresses a structural limitation of Vision Transformers (ViTs): quadratic computational complexity with respect to image resolution, which makes high-resolution inference expensive. By substituting SSM-based sequence modeling for self-attention, Vision Mamba achieves linear-time scaling over spatial token sequences derived from image patches.

Definition and scope

Vision Mamba is a class of neural network architectures that processes visual inputs by converting 2D image data into 1D token sequences and applying selective state space scanning operations across those sequences. The primary reference implementation, described in the paper Vision Mamba: Efficient Visual Representation Learning with Bidirectional State Space Models (Zhu et al., 2024, arXiv:2401.13320), introduced bidirectional SSM scanning to capture spatial context that unidirectional sequence models cannot represent adequately.

The scope of Vision Mamba covers:

The broader Mamba computer vision landscape also includes hybrid architectures that mix SSM layers with local attention, covered separately under Mamba Hybrid Models.

How it works

Vision Mamba decomposes image processing into four discrete phases:

  1. Patch tokenization — an input image of resolution H×W is divided into non-overlapping patches of fixed size (typically 16×16 pixels), producing a sequence of N = (H/P)×(W/P) tokens, each projected to a channel dimension D.

  2. Positional embedding — 2D positional encodings are added to each token to preserve spatial relationships that the 1D scanning order does not inherently encode.

  3. Bidirectional SSM scanning — each Visual State Space (VSS) block applies the Mamba selective scan in both forward and backward directions along the flattened token sequence. The selective scan mechanism, detailed in the foundational State Space Models Explained reference, assigns input-dependent SSM parameters (Δ, B, C) at each token, allowing the model to selectively compress or retain spatial information rather than attending uniformly.

  4. Output projection and task head — the processed token representations are passed to a task-specific head (classification MLP, detection neck, or upsampling decoder for segmentation).

The critical distinction from Vision Transformers is computational: self-attention in a ViT scales as O(N²) in both time and memory with respect to token count N, while the SSM scan in Vision Mamba scales as O(N). At ImageNet-1K resolution (224×224 pixels with 16×16 patches), N = 196 — a manageable sequence. At 1024×1024 pixels, N = 4,096, where the quadratic cost becomes a practical bottleneck. This linear-time property is elaborated further in Mamba Linear-Time Scaling.

For practitioners working with specific implementations, the Mamba PyTorch Integration reference documents the hardware-aware parallel scan kernels that make SSM operations GPU-efficient in practice.

Common scenarios

High-resolution medical imaging represents the deployment context where Vision Mamba's linear scaling yields the largest practical advantage. Whole-slide pathology images can exceed 100,000×100,000 pixels; even heavily downsampled representations produce token sequences that overwhelm attention-based models. SSM-based backbones process these sequences at a fraction of the memory footprint.

Remote sensing and satellite imagery follows similar reasoning. Multispectral satellite tiles processed at 512×512 or 1024×1024 resolution produce token counts that stress ViT memory budgets on standard GPU hardware.

Video understanding is a natural extension: treating video as a spatial-temporal token sequence allows Vision Mamba to scan across both frame content and temporal order within a single SSM pass. The Mamba Sequence Modeling page covers the temporal modeling dimension in more detail.

Comparison — Vision Mamba vs. Vision Transformer (ViT-B/16): At ImageNet-1K top-1 accuracy, Vim-Small (Vision Mamba Small) reported 80.5% accuracy with approximately 26M parameters (arXiv:2401.13320), compared to DeiT-Small at 79.8% with 22M parameters under comparable training settings. The accuracy difference is modest; the memory reduction at higher resolutions is the primary operational differentiator.

Decision boundaries

Vision Mamba is appropriate when one or more of the following conditions apply:

Vision Mamba is less appropriate when:

The Mamba Limitations and Tradeoffs page documents edge cases where SSM scanning order introduces positional artifacts absent in isotropic attention. The Mamba Benchmarks Performance reference provides structured comparisons across ImageNet, COCO, and ADE20K datasets.

The full reference landscape for Mamba-class architectures, including foundational SSM theory and architectural variants, is indexed at the Mamba Authority site index.

References