MambaIRv2: Attentive State Space Restoration

Hang Guo, Yong Guo, Yaohua Zha, Yulun Zhang, Wenbo Li, Tao Dai, Shu-Tao Xia, Yawei Li

Abstract

State Space Models (SSMs), particularly the Mamba architecture, have emerged as efficient alternatives to Transformers due to their linear computational complexity. However, their inherent causality—where a pixel's state depends only on preceding elements in a sequence—limits their effectiveness in non-causal tasks like image restoration. We present MambaIRv2, which overcomes these limitations through an Attentive State-Space Equation (ASE) and Semantic-Guided Neighboring (SGN). These innovations enable global perception within a single scan, allowing MambaIRv2 to outperform state-of-the-art Transformers like HAT while maintaining superior computational efficiency.

Introduction

Image restoration tasks, such as super-resolution, denoising, and JPEG artifact reduction, are fundamentally non-causal. To accurately reconstruct a specific pixel, a model must ideally integrate information from relevant features across the entire image, regardless of spatial distance or sequence order.

While Vision Transformers (ViTs) provide this global receptivity, their quadratic complexity makes them prohibitively expensive for high-resolution images. Mamba architectures offer a linear-time solution but are constrained by a 1D causal scanning mechanism. Previous attempts to adapt Mamba for 2D data relied on redundant multi-directional scans (e.g., eight-way scanning), which increase computational overhead and still struggle with long-range numerical decay. MambaIRv2 addresses these bottlenecks by redesigning the state-space interaction to be inherently attentive and semantically aware.

Methodology

Attentive State-Space Equation (ASE)

The core innovation of MambaIRv2 is the mathematical reinterpretation of the SSM output matrix ($C$) as a "Query" mechanism. By introducing learnable semantic prompts into the $C$ matrix, the model can query global information from across the entire image. This effectively transforms the causal SSM into a non-causal operator, allowing a query pixel to perceive "unscanned" regions in a single pass.

Comparison between existing causal state-space modeling and the proposed attentive state-space modeling.

Semantic-Guided Neighboring (SGN)

Traditional Mamba models flatten 2D images into 1D sequences based on spatial proximity (e.g., raster scanning). However, in restoration, semantically similar pixels (e.g., parts of the same texture) are often more informative than immediate spatial neighbors. SGN reorders the sequence based on semantic similarity, placing related features closer together in the 1D chain. This mitigates the "long-range decay" problem inherent in SSMs by ensuring that the most relevant information is processed within a shorter sequence distance.

Empirical Analysis and Results

Efficiency and Redundancy

A key motivation for MambaIRv2 was the observation that multi-directional scans in existing SSMs are highly redundant. Our analysis shows a high cosine similarity between features generated by different scan directions, suggesting that the computational cost of multiple scans does not yield proportional information gains. By making a single scan more "intelligent" via ASE, MambaIRv2 achieves better results with significantly less computation.

Analysis of multi-directional scan similarity and control matrix distribution.

Performance Benchmarks

MambaIRv2 sets new benchmarks across several restoration tasks:

  • Super-Resolution: On the Urban100 dataset (2x scale), MambaIRv2 outperformed SRFormer by 0.35dB while utilizing 9.3% fewer parameters.
  • Comparison with Transformers: The model surpassed the Hybrid Attention Transformer (HAT) by 0.29dB on the Manga109 dataset.
  • Computational Scalability: At 1024x1024 resolution, MambaIRv2-B demonstrates faster inference and lower MAC count compared to HAT, proving its viability for high-resolution real-world applications.

Conclusion

MambaIRv2 successfully bridges the gap between the efficiency of State Space Models and the global receptivity of Transformers. By introducing the Attentive State-Space Equation and Semantic-Guided Neighboring, we eliminate the need for costly multi-directional scans and overcome the causality bottleneck. While Mamba-based restoration is still an evolving field, MambaIRv2 demonstrates that SSMs can serve as a powerful, linear-time backbone for complex vision tasks. Future work will explore extending this architecture to video restoration and more diverse degradation types such as deblurring and dehazing.

Summary updated

BibTeX
@inproceedings{guo2025mambairv,
  author = {Hang Guo and Yong Guo and Yaohua Zha and Yulun Zhang and Wenbo Li and Tao Dai and Shu-Tao Xia and Yawei Li},
  title = {{MambaIRv2: Attentive State Space Restoration}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.02619},
}
Figure