NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

DGMamba: Domain Generalization via Generalized State Space Model

Shaocong Long, Qianyu Zhou, Xiangtai Li, Xuequan Lu, Chenhao Ying, Yuan Luo, Lizhuang Ma, Shuicheng Yan

Introduction

Domain Generalization (DG) is a critical challenge in machine learning, aimed at training models on source domains so they can generalize effectively to unseen target domains. While Convolutional Neural Networks (CNNs) and Vision Transformers (ViTs) have been the standard, they face a trade-off between receptive field size and computational complexity. CNNs are limited by local receptive fields, whereas ViTs offer global context but suffer from quadratic complexity as image resolution increases.

DGMamba introduces a novel approach by adapting State Space Models (SSMs), specifically the Mamba architecture, for DG. Mamba provides global receptive fields with efficient linear complexity, but its application to vision-based DG reveals two primary obstacles: hidden state noise accumulation and scanning bias. DGMamba addresses these through two specialized modules: Hidden State Suppressing (HSS) and Semantic-aware Patch Refining (SPR).

The DGMamba Framework

The DGMamba architecture augments the standard Mamba block to enhance robustness against domain shifts. By focusing on domain-invariant features and breaking rigid spatial priors, it achieves superior generalization.

The DGMamba architecture featuring Hidden State Suppressing (HSS) and Semantic-aware Patch Refining (SPR) modules.

Hidden State Suppressing (HSS)

To prevent the model from over-relying on domain-specific details (like background textures), the HSS module selectively suppresses hidden states. It utilizes the discretization parameter ($\Delta A$)—which controls information flow—to identify and "mute" states likely to carry non-semantic noise. This mechanism forces the model to rely on stable, domain-invariant features for its predictions.

Semantic-aware Patch Refining (SPR)

Standard vision Mamba models often use fixed 1D scanning paths, creating a spatial bias. The SPR module mitigates this by using Grad-CAM scores to distinguish between "object" patches and "context" patches. It employs two key strategies:

  • Prior-Free Scanning (PFS): Context patches are randomly shuffled, breaking the spatial prior bias and forcing the model to focus on the semantic object regardless of background placement.
  • Domain Context Interchange (DCI): For high-confidence samples, context patches are swapped with those from different domains. This counterfactual training teaches the model to ignore background variations entirely.

Experimental Results

DGMamba was evaluated across five standard DG benchmarks: PACS, VLCS, OfficeHome, TerraIncognita, and DomainNet. The results demonstrate that DGMamba consistently outperforms both CNN-based and ViT-based state-of-the-art (SOTA) methods.

Accuracy vs. Number of Parameters on PACS and OfficeHome benchmarks, showing DGMamba's superior efficiency compared to ViT and ResNet baselines.

Key performance highlights include:

  • PACS: Achieved 91.0% average accuracy, a 2.2% improvement over previous SOTA.
  • OfficeHome: Reached 76.8%, marking a significant 4.4% jump.
  • DomainNet: On this large-scale dataset, it achieved 49.4%, surpassing the second-best method by 1.1%.

Beyond accuracy, DGMamba offers a significantly better trade-off between performance and parameter count. As shown in the performance plots, DGMamba achieves higher accuracy than heavy-duty Transformer models like GMoE while maintaining a much smaller parameter footprint.

Conclusion

DGMamba represents the first successful adaptation of State Space Models for Domain Generalization. By addressing the unique challenges of SSMs in vision tasks—namely hidden state noise and scanning bias—it sets a new state-of-the-art across major benchmarks. Its combination of global receptive fields, linear complexity, and robust feature learning makes it a powerful new tool for building models that generalize to the real world.

Summary updated

BibTeX
@inproceedings{long2024dgmamba,
  author = {Shaocong Long and Qianyu Zhou and Xiangtai Li and Xuequan Lu and Chenhao Ying and Yuan Luo and Lizhuang Ma and Shuicheng Yan},
  title = {{DGMamba: Domain Generalization via Generalized State Space Model}},
  booktitle = {ACM Multimedia},
  year = {2024},
  url = {https://openreview.net/forum?id=kaJsB2H0EX},
}
Figure