Universal Adaptive Environment Discovery

Madi Matymov, Ba-Hien Tran, Maurizio FilipponearXiv 2025 · DOI

Abstract

Universal Adaptive Environment Discovery (UAED) addresses the fundamental challenge of manual environment specification in robust machine learning. Traditional robust learning methods rely on predefined "environments" to identify and mitigate spurious correlations. However, defining these environments often requires prior knowledge of the very biases the model is intended to discover. UAED breaks this "chicken-and-egg" cycle by learning a distribution over data transformations to automatically discover the most informative environments for training. Our framework demonstrates significant improvements in out-of-distribution (OOD) generalization, notably achieving a +28.4% accuracy boost on Rotated-MNIST.

Introduction: The Challenge of Spurious Correlations

Machine learning models frequently rely on "shortcuts"—spurious correlations between labels and non-causal features in the training data. A classic example is the "Waterbirds" dataset, where waterbirds are predominantly photographed against aquatic backgrounds and landbirds against terrestrial ones. A standard empirical risk minimization (ERM) model often learns to classify the background rather than the bird, leading to failure when encountering a waterbird in a forest setting.

Spurious correlations in the Waterbirds dataset. Training data often couples labels (y) with specific backgrounds (a), leading to failures on test examples where these correlations are broken.

To combat this, robust learning objectives like Invariant Risk Minimization (IRM) or GroupDRO train models across diverse environments to encourage the learning of invariant features. However, these methods typically require human-annotated environment labels, creating a paradox: to build a robust model, one must already know which correlations are spurious.

The UAED Framework

UAED automates environment discovery by treating environment specification as a learnable policy ($\Pi_\phi$) over a family of data transformations ($T_\gamma$). This approach transforms static robust objectives into "Adaptive" versions (e.g., A-IRM, A-GroupDRO, A-REx).

Parameterized Transformations and Adaptive Objectives

Instead of fixed groups, UAED indexes environments by parameters such as rotation angles or color correlation strengths. The framework simultaneously optimizes the model parameters ($\theta$) and the environment policy ($\phi$). By employing a hierarchical Bayesian framework—using Beta distributions for continuous parameters and Gumbel-Softmax for discrete ones—UAED prevents the policy from collapsing into "easy" environments.

Theoretical Foundations

The authors provide PAC-Bayes bounds, establishing that minimizing the risk averaged over the learned policy guarantees robustness against any test environment within a specific KL-divergence of the training distribution. This theoretical grounding ensures that the discovered environments are not just difficult, but mathematically relevant to the goal of OOD generalization.

Experimental Results

The effectiveness of UAED was evaluated across several benchmarks, including Colored-MNIST, Rotated-MNIST, Waterbirds, and PACS.

Performance on Rotated-MNIST

On the Rotated-MNIST benchmark, where models must generalize to unseen digit orientations, UAED showed dramatic improvements. A-IRM achieved a worst-case accuracy of 94.2%, representing a 28.4% increase over standard IRM (65.8%).

Accuracy vs. Rotation Angle on Rotated-MNIST. A-IRM (green) maintains high, stable performance across all angles, whereas standard IRM (blue) suffers significant performance drops at specific orientations.

Real-World Robustness: Waterbirds

On the Waterbirds dataset, A-GroupDRO achieved 87.8% worst-group accuracy using a ResNet50 backbone. This performance is competitive with state-of-the-art methods that require explicit group annotations or complex multi-stage training procedures, highlighting UAED's ability to discover meaningful environments without manual intervention.

Discussion and Insights

A key finding of this work is "Method-Environment Alignment." Different robust objectives naturally seek different types of environments. For instance, A-IRM tends to find environments with conflicting correlations, while A-GroupDRO focuses on "stress-test" scenarios involving minority groups. UAED allows each objective to "choose" the training ground that best facilitates its specific mathematical optimization.

Furthermore, UAED acts as a self-paced curriculum. Early in training, the policy explores a wide range of transformations. As the model improves, the policy shifts focus toward the specific environments that remain challenging, effectively "finding its own hard mode."

Conclusion

Universal Adaptive Environment Discovery offers a scalable solution to the environment specification problem in robust machine learning. By automating the discovery of informative training environments, UAED reduces the need for human intuition and annotation in building models that generalize beyond their training distribution. While computational overhead remains a consideration, the stability and performance gains suggest that adaptive environment discovery is a vital step toward truly robust AI.

Summary updated

Abstract

An open problem in Machine Learning is how to avoid models to exploit spurious correlations in the data; a famous example is the background-label shortcut in the Waterbirds dataset. A common remedy is to train a model across multiple environments; in the Waterbirds dataset, this corresponds to training by randomizing the background. However, selecting the right environments is a challenging problem, given that these are rarely known a priori. We propose Universal Adaptive Environment Discovery (UAED), a unified framework that learns a distribution over data transformations that instantiate environments, and optimizes any robust objective averaged over this learned distribution. UAED yields adaptive variants of IRM, REx, GroupDRO, and CORAL without predefined groups or manual environment design. We provide a theoretical analysis by providing PAC-Bayes bounds and by showing robustness to test environment distributions under standard conditions. Empirically, UAED discovers interpretable environment distributions and improves worst-case accuracy on standard benchmarks, while remaining competitive on mean accuracy. Our results indicate that making environments adaptive is a practical route to out-of-distribution generalization.
BibTeX
@misc{matymov2025universal,
  author = {Madi Matymov and Ba-Hien Tran and Maurizio Filippone},
  title = {{Universal Adaptive Environment Discovery}},
  year = {2025},
  eprint = {2510.12547},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.12547},
}
Figure