Attention Drift Regularization with Adaptive Initialization for Domain-Robust Visual Recognition

Shivangi Rai, Vinod K KurmiarXiv 2026

TL;DR

DGA-CAFC is a new framework that makes vision models more robust to distribution shifts by tackling "attention drift"—the tendency of models to focus on spurious background features when encountering new environments. By combining a counterfactual attention consistency loss with an entropy-based strategy for selecting the best starting model, the authors achieve state-of-the-art results in both source-free domain adaptation and domain generalization.

What Problem Does This Paper Address?

Deep learning models, particularly those based on Transformers, are notoriously fragile when deployed in environments different from their training data. This paper identifies two major hurdles in making these models "domain-robust":

  1. Attention Drift: In a new domain, a model's self-attention mechanism might shift its focus from the actual object (e.g., a bicycle) to spurious background cues (e.g., a specific type of tree) that happened to be discriminative in the training set. This destabilizes the features the model relies on for classification.
  2. Domain-Gap-Agnostic Initialization: In Source-Free Domain Adaptation (SFDA), where we adapt a pre-trained model to a new target without original data access, most methods start from a single fixed checkpoint. However, if the "gap" between the source and target is huge, a confident starting model might over-commit to wrong guesses (noisy pseudo-labels), leading to a downward spiral in performance.

Methods

The authors propose a two-pronged framework called DGA-CAFC:

  • Counterfactual Attention-based Feature Consistency (CAFC): This module acts as a "stress test" for features. For any given input, it computes features using the learned attention map and then compares them to features generated by three "counterfactual" perturbations: a uniform map (no focus), a random map (noise), and a reversed map (focusing on the least salient parts). By minimizing the difference between these representations, the model is forced to learn features that are stable regardless of exactly where the attention is pointing.
  • Domain-Gap Aware Source Model Selection (DGASS): Before adaptation begins, this module estimates the severity of the domain gap by measuring the entropy of the model's predictions on the unlabeled target data. If entropy is high (indicating a large gap), it selects a "smooth," more conservative source model variant. If entropy is low, it picks a "sharp," confident variant to accelerate convergence.
Overview of the DGA-CAFC framework showing the source model selection and the CAFC regularization during adaptation.

Datasets

The researchers evaluated their method across several standard benchmarks:

  • SFDA Benchmarks: Office31, Office-Home, and the large-scale DomainNet40.
  • Domain Generalization (DG) Benchmarks: PACS (Photo, Art, Cartoon, Sketch) and VLCS.

Key Insights and Ideas

  • Attention as a Double-Edged Sword: While self-attention allows Transformers to capture global context, that very flexibility makes them prone to "drifting" toward irrelevant features under distribution shift.
  • Robustness through Invariance: The core idea of CAFC is that a truly robust feature shouldn't fall apart just because the attention map shifted slightly. It treats attention perturbations as a form of Lipschitz regularization in the feature space.
  • Entropy as a Proxy for Gap: The paper demonstrates that simple prediction entropy is a reliable enough signal to categorize the "difficulty" of a transfer task, allowing for automated, label-free model selection.
  • Plug-and-Play Regularization: Crucially, CAFC isn't tied to a specific architecture. It can be added as a lightweight loss term to existing domain generalization algorithms (like Mixup or CORAL) to provide an extra boost in stability.

Key Results

The DGA-CAFC framework consistently outperformed recent baselines:

  • DomainNet40: Achieved an average accuracy of 87.49%, a +1.18% improvement over the strong TransDA baseline.
  • Office31: Reached 91.65% accuracy, surpassing methods like NRC and AaD.
  • Domain Generalization: On the PACS dataset, adding CAFC to standard objectives like Mixup and GroupDRO led to significant gains of +4.39% and +4.14%, respectively.

Qualitatively, Grad-CAM visualizations (Figure 3 in the paper) show that CAFC encourages the model to look at the entire object structure rather than just a few narrowly concentrated (and potentially spurious) regions.

Figure 3. Grad-CAM visualization for Office31 D→A.

The quantitative impact on DG objectives is further detailed in the results table below, showing consistent improvements across different backbones and domains.

Table showing DG results on PACS; CAFC consistently improves various base objectives.

Limitations and Future Work

  • DGASS Dependency: The model selection module (DGASS) currently requires access to target data to estimate entropy, meaning it is only applicable to the SFDA setting, not pure Domain Generalization where target data is entirely withheld during training.
  • Computational Cost: While described as "lightweight," calculating three additional counterfactual attention maps and their corresponding features does add some overhead to the training process.
  • Future Directions: The authors suggest exploring more sophisticated counterfactual generation methods and extending the adaptive initialization concept to a wider variety of pre-training regimes.

Summary updated

Abstract

Source-free domain adaptation (SFDA) adapts a pretrained source model to unlabeled target domains without source data access, yet two critical failure modes remain unaddressed. First, attention drift: source-learned attention maps shift toward spurious or background features under distribution shift, destabilizing feature representations. Second, domain-gap-agnostic initialization: applying a single fixed source model uniformly across all target domains ignores domain gap severity, causing premature overfitting to noisy pseudo-labels under large shifts. We propose DGA-CAFC to address both failures. The Counterfactual Attention-based Feature Consistency (CAFC) module enforces feature stability by minimizing the discrepancy between representations computed under learned attention and those under counterfactual-inspired normalized perturbations, thereby promoting domain-robust features independent of spurious attention shifts. The Domain-Gap Aware Source Model Selection (DGASS) module estimates domain gap severity via target prediction entropy and selects the source model variant whose confidence level best matches the estimated gap, reducing negative transfer and stabilizing pseudo-label quality. Crucially, CAFC transfers beyond SFDA: applied as a lightweight regularizer to standard domain generalization objectives without target data. Extensive experiments across SFDA and DG benchmarks demonstrate that our method consistently improves over recent baselines, demonstrating the effectiveness and generality of the proposed framework. Project page is available at https://visdomlab.github.io/DGA_CAFC
BibTeX
@misc{rai2026attention,
  author = {Shivangi Rai and Vinod K Kurmi},
  title = {{Attention Drift Regularization with Adaptive Initialization for Domain-Robust Visual Recognition}},
  year = {2026},
  eprint = {2611.26234},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.26234},
}
Figure