TL;DR
FM-Mamba introduces a native 2D selective state space model that processes images without flattening them into 1D sequences. By leveraging the Fornasini–Marchesini (FM) framework and a novel stability-aware discretization, it achieves significantly higher training efficiency and lower memory usage than existing Mamba-based vision models while maintaining competitive accuracy.
What Problem Does This Paper Address?
State Space Models (SSMs) like Mamba have gained popularity for their linear scaling with sequence length, offering a compelling alternative to the quadratic scaling of Transformers. However, adapting Mamba to 2D data like images presents a "structural mismatch."
Most current "Vision Mamba" methods solve this by flattening 2D grids into 1D sequences (e.g., raster or zigzag scans). This approach has three major drawbacks:
- Loss of Spatial Adjacency: Vertical neighbors in an image become distant in a 1D sequence.
- Computational Overhead: To compensate for the loss of structure, models often run multiple scans (e.g., four directions), multiplying the compute and memory requirements.
- Stability Issues: Direct 2D recurrences often lack a theoretical framework to ensure numerical stability, leading to "exploding" signals unless aggressive global damping is applied, which can hurt performance.
FM-Mamba tackles these by proposing a native 2D recurrence that respects the grid structure and incorporates 2D stability theory directly into the model's discretization step.
Methods
The authors build FM-Mamba on the General Fornasini–Marchesini (FM) model, a classic framework for 2D discrete systems.
Key technical innovations include:
- Native 2D Recurrence: Unlike 1D Mamba, which only looks at one predecessor, FM-Mamba’s state update gathers information from three neighbors: horizontal, vertical, and diagonal. This preserves "multipath propagation"—the idea that information can reach a point through many different routes on a grid.
- Anisotropic Selection: The model uses two independent, input-dependent step sizes ($\Delta_1, \Delta_2$) for the horizontal and vertical axes. This allows the model to adapt its "focus" differently in each direction based on the image content.
- Stability-Aware Discretization: The authors derived a closed-form mathematical bound for these step sizes. If the input-dependent steps fall outside a "stable" range that could cause numerical overflow, they are projected back onto the boundary. This ensures local stability without needing the blunt "global scaling" used in previous 2D SSMs.
- Dual-Diagonal Wavefront Scan: To make this computationally efficient, the authors use a parallel scan that processes the image along anti-diagonals (wavefronts). This allows for high parallelism on GPUs without ever flattening the feature map.
Datasets
The model was evaluated on the COCO 2017 dataset for multi-label classification. The authors used a standard split (train2017 for training, val2017 for validation) and resized images to 224 × 224.
Key Insights and Ideas
- The Diagonal Term Matters: The "diagonal predecessor" term ($\tilde{A}_0$) in the recurrence isn't just an extra parameter; it arises naturally from the cross-axis coupling of the horizontal and vertical dynamics during discretization. It significantly improves the model's ability to capture complex spatial relationships.
- Single-Drive Injection: While many models use dual projections for horizontal and vertical paths, FM-Mamba uses a "single-drive" approach where the input enters the state through a single projection. This reduces the number of parameters and intermediate tensors, leading to massive memory savings.
- Local vs. Global Stability: Instead of damping the entire signal globally (which can wash out features), FM-Mamba uses its "stability-aware" criteria to constrain the model only where and when it's needed, per-position and per-channel.
Key Results
FM-Mamba demonstrates a superior balance of efficiency and quality compared to both flattening-based (Vision Mamba, VMamba) and existing native 2D (Mamba2D) baselines:
- Efficiency: Compared to Mamba2D, FM-Mamba reduces training time by up to 52.8%, peak memory by 42.1%, and training energy by 53.5%.
- Throughput: In inference, FM-Mamba reaches 86.74 FPS (unoptimized), which jumps to a staggering 385.39 FPS with an optimized Per-Shape Dispatch (PSD) implementation.
- Accuracy: Despite the efficiency gains, it remains highly competitive, staying within 0.12 percentage points of the mAP (mean Average Precision) of much heavier models.
Limitations and Future Work
While FM-Mamba excels at image-level classification, the authors note several areas for future exploration:
- Dense Prediction: The current work focuses on classification. Extending this native 2D recurrence to tasks like object detection and semantic segmentation is a logical next step.
- Higher Dimensions: The FM framework can theoretically be extended to 3D (video) or even higher-dimensional data.
- Inference Optimization: While training is highly efficient, further work is needed to optimize inference for the specific "anisotropic" (direction-dependent) recurrence used here.
For more details, the code is available at https://github.com/BitSsm/FM-Mamba-Runtime.
Summary updated