arXiv:2611.26234cs.CVNov 2026

Manuscript Offprint

arXiv:2611.26234

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

Shivangi Rai, Vinod K Kurmi

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Source-free domain adaptation (SFDA) adapts a pre-trained 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

1 Introduction

Visual recognition models trained on a labelled source domain degrade when deployed under distribution shift caused by differences in imaging conditions, object appearance, texture, background composition, or acquisition device. Two settings address this without full re-annotation of the target domain. In source-free domain adaptation (SFDA) [14, 30, 29, 12], a source-trained model and unlabeled target data are available at adaptation time, but the source training set is inaccessible due to privacy or storage constraints. In domain generalization (DG) [4, 19], no target data are available during training at all; the model must generalize to unseen domains at test time. Both settings demand representations that are stable under covariate shift, yet the mechanisms by which standard training produces fragile representations remain insufficiently characterized.

Transformer-based backbones [3, 16] dominate visual recognition, including domain adaptive models [27, 21]. Their self-attention mechanism aggregates features from all spatial tokens, weighting each by a learned attention map derived from source-domain statistics. Under target-domain shift, these attention maps can drift toward spurious or background features that are discriminative in the source domain but not in the target, a phenomenon we term attention drift. Attention drift destabilizes the attention-conditioned feature representations on which downstream tasks depends: in SFDA, where a teacher model generates pseudo-labels from these representations, corrupted features propagate errors into the pseudo-label signal and compound through self-training; in DG, drifted attention patterns reduce robustness to the appearance variations encountered at test time on unseen domains. Despite the broad adoption of attention-based backbones, existing SFDA and DG methods do not directly target the stability of attention-conditioned features under distribution shift. A second, SFDA-specific failure mode arises at initialisation. Standard SFDA methods [14, 27] initialise the student model from a single fixed source checkpoint regardless of the severity of the domain gap between source and target. This is suboptimal because gap severity varies substantially across transfer tasks: a high-gap pair requires a conservative initialisation that does not over-commit to source-domain decision boundaries, whereas a low-gap pair benefits from a confident initialisation that accelerates pseudo-label convergence. Ignoring this distinction causes premature overfitting to noisy pseudo-labels under large domain shifts, degrading adaptation quality from the first training step.

Figure

Figure 1: Counterfactual Attention-based Feature Consistency (CAFC). CAFC enforces feature-level consistency between representations computed under learned attention and counterfactual attention perturbations, encouraging robustness to attention drift.

We propose DGA-CAFC, a two-module framework that addresses both failure modes (Fig. 2). The Counterfactual Attention-based Feature Consistency (CAFC) module enforces stability in attention-conditioned features by minimizing the discrepancy between representations computed under the model’s learned attention map and those computed under three counterfactual-inspired normalised attention perturbations: a uniform map that removes all focal structure, a random map that injects noise, and a reversed map that inverts saliency. Minimising this discrepancy is analogous to Lipschitz-style regularization in attention-conditioned feature space: it reduces the sensitivity of the learned representation to the specific attention weight configuration, encouraging domain-robust features that do not depend on source-specific attention patterns. Critically, CAFC requires no target labels and operates on attention outputs, making it directly applicable in both SFDA and DG settings without architectural modification. The Domain-Gap Aware Source Model Selection (DGASS) module addresses the SFDA initialisation problem by estimating target domain gap severity from unlabeled target prediction entropy and selecting the source model variant between a sharp, confident variant and a smoother, more conservative one. Our contributions can be summarized as follows:

  1. We propose CAFC, an attention-stability regularizer that operates without target labels and transfers across settings, functioning within the SFDA adaptation and as a source-training regularizer in domain generalization.
  2. We propose DGASS, an entropy-guided source model selection mechanism for SFDA that requires no target labels and acts before adaptation begins, selecting the source variant whose confidence calibration matches the estimated domain gap.
  3. We extend CAFC to domain generalization as a lightweight source-training regularizer, demonstrating that attention-stability regularization improves multiple standard DG objectives without requiring any target data during training.
  4. Extensive experiments and analysis are conducted across multiple SFDA and DG benchmarks, with thorough ablation studies provided to justify each design choice and validate the contribution of each proposed module.