Environment Diversification with Multi-head Neural Network for Invariant Learning

Bo-Wei Huang, Keng-Te Liao, Chang-Sheng Kao, Shou-De Lin

Machine learning models often rely on Empirical Risk Minimization (ERM), which assumes that training and testing data come from the same distribution. However, real-world data is frequently riddled with spurious correlations—misleading patterns that predict labels in the training set but fail in the real world (e.g., identifying a "cow" based on a green grass background rather than the animal's features).

To address this, researchers introduced EDNIL (Environment Diversification with multi-head neural Network for Invariant Learning) at NeurIPS 2022. EDNIL is an unsupervised invariant learning framework that uses a multi-head neural network to automatically discover and diversify data "environments," allowing models to ignore misleading biases and generalize significantly better to unseen, out-of-distribution data.

The Challenge of Invariant Learning

Invariant Risk Minimization (IRM) was proposed to solve the spurious correlation problem by finding features that remain "invariant" across different environments. The catch is that IRM usually requires "environment labels"—human-provided metadata detailing which data came from which source. In practice, these labels are rarely available.

Existing unsupervised methods attempt to find these environments automatically but often require "delicate initialization." They typically only work if you start with a specific type of biased model, and they can be too computationally expensive for modern deep learning architectures.

The EDNIL Framework

The authors propose a joint optimization framework consisting of two main components that undergo an alternating update process:

The EDNIL framework featuring an alternating update between the Environment Inference Model and the Invariant Learning Model.
  1. Environment Inference Model ($M_{EI}$): This is a multi-head neural network. Instead of a single output, it features multiple "heads," each attempting to model a different data environment. It uses three specific losses to ensure these discovered environments are useful:
  2. Environment Diversification Loss ($L_{ED}$): Forces the different heads to capture diverse, non-overlapping spurious relationships.
  3. Label Independency Loss ($L_{LI}$): Prevents the model from simply using the target label as the environment label (a common failure mode).
  4. Invariance Preserving Loss ($L_{IP}$): Uses feedback from the learning model to ensure that the "invariant" (useful) features are not accidentally used to define the environments.
  5. Invariant Learning Model ($M_{IL}$): This model takes the environment labels generated by $M_{EI}$ and performs standard invariant learning (like IRM) to extract features that work across all discovered environments.

Unlike previous methods, EDNIL is unsupervised (requiring no manual environment labels), insensitive to initialization, and efficient enough to scale to large models.

Key Insights and Results

The authors evaluated EDNIL across several benchmarks with varying types of bias, including Adult-Confounded, Colored MNIST (CMNIST), Waterbirds, and Stanford Natural Language Inference (SNLI).

Diversity is the Antidote to Bias

The core insight of EDNIL is that to find what is invariant, you must first maximize the diversity of the biases you observe. By forcing the multi-head network to find the most diverse ways to be "wrong" (spurious), the invariant model can more easily isolate what remains "right" (causal).

Breaking the Initialization Trap

Previous methods like EIIL were notoriously finicky; if the initial model wasn't biased in a very specific way, the entire process failed. EDNIL’s multi-head structure and diversification loss make it significantly more stable across different starting conditions.

EDNIL demonstrates robust performance regardless of the initial ERM training steps, avoiding the initialization trap that plagues methods like EIIL.

As shown in the robustness evaluations, while EIIL's performance varies wildly depending on how many training steps the initial model took, EDNIL remains stable and high-performing regardless of the starting point.

Performance Highlights

EDNIL consistently outperformed other unsupervised methods and often approached the performance of "Oracle" models (models given perfect human-labeled environment data):

  • Waterbirds: In the "worst-case" scenario (e.g., waterbirds on land), EDNIL achieved 78.6% accuracy, significantly beating ERM (72.8%) and the previous state-of-the-art unsupervised method, EIIL (68.6%).
  • CMNIST: Under extreme noise (0.9), EDNIL reached 75.2% accuracy, matching the performance of IRM with perfect environment labels, while standard ERM plummeted to 21.7%.

Limitations and Future Work

While highly effective, EDNIL has a few limitations. The inference algorithm relies on a specific graphical model of how data is generated; if a dataset's bias structure fundamentally violates this assumption, EDNIL might struggle. Additionally, while more robust than its predecessors, EDNIL introduces two new hyperparameters ($\beta$ and $\gamma$) that control the strength of the diversification and independence losses, requiring empirical tuning. Finally, providing rigorous theoretical guarantees for its performance on diverse datasets remains an open challenge for future research.

Summary updated

BibTeX
@inproceedings{huang2022environment,
  author = {Bo-Wei Huang and Keng-Te Liao and Chang-Sheng Kao and Shou-De Lin},
  title = {{Environment Diversification with Multi-head Neural Network for Invariant Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=FDmIo6o09H},
}
Figure