Abstract
State Space Models (SSMs) like Mamba have emerged as efficient alternatives to Transformers, offering linear complexity for long-sequence modeling. However, adapting these 1D models to 2D vision tasks often results in "spatial amnesia" due to locality-breaking serialization. We present FractalMamba++, a novel vision backbone that utilizes fractal Hilbert curves for image scanning. By combining this locality-preserving traversal with Cross-State Routing (CSR)—a skip-connection mechanism—the model maintains spatial awareness and global context across varying resolutions. FractalMamba++ achieves state-of-the-art performance on high-resolution benchmarks, significantly outperforming existing Mamba-based vision models.
Introduction: The 2D-to-1D Locality Gap
While Transformers have revolutionized computer vision, their quadratic complexity ($O(N^2)$) limits their utility for high-resolution imagery. Mamba offers a linear-time ($O(N)$) alternative, but its 1D nature requires flattening 2D images into sequences. Standard raster scanning (row-by-row) destroys spatial adjacency; pixels that are vertically adjacent in an image become separated by an entire row in the sequence. This "locality break" forces the model to learn complex spatial relationships from scratch, a problem that worsens as resolution scales.
Methodology
FractalMamba++ introduces three core innovations to bridge the spatial gap:
1. Fractal Traversal via Hilbert Curves
Instead of linear scans, the model employs the Hilbert curve—a recursive, space-filling fractal. Unlike raster scanning, the Hilbert curve ensures that patches close in 2D space remain relatively close in the 1D sequence. This property is quantified by the Structure Distortion Score (SDS), where fractal scanning maintains a low, consistent distortion even as image resolution increases.
2. Cross-State Routing (CSR)
Even with fractal curves, certain spatially adjacent patches inevitably end up far apart in the sequence (as seen in Figure 1). To mitigate this "information fading," CSR introduces strategic skip connections. Using a resolution-agnostic greedy strategy and a Bidirectional Dynamic Programming Process (BDPP), the model identifies spatially close but sequentially distant nodes and allows information to "jump" across the sequence, effectively reusing hidden states to maintain global context.
3. Positional-Relation Capture (PRC)
To handle the sharp "inflection points" inherent in fractal curves, PRC integrates Rotary Positional Embeddings (RoPE). This explicitly encodes relative spatial relationships into the patch embeddings, providing a safety net for local structural awareness where the scanning path might otherwise struggle.
Experimental Results
FractalMamba++ was evaluated across multiple tasks, demonstrating exceptional scaling properties:
- ImageNet-1K Classification: At $1024^2$ resolution, FractalMamba++ (30M parameters) achieved 78.8% Top-1 accuracy, a massive improvement over the original VMamba (62.3%) and Spatial Mamba (66.1%).
- Object Detection & Segmentation: On MS COCO, the model reached 49.5 mAP. On ADE20K, it achieved 49.7 mIoU, setting new benchmarks for Mamba-based architectures.
- High-Resolution Robustness: The model showed superior generalization when trained on low-res ($224^2$) and tested on high-res ($1024^2+$) data, a direct result of the resolution-agnostic nature of fractal curves.
Conclusion
FractalMamba++ successfully addresses the fundamental limitations of applying 1D SSMs to 2D vision. By leveraging the self-similar properties of fractal curves and the context-preserving power of Cross-State Routing, it provides a scalable, efficient, and spatially-aware backbone for high-resolution computer vision. Future work will focus on optimizing the CSR CUDA kernels to further enhance inference speed.
Summary updated