[Paper Review] SF-Mamba: Rethinking State Space Model for Vision
SF-Mamba introduces auxiliary token swapping and batch folding with periodic state reset to enable efficient unidirectional scanning in visual Mamba, achieving better accuracy-throughput across classification, detection, and segmentation tasks.
The realm of Mamba for vision has been advanced in recent years to strike for the alternatives of Vision Transformers (ViTs) that suffer from the quadratic complexity. While the recurrent scanning mechanism of Mamba offers computational efficiency, it inherently limits non-causal interactions between image patches. Prior works have attempted to address this limitation through various multi-scan strategies; however, these approaches suffer from inefficiencies due to suboptimal scan designs and frequent data rearrangement. Moreover, Mamba exhibits relatively slow computational speed under short token lengths, commonly used in visual tasks. In pursuit of a truly efficient vision encoder, we rethink the scan operation for vision and the computational efficiency of Mamba. To this end, we propose SF-Mamba, a novel visual Mamba with two key proposals: auxiliary patch swapping for encoding bidirectional information flow under an unidirectional scan and batch folding with periodic state reset for advanced GPU parallelism. Extensive experiments on image classification, object detection, and instance and semantic segmentation consistently demonstrate that our proposed SF-Mamba significantly outperforms state-of-the-art baselines while improving throughput across different model sizes. We will release the source code after publication.
Motivation & Objective
- Motivate efficient vision encoders by addressing causality and speed limitations of existing visual Mamba models.
- Develop a unidirectional scan with minimal overhead that enables future-to-past information flow.
- Improve GPU parallelism for short-sequence vision tasks via batch folding and periodic state reset.
- Demonstrate the effectiveness of SF-Mamba across image classification, object detection, and semantic/instance segmentation.
Proposed method
- Propose auxiliary patch swapping to enable bidirectional information flow within a unidirectional scan using two auxiliary tokens and a lightweight, parameter-free swap operation.
- Introduce batch folding with periodic state reset to maximize GPU utilization by merging batch and sequence dimensions while preserving independence through controlled state resets every T steps.
- Leverage a MambaVision hybrid architecture with unidirectional scanning and selective SSM blocks, augmented by auxiliary tokens for future-to-past routing.
- Provide a depthwise 1D convolution implementation that supports batch-folded data and boundary handling to maintain correctness.
- Precompute an adaptive B1/B ratio via a LUT to optimize batch folding for varying batch sizes and sequence lengths.
- Evaluate on ImageNet-1K for classification and ADE20K with UperNet for segmentation, plus object detection workflows (as per Appendix).

Experimental results
Research questions
- RQ1Can unidirectional Mamba be made as expressive as bidirectional scans through auxiliary token swapping?
- RQ2Does batch folding with periodic state reset substantially speed up SF-Mamba on short sequences without sacrificing accuracy?
- RQ3How do auxiliary tokens impact future-to-past information flow and overall representation quality across vision tasks?
- RQ4What is the throughput-accuracy trade-off of SF-Mamba compared with state-of-the-art CNN/Transformer/hybrid backbones?
- RQ5How does SF-Mamba perform on segmentation and detection tasks relative to classification?
Key findings
- SF-Mamba achieves superior accuracy–throughput trade-offs across model scales (T/S/B) compared to state-of-the-art baselines.
- Speedups of 110% to 180% are observed with batch folding for SSM kernels, especially for short sequences.
- Ablation shows auxiliary token swapping improves IN1K and ADE20K performance with minimal speed impact.
- Compared to uni-scan baselines, auxiliary token swapping provides bidirectional information flow and better accuracy.
- Compared with various bi-scan designs, SF-Mamba’s uni-scan with swapping achieves competitive accuracy with lower overhead.
- SF-Mamba-S and SF-Mamba-T variants demonstrate strong performance on classification and ADE20K segmentation tasks within Pareto-efficient regimes.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.