TL;DR
State Space Models (SSMs) like Mamba are highly efficient but struggle with 2D image data because flattening images into 1D sequences destroys spatial locality. QuadMamba solves this by introducing a learnable, quadtree-based scanning strategy that adaptively partitions images into varying granularities, focusing computational power on the most informative regions. This approach achieves state-of-the-art performance across multiple vision tasks while maintaining Mamba's signature linear computational complexity.
What Problem Does This Paper Address?
State Space Models (SSMs), particularly Mamba, have recently taken the deep learning world by storm. They offer a compelling alternative to Transformers because they scale linearly with sequence length rather than quadratically, making them incredibly fast and memory-efficient for long sequences.
However, adapting Mamba from 1D language data to 2D visual data is tricky. Standard Vision Mamba models typically flatten an image into a 1D sequence using a simple "raster scan" (reading pixels left-to-right, top-to-bottom). This naive flattening destroys the natural 2D spatial relationships (locality) of the image—pixels that are right next to each other vertically might end up far apart in the 1D sequence.
While some recent models try to fix this by dividing the image into fixed-size windows (similar to Swin Transformers), this rigid approach ignores a fundamental truth of computer vision: natural images have heavy spatial redundancy. A large patch of blank sky doesn't require the same fine-grained processing as the intricate details of a dog's face. The authors of this paper set out to create a Vision Mamba model that can dynamically adapt its scanning granularity based on the actual content of the image.
Methods
To bridge the gap between 2D images and 1D sequences, the authors introduce QuadMamba, built around a novel Quadtree-based Visual State Space (QuadVSS) block.
Here is how the architecture works:
- Learnable Quadtree Partitioning: Instead of a fixed grid, a lightweight module predicts a "partition map" that scores the importance of different image regions. Using a quadtree structure, the model recursively divides the image. The most informative quadrants are split into smaller sub-quadrants (fine-grained), while less informative regions are left as larger blocks (coarse-grained).
- Differentiable Sequence Masking: Making discrete choices (like "split this window, but not that one") is notoriously difficult to train via standard backpropagation. To make the quadtree partition end-to-end trainable, the authors cleverly use the Gumbel-Softmax trick. This generates a differentiable mask that constructs the final 1D sequence without adding heavy computational overhead.
- Omnidirectional Window Shifting: If an object sits right on the boundary between two windows, the model might miss the broader context. To fix this, QuadMamba shifts the window boundaries in successive layers. Because Mamba processes sequences causally (in a specific direction), QuadMamba uses a multi-directional shifting scheme to ensure features are captured intact across different local regions.
Key Insights and Ideas
- Locality is make-or-break for Vision Mamba: The authors demonstrated that naive flattening severely degrades performance, especially in dense prediction tasks like segmentation. Preserving 2D adjacency within the 1D sequence is crucial for SSMs to "understand" images.
- Not all pixels are created equal: By dynamically allocating fine-grained sequences to complex regions and coarse-grained sequences to background regions, the model avoids wasting compute on redundant spatial data.
- Differentiable routing works in vision: Using Gumbel-Softmax to create a differentiable partition mask proves that dynamic, data-dependent routing can be integrated into vision backbones without ruining training stability or efficiency.
- Directionality requires omnidirectional shifts: Unlike Transformer attention (which looks at everything at once), Mamba's sequence processing is directional. Therefore, standard one-way window shifting isn't enough; multi-directional shifting is required to fully capture cross-window context.
Key Results
The authors evaluated QuadMamba on three standard computer vision benchmarks: ImageNet-1k (classification), MS COCO2017 (object detection/instance segmentation), and ADE20K (semantic segmentation). QuadMamba consistently outperforms existing CNNs, Vision Transformers (ViTs), and other Vision Mamba variants of similar sizes:
- Image Classification: The QuadMamba-S (Small) variant achieves 82.4% Top-1 accuracy on ImageNet-1k with 31M parameters, beating Swin-T (81.3%) and DeiT-S (79.8%), while requiring fewer or comparable FLOPs.
- Object Detection: On COCO, QuadMamba-S achieves 46.7 box mAP, outperforming the highly optimized EfficientVMamba-B by a massive 3.0% margin.
- Semantic Segmentation: On ADE20K, QuadMamba-S hits 47.2% mIoU, significantly beating ResNet-50, Swin-T, and several baseline Vision Mamba models.
- Efficiency: Throughout all tasks, QuadMamba maintains the highly desirable linear computational complexity of the Mamba architecture.
Limitations and Future Work
The authors note a few limitations to their current design. First, the quadtree partition is currently limited to just two levels (coarse and fine). Expanding this to deeper levels could be highly beneficial for massive, high-resolution data like remote sensing images. Second, the partitioned regions are strictly rigid squares. Real-world objects come in arbitrary shapes and sizes, so future work will focus on developing more flexible, shape-adaptive partition regions to better hug the contours of complex visual features.
Summary updated