QuadMamba: Learning Quadtree-based Selective Scan for Visual State Space Model

Recent advancements in State Space Models, notably Mamba, have demonstrated superior performance over the dominant Transformer models, particularly in reducing the computational complexity from quadratic to linear. Yet, difficulties in adapting Mamba from language to vision tasks arise due to the distinct characteristics of visual data, such as the spatial locality and adjacency within images and large variations in information granularity across visual tokens. Existing vision Mamba approaches either flatten tokens into sequences in a raster scan fashion, which breaks the local adjacency of images, or manually partition tokens into windows, which limits their long-range modeling and generalization capabilities. To address these limitations, we present a new vision Mamba model, coined QuadMamba, that effectively captures local dependencies of varying granularities via quadtree-based image partition and scan. Concretely, our lightweight quadtree-based scan module learns to preserve the 2D locality of spatial regions within learned window quadrants. The module estimates the locality score of each token from their features, before adaptively partitioning tokens into window quadrants. An omnidirectional window shifting scheme is also introduced to capture more intact and informative features across different local regions. To make the discretized quadtree partition end-to-end trainable, we further devise a sequence masking strategy based on Gumbel-Softmax and its straight-through gradient estimator. Extensive experiments demonstrate that QuadMamba achieves state-of-the-art performance in various vision tasks, including image classification, object detection, instance segmentation, and semantic segmentation. The code is in https://github.com/VISION-SJTU/QuadMamba.

Paper

References (79)

Scroll for more · 38 remaining

Similar papers

Peer review

Reviewer VDbd9/10 · confidence 4/52024-07-07

Summary

This paper presents QuadMamba, a novel Mamba architecture for visual tasks such as image classification and dense predictions. Unlike the classic Vision Mamba, which splits 2D visual data using fixed windows, the authors introduce learnable windows by using a lightweight module that predicts 2D locality more informatively, allowing for the ignoring of irrelevant windows and further splitting of the most informative windows into sub-windows, capturing more fine-grained information. This coarse-to-fine fashion is made possible by the new implementation of a splitting operator with Hadamard product and element-wise summation, making the pipeline fully differentiable. The authors experiment on the classic benchmarks for image classification (ImageNet), object detection (COCO), and semantic segmentation (ADE20K), showing that the method achieves state-of-the-art results.

Strengths

- First, the paper is very well written and most of the figures are done very well so that it is easy to fully understand the story of paper. - I also like the idea coarse-to-fine scanning, to capture more relevant information in each layer in QuadMamba. It is also worth noting that as the authors mentioned, direct sampling from 2D visual data based on index is not differentiable, but the authors has proposed a solution to overcome it which I consider is a strong contribution. - The experiment shows that QuadMamba always outperforms the classic CNN, Vision Transformer on popular tasks (image classification, object detection, image segmentation).

Weaknesses

I do not see any major weakness for this paper but only have a few questions for better understanding the paper and improve its clarify: - The lightweight module to predict 2D locality, informative windows, is it shared across layers or specific to each layer? It seems this module is shared across layers but I feel it needs to be different as each layer capture different information. - As the authors mentioned in limitation, in remote sensing images which might be helpful to have more than two levels partition in QuadMamba. However, I feel this experiment can still be experimented with the current architecture. In this case, what can happen is that the lightweight module will split into sub-quadrants for all windows ( since all of them are mostly capturing relevant for predicting the output). Did the authors observe this extreme case to subplot all quadrants into sub-quadrants can happen with the current architecture?

Questions

As mentioned in weakness section, I have only two questions related to lightweight module, extreme case of splitting all quadrants to sub-quadrants in each layer. Besides, it would be great if the authors can provide some experiments with more than two levels partition as mentioned in conclusion, for example, by using the lite model on semantic segmentation tasks should be enough. I would be very helpful to get some insights for possible future works.

Rating

9

Confidence

4

Soundness

4

Presentation

4

Contribution

4

Limitations

Yes, the authors explicit mentioned the limitation which is that the partition with more than two levels is yet to be explored.

Reviewer ALic8/10 · confidence 4/52024-07-10

Summary

This paper proposes a vision mamba backbone for various vision tasks. It aims to adapt the recent popular mamba model originated from the language domain to vision tasks. The authors propose a learnable quad-tree partition strategy which can adaptively generate multi-scale visual sequences with spatial prior for mamba model. The authors also make contributions on differentiable training and shifted token interactions. Experimental results show the effectiveness of the proposed vision mamba, including image classification, object detection and segmentation. It shows the potential to be applied in various vision mamba models. Ablation studies are also extensively conducted.

Strengths

- Strong Motivation. This paper is well-motivated and important. Effectively adapting the Mamba model to vision tasks has gained wide attention recently. Multi-grained image information and 2D priors are essential to building a vision backbone, which has led to a strong motivation for this paper. Treating the 2D image as token sequences in the language domain needs exploration and adaptation. - Novel \& applicable method. The quadtree-based window partition is novel in vision Mamba. The learnable module part is lightweight and conceptually simple. The quadtree search technique is seen in other tasks, such as the point cloud domain. This paper only learns to partition the semantic-rich content with a handcrafted partition strategy, which avoids developing a search algorithm that is too complex. The other two points, the differentiable trick and shifted scheme, are also interesting. It has the potential to be applied to constructing token sequences for other vision mamba models. - Good experimental results. The method proposed is tested in image classification, detection, and segmentation tasks, which proves its effectiveness over other vision mamba models. The ablation studies and visualization results also give more explanations about the quadtree-based sequence construction. - Well-written presentation. The writing is clear and precise. In general, the presentation of this work is easy to follow. The experiments are well performed and the presented method compares favorably to the considered baselines.

Weaknesses

I have a number of suggestions and questions that may help to further improve the paper: - It would be helpful to demonstrate the impact of the hyper-parameters in the model design. For example, is it helpful to partition more window levels? - More illustrations and analysis are needed for the learnable parameters. It can show the relationship between model cost and performance gain to other researchers/readers. - It would be useful to give the details about the training settings and compare them to other vision mamba works.

Questions

I have listed some questions in the previous section.

Rating

8

Confidence

4

Soundness

3

Presentation

3

Contribution

4

Limitations

Yes

Reviewer Kbfx5/10 · confidence 3/52024-07-11

Summary

Authors propose a technique to adapt Mamba to vision tasks. They propose a novel Quad-tree based approach instead of flattening tokens for images in a raster scan mechanism to avoid losing local dependencies. They evaluate on three vision tasks of object recognition, objet detection and instance & semantic segmentation.

Strengths

- Interesting novelty and contribution designed specifically for Mamba type of models adapted to vision tasks. - Practically beneficial algorithm on the efficiency side where the show lower FLOPs and parameters with better or on par performance to SOA

Weaknesses

- It provides a tradeoff though and it's not clear which is more favourable when compared to VMamba with corresponding T/S/B in Table 1. Meaning you can see when comparing VMamba-T (88.2) with QuadMamba-T (78.2) it is much lower, it is only at the base variant they become on-par but with reduced FLOPS/parameters on QuadMamba side. The fact it doesn't seem that on the lighter weight variants the performance is on par in fact it is much lower with around 10%. - What’s the reported inference time for Table 1 in addition to the FLOPs.

Questions

- Table 2 not clear what is the result for LocalVMamba and VMamba with S for fair comparison to QuadMammba-S

Rating

5

Confidence

3

Soundness

3

Presentation

3

Contribution

3

Limitations

N/A

Reviewer HNK15/10 · confidence 3/52024-07-14

Summary

The paper introduces QuadMamba, an enhancement of vision State Space Model (SSM) architectures. At its core is a learnable QuadVSS network block that processes the image input patch at two different resolutions. For every 2x2 coarse window with 4 image patches, the method adaptively learns to process one of the 4 patches at the finer 2x resolution using the differentiable Gumbel-softmax formulation. These block are hierarchically stacked similar to SwinTransformer, but using a window shifting scheme in two different directions which is a better fit for SSM. The method is demonstrated to obtain good results relative to comparably sized transformer and CNN architectures on Imagenet classification, COCO object detection / instance segmentation, and ADE20k semantic segmentation.

Strengths

- Intuitive idea to learn how to pick an area that requires higher resolution processing and pack it into SSM via Gumbel Softmax. Solid although not particularly novel stacking of QuadVSS blocks into a SwinTransformer-like network architecture. - Competitive results relative to ViT and CNN, and seems to improve a little bit over other Mamba methods, although the gains there seem quite incremental. - Ablation over multiple network parameter decisions.

Weaknesses

# Significance The contribution seems a bit incremental. The overall idea of image traversals into several windows to enforce better locality was already explored before in LocalMamba. The gains in the experimental section over some of the other Mamba network variants (EfficientVMamba, VMamba, Swin-S etc) are not too large. The idea that we do not have to process all areas in high resolution but only 1/4 of them does seem useful, although does not seem strictly limited to SSMs -- e.g. would ViT methods also benefit? # Experimental results - It seems that the natural baseline to this method is to compare a network made of VSS modules, as opposed to QuadVSS (the main novelty). Such a comparison was done in Fig 5, however it is not too clear how rigorous it is. It would be helpful to compare more directly VSS / QuadVSS equivalents with same FLOPS, for several different FLOPS thresholds. This does not seem to have been done - it would validate more strongly the fact that allocating parameters selectively to higher resolutions actually helps (as opposed to using the baseline VSS module pyramid). - Unclear what the training overhead of a QuadVSS block is compared to a VSS block (in terms of memory, compute)? - As opposed to just a table, it would be helpful to have plots with flops vs quality as axes, with a separate curve in that graph for each model family. Such a plot can make the comparison more obvious, given that different methods have somewhat different amounts of flops. - In Sec 4.3, it's unclear why for the Tiny model, we stack more blocks in the second stage, while for Small and Base we stack more in the third stage. Any particular reason? Third stage is more standard VSS modules, as opposed to your QuadVSS innovation. Also later in Table 6 yet different stackings are best (2,4,6,2). It's hard to discern the logic in all these choices. # Clarity and questions Some details of the approach were not particularly clear to me. - L175 Do you always pick the same fine-grained patch for all 2x2 windows, or do they vary by window? Not particularly clear from the exposition/notation. - Also, it appears that 7 patches are picked for each region as per L185-187. Don't you want to have 8 patches (powers of 2 are usually more efficient hardware-wise?) - The softmax in Eq 7, what labels do you train it on? Is it the final labels? Right now it appears that this part is trained first, and kept fixed. - (minor) In Eq 6, it seems 'v_local' is aggregated across the whole image, shouldn't it be called 'global' instead? - (minor) L186: where is 'local adjacency score' defined? This is the first mention of the term. - (minor) Fig 5: S-QuadVSS is not defined, I assume it's the opposite direction shift, but helps to be explicit. # Minor Nits and Typos 159: infOrmative Table 1: VMamaba 606: Uperhead [62] (I believe it should be UperNet)

Questions

- Is your quad idea limited to SSM or would it also work for Vit? Can one learn to downsample specific patches in a Vit? - Do you have comparisons between networks made of QuadVSS/VSS or only VSS for several same FLOPS budgets? Do you have comparison of training overhead (compute/memory) for networks made of QuadVSS/VSS or only VSS baseline? - L175 Do you always pick the same fine-grained patch for all 2x2 windows, or do they vary by window? Not particularly clear from the exposition/notation. - Also, it appears that 7 patches are picked for each region as per L185-187. Don't you want to have 8 patches (powers of 2 are usually more efficient hardware-wise?) - The softmax in Eq 7, what labels do you train it on? Is it the final labels? Right now it appears that this part is trained first, and kept fixed.

Rating

5

Confidence

3

Soundness

3

Presentation

3

Contribution

3

Limitations

Limitations are adequately addressed.

Reviewer HNK12024-08-10

response

Thank you for the additional graphs and figures. While QuadMamba performs well compared to baselines in terms of #param, Fig 2 shows that performance is incremental wrt MACs (FLOPS). To me, actual model sizes are not as important, FLOPS (or model latency on same hw) are the primary criterion, and on this one the gains are quite small. So the graphs actually reinforce my initial statement - I do not think there is a naming misalignment - I was comparing similar flops to similar flops and there was not much notable improvement there. > Q2A1 The table below shows the improvement in tiny model levels/FLOPS thresholds. I do not see FLOPS listed in the table, just #params. I explicitly asked for quality comparisons for same FLOPS. > Q1A3 Your answer seems to be "Mamba adds a bunch more complicated constraints to the process" but you did not actually answer my question of -- can I do sampling and apply the Gumbel-Softmax idea to ViTs? > As the QuadMamba brings no extra training complexity, there is no training label for the softmax in Eq. 7. Softmax usually suggests a classification objective with training data. It seems what actually is going on is Eq 9. But at the point where you introduce Eq 7, the context is missing and is quite confusing. I still lean positive but the explanations do not change my general takeaways, so I would keep my rating.

Authorsrebuttal2024-08-11

Thanks for your responses and for maintaining positive ratings. We apologize for not addressing the concerns precisely due to the word limit. We hope the following explanation can partially address your concerns. * Our QuadMamba can achieve similar gains with a reasonable and simple learnable module compared to the complex methods (e.g., LocalViM). * We feel sorry that we forgot to provide the Flops in Q2A1. The Glops for Mamba-T is 1.7G, and the Flops for QuadMamba-T is 2.0G. Regarding Gumbel-Softmax: **1. Application to Vision Transformers (ViTs) and Other Architectures:** The Gumbel-Softmax technique can be integrated into Vision Transformers (ViTs) and various other architectures or tasks, such as detection and super-resolution. Unlike the Softmax, which outputs continuous values in the range (0,1), Gumbel-Softmax provides discrete outputs in {0,1}. This capability is particularly beneficial for differentiable decision-making. Several ViT studies, like A-ViT[7] and SparseViT[8], utilize Gumbel-Softmax primarily for sparsifying feature computation. However, there's currently no exploration of using Gumbel-Softmax for patch partitioning in ViTs, which we believe is a promising area for future research. **2. Supervision and Learning:** Gumbel-Softmax here does not require explicit supervision. It receives gradients from the overall objective, such as the 1000-way cross-entropy loss in ImageNet classification, and learns to predict coarse-to-fine partitions in an **end-to-end** manner. The supervision for the partitioning process is implicit. [7] A-ViT: Adaptive Tokens for Efficient Vision Transformer. Hongxu Yin, etc. In CVPR22. [8] SparseViT: Revisiting Activation Sparsity for Efficient High-Resolution Vision Transformer. Xuanyao Chen, etc. In CVPR23.

Program Chairsdecision2024-09-25

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC