Abstract
Learning robust models under distribution shifts between training and test datasets is a fundamental challenge in machine learning. While learning invariant features across environments is a popular approach, it often assumes that these features are fully observed in both training and test sets, a condition frequently violated in practice. When models rely on invariant features absent in the test set, their robustness in new environments can deteriorate. To tackle this problem, we introduce a novel learning principle called the Sufficient Invariant Learning (SIL) framework, which focuses on learning a sufficient subset of invariant features rather than relying on a single feature. After demonstrating the limitation of existing invariant learning methods, we propose a new algorithm, Adaptive Sharpness-aware Group Distributionally Robust Optimization (ASGDRO), to learn diverse invariant features by seeking common flat minima across the environments. We theoretically demonstrate that finding a common flat minima enables robust predictions based on diverse invariant features. Empirical evaluations on multiple datasets, including our new benchmark, confirm ASGDRO's robustness against distribution shifts, highlighting the limitations of existing methods.
Introduction: The "Lazy" Invariant Learner
Machine learning models often fail when deployed in real-world scenarios where the data distribution differs from the training set. A common strategy to mitigate this is invariant learning, which aims to identify features that remain constant across different training environments (e.g., the shape of an object) while ignoring spurious correlations (e.g., background color).
However, current invariant learning methods often exhibit "lazy" behavior. They tend to latch onto the simplest or most easily accessible invariant feature that minimizes training loss. If a model identifies a bird solely by its feet, it will fail if the bird is swimming and its feet are obscured. To achieve true robustness, a model must learn a sufficient set of invariant features—such as the beak, wings, and tail—ensuring it can still make accurate predictions even when some features are missing in the test environment.
Methodology: Sufficient Invariant Learning (SIL)
To address the limitations of existing methods, we propose the Sufficient Invariant Learning (SIL) framework. SIL encourages models to leverage a diverse range of invariant mechanisms rather than a single one. We implement this through a new algorithm: Adaptive Sharpness-aware Group Distributionally Robust Optimization (ASGDRO).
Seeking Common Flat Minima
The core idea behind ASGDRO is to find a "flat minimum" in the loss landscape—a region where the loss remains low even under small perturbations of the model parameters. Crucially, ASGDRO seeks a parameter space that is flat across all training environments simultaneously.
Theoretically, we demonstrate that finding these common flat minima prevents the model from over-relying on a single, narrow feature. Instead, it drives the model toward a more holistic, redundant solution that captures multiple invariant features. This is achieved by regularizing the gradient norm, which prevents the model from favoring "simple" solutions and encourages a more balanced use of the available feature vector.
Adaptive Group DRO
ASGDRO also incorporates Group Distributionally Robust Optimization (Group DRO) to protect performance on the "worst-case" groups or environments. This ensures that the model does not sacrifice the accuracy of minority groups to improve average performance. Additionally, a normalization matrix ($T_\theta$) is used to handle scale symmetries in deep networks, ensuring that the "flatness" measurement remains meaningful across different weight scales.
Experimental Evaluation
We evaluated ASGDRO across a variety of distribution shift benchmarks, including:
- H-CMNIST (Heterogeneous ColoredMNIST): A new benchmark designed to test if a model can learn multiple invariant features (color and shape) when one is significantly easier to learn than the other.
- Subpopulation Shift: Datasets like Waterbirds, CelebA, and CivilComments.
- Real-World Benchmarks: Camelyon17 (medical imaging) and FMoW (satellite imagery) from the WILDS collection.
- DomainBed: Standard suites for domain generalization (PACS, VLCS, etc.).
Key Results
- Feature Diversity: On the H-CMNIST benchmark, ASGDRO was the only method that successfully learned the "shape" feature when the "color" feature was also present. Baselines like ERM and GDRO largely ignored the shape feature in favor of the easier color feature.
- Robustness: On the Waterbirds dataset, ASGDRO achieved 91.4% worst-group accuracy, outperforming standard ERM (63.7%) and GDRO (90.6%).
- Landscape Analysis: Quantitative analysis of the Hessian matrix confirmed that ASGDRO consistently finds flatter minima across all groups compared to competing methods, validating our theoretical approach.
Conclusion and Future Work
Sufficient Invariant Learning represents a significant step toward more robust machine learning. By moving beyond "lazy" invariant learning and seeking diverse, redundant features through common flat minima, ASGDRO demonstrates superior performance across a wide range of distribution shifts.
While promising, ASGDRO comes with increased computational costs due to the Sharpness-aware Minimization (SAM) steps, which require additional forward and backward passes. Future work will focus on optimizing the efficiency of the algorithm and developing more complex real-world benchmarks with rich annotations to further validate the principles of SIL.
Summary updated