Abstract
Domain Generalization (DG) aims to train models on multiple source domains such that they generalize to unseen target domains. This paper introduces "gradient surgery" strategies—Agr-Sum and Agr-Rand—designed to identify and neutralize conflicting gradients between training domains. By focusing on features that achieve consensus across domains, these methods effectively ignore domain-specific noise. Experimental results on standard benchmarks like PACS, VLCS, and Office-Home demonstrate that these agreement-based optimization strategies significantly outperform standard baselines and several state-of-the-art techniques.
Introduction: The Challenge of Domain Shift
In standard machine learning, models are typically evaluated on data drawn from the same distribution as the training set. However, real-world applications often encounter domain shift, where the test environment differs stylistically or contextually from the training data. For instance, a model trained on high-resolution photographs may struggle to identify the same objects in sketches or cartoons.
Domain Generalization (DG) addresses this by training on several "source" domains to build a robust representation for an unknown "target" domain. The primary hurdle is that each domain contains "domain-specific" features—irrelevant quirks that do not generalize. The authors hypothesize that these quirks manifest as conflicting gradients during the optimization process: when different domains suggest opposing updates for the same neural network weight, they are likely reacting to non-generalizable noise.
Gradient Surgery Methodology
The proposed approach modifies standard gradient descent by seeking "agreement" across source domains.
- Gradient Characterization: The authors empirically demonstrate that gradients within a single domain exhibit significantly higher cosine similarity than gradients between different domains. This confirms that inter-domain conflict is a tangible indicator of domain-specific features.
- Agr-Sum (Agreement Sum): For each component of the gradient vector, the algorithm checks the sign across all source domains. If all domains agree on the direction of the update, the gradients are summed. If there is any disagreement (e.g., some domains suggest an increase while others suggest a decrease), the gradient for that specific component is set to zero.
- Agr-Rand (Agreement Random): To avoid "dead weights" resulting from persistent zeros, this variant replaces conflicting components with a small random value sampled from a Gaussian distribution.
- Comparison with PCGrad: The authors also evaluate PCGrad, a multi-task learning technique that projects conflicting gradients onto each other's normal planes, finding it less effective for DG than the more aggressive "agreement" strategies.
Experimental Setup and Datasets
The methods were evaluated on three major multi-domain image classification benchmarks: PACS, VLCS, and Office-Home. These datasets provide a range of domain shifts, from stylistic variations (PACS) to more subtle photographic differences (VLCS).
Key Results and Discussion
The proposed agreement strategies consistently outperformed the "Deep-All" baseline (standard ERM on pooled data) and various state-of-the-art (SOTA) methods, including Invariant Risk Minimization (IRM) and Meta-Learning Domain Generalization (MLDG).
As shown in the results table, Agr-Sum and Agr-Rand achieved the most significant gains on PACS and Office-Home, where domain shifts are most pronounced. On PACS, Agr-Sum reached an average accuracy of 65.80%, a notable improvement over the baseline's 63.89%. Statistical analysis using the Wilcoxon test confirmed these improvements were significant in 8 out of 12 experimental settings.
Insights
- Conflict as a Signal: Gradient disagreement serves as a diagnostic tool, pinpointing domain-specific features that should be ignored.
- Aggressive Filtering: The success of Agr-Sum over PCGrad suggests that in DG, it is more beneficial to discard conflicting information entirely rather than attempting to reconcile it.
- Model Agnostic: Because the method operates directly on gradients, it can be integrated into various architectures (e.g., ResNet, AlexNet) without structural modifications.
Limitations and Future Directions
While promising, the study primarily utilized AlexNet as a proof-of-concept. Future work should evaluate these strategies on more modern architectures like Vision Transformers. Additionally, while the number of domains is typically small, calculating separate gradients for each domain increases the per-iteration computational cost. Finally, the theoretical distinction between task-conflict (where PCGrad excels) and domain-conflict (where Agr-Sum excels) warrants further investigation.
Summary updated