SfMamba: Efficient Source-Free Domain Adaptation via Selective Scan Modeling

Xi Chen, Hongxun Yao, Sicheng Zhao, Jiankun Zhu, Jing Jiang, Kui Jiang

TL;DR

SfMamba is the first efficient Mamba-based framework designed for Source-Free Domain Adaptation (SFDA). By introducing bidirectional channel scanning and a semantic-consistent background shuffling strategy, it effectively extracts domain-invariant features and eliminates brittle spatial shortcuts. The result is a state-of-the-art adaptation framework that achieves superior accuracy across multiple benchmarks while maintaining linear computational complexity and high parameter efficiency.

What Problem Does This Paper Address?

Source-Free Domain Adaptation (SFDA) tackles a highly practical machine learning challenge: how do you adapt a model pretrained on a "source" dataset to a new "target" dataset when you no longer have access to the source data? This constraint is common in the real world due to strict data privacy laws (like medical records) or massive storage limitations.

Existing SFDA methods typically rely on Convolutional Neural Networks (CNNs) or Vision Transformers (ViTs) as backbones, but both come with heavy trade-offs. CNNs suffer from local receptive fields, often failing to capture broader contextual information. ViTs offer global attention but suffer from quadratic computational complexity ($O(N^2)$), making them too heavy for resource-constrained applications.

State-Space Models (SSMs) like Mamba have emerged as a promising alternative, offering long-range dependency modeling with linear complexity ($O(N)$). However, standard Visual Mamba (VMamba) models struggle with SFDA for two reasons:

  1. They fail to capture channel-wise frequency characteristics essential for aligning different domains.
  2. Mamba’s recurrent sequential scanning makes it highly vulnerable to "shortcut learning"—it easily entangles semantic objects with incidental background context from the source domain, leading to severe error propagation when deployed in a new environment.

Methods

The authors introduce SfMamba, a framework tailored to optimize the Mamba architecture for source-free transfer through two novel components:

  1. Channel-wise Visual State-Space (Ch-VSS) Block: Positioned as an auxiliary neck network after the feature backbone, this block applies Mamba's selective scanning mechanism bidirectionally along the channel dimension rather than the spatial dimension. This allows the model to dynamically model input-dependent channel correlations, capturing domain-invariant frequency features (like edges and shapes) without altering the pretrained backbone.
  2. Semantic-Consistent Shuffle (SCS) Strategy: To disrupt the model's reliance on brittle spatial shortcuts (e.g., identifying a "bear" by the presence of rocks or snow), SCS uses Grad-CAM to identify low-activation background patches and randomly shuffles them during the 2D selective scan. A KL-divergence consistency regularization loss is then applied to ensure the model produces identical predictions for both the original and perturbed sequences, forcing it to anchor its decisions on robust foreground features.

The complete architecture overview is illustrated below:

Figure 2: Overview of SfMamba (left). The backbone adopts the encoder from VMamba [14], followed by an L× Channel-wise Visual State-Space (Ch-VSS) block (detailed on the right) to perform bidirectional channel scanning. During target adaptation, the input I is processed to generate a Grad-CAM activation map [6], where low-activation patches are identified as background and shuffled (˜I) via the Semantic-Consistent Shuffle (SCS) strategy. Predictions from both original and perturbed sequences are regularized through KL divergence minimization.

Datasets

The authors evaluated SfMamba across four widely recognized domain adaptation benchmarks:

  • Office: A small-scale dataset containing 31 classes across three domains (Amazon, Dslr, Webcam).
  • Office-Home: A medium-scale dataset consisting of 65 classes across four distinct domains (Art, Clipart, Product, Real-World).
  • VisDA-C: A large-scale benchmark focusing on a Synthetic-to-Real domain shift across 12 object classes.
  • DomainNet126: A curated subset of the massive DomainNet dataset, featuring 126 classes spread across four domains (Clipart, Painting, Real, Sketch).

Key Insights and Ideas

  • The Recurrent Shortcut Trap: Because Mamba processes images as sequences, it inherently learns spatial co-occurrences. If a source domain always features a specific background with an object, the hidden states overfit to this sequence. When transferred to a target domain where the background changes, this error compounds step-by-step through Mamba's recurrent state evolution.
  • Channel Scanning as a Style Filter: While spatial scanning captures structural layouts, scanning across channels models feature correlations. This acts as an effective domain-alignment mechanism because channel interactions tend to represent style-invariant properties.
  • Targeted Background Perturbation: Instead of shuffling the entire image (which destroys semantic meaning), selectively shuffling only the background patches breaks spatial context shortcuts while preserving the core object identity.

Key Results

SfMamba consistently outperformed existing CNN, ViT, and Mamba-based SFDA methods across all evaluation metrics:

  • Office-Home: SfMamba-S set a new state-of-the-art (SOTA) with an average accuracy of 81.7%, outperforming the previous best ViT-based method (C-SFTrans) by 1.1% and the Mamba-based DATMamba by 0.8%.
  • VisDA-C: It achieved 89.3% accuracy, notably outperforming CDTrans-B (88.5%), which is a non-source-free method that requires full access to source data.
  • DomainNet126: SfMamba-S achieved the highest average accuracy of 77.9%, outperforming the popular SHOT-S baseline by 1.4%.
  • Computational Efficiency: Compared to the DeiT-B-based CDTrans, the VMamba-S variant achieved superior accuracy while utilizing 32.0% fewer parameters (27.7M fewer), 47.7% fewer FLOPs, and delivering a 25.9% higher throughput.

Limitations and Future Work

Despite its strong performance, the authors note a few limitations:

  • Extreme Domain Shifts: A degree of overfitting still occurs when adapting from highly stylized source domains (like Clipart) that feature simplified textures and strong intra-domain consistency.
  • Lack of Theoretical Proof: While the empirical results are robust, the paper lacks a formal mathematical or theoretical analysis explaining exactly why and how state-space models capture domain-invariant representations so effectively.

Future work will focus on enhancing robustness against extreme domain shifts using dynamic style augmentation, exploring adaptive scanning schedules, and integrating the framework with newer, emerging SSM architectures.

Summary updated

BibTeX
@article{chen2026sfmamba,
  author = {Xi Chen and Hongxun Yao and Sicheng Zhao and Jiankun Zhu and Jing Jiang and Kui Jiang},
  title = {{SfMamba: Efficient Source-Free Domain Adaptation via Selective Scan Modeling}},
  journal = {Expert Systems with Applications},
  year = {2026},
  doi = {10.1016/j.eswa.2026.132421},
}
Figure