Heterogeneous Risk Minimization

Jiashuo Liu, Zheyuan Hu, Peng Cui, Bo Li, Zheyan Shen

Machine learning models trained with Empirical Risk Minimization (ERM) often suffer from poor generalization when deployed in the real world. This performance drop typically occurs because models greedily exploit spurious correlations—patterns that hold true in the training data but disappear or change in the testing environment.

To address this, researchers developed Heterogeneous Risk Minimization (HRM), a framework designed to build machine learning models that remain stable even when the data distribution shifts. Crucially, HRM achieves out-of-distribution (OOD) generalization without requiring manual "environment labels," a common bottleneck in previous invariant learning methods.

The Problem: Spurious Correlations and Unlabeled Heterogeneity

Standard machine learning relies on the assumption that training and testing data are independent and identically distributed (IID). In practice, data is often pooled from multiple, heterogeneous sources (e.g., different hospitals, different demographics).

While Invariant Risk Minimization (IRM) can learn robust predictors by finding features that hold stable across different environments, it requires knowing exactly which data points belong to which environment. In modern datasets, this underlying structural heterogeneity is rarely labeled. Without these environment labels, traditional invariant learning fails.

The HRM Framework

HRM solves this by jointly and iteratively discovering the latent heterogeneity (hidden groups) within a dataset and learning a predictor that relies only on relationships invariant across those discovered groups. The framework consists of two modules operating in a reciprocal loop:

The HRM framework relies on a reciprocal loop between a clustering module and a prediction module.
  1. Heterogeneity Identification ($\mathcal{M}_c$): This module acts as a specialized clustering algorithm. Instead of clustering based on raw feature similarity, it clusters data based on the relationship between features and the target label. It specifically uses the variant (unstable) features to split the data into distinct "environments" that are as statistically different as possible.
  2. Invariant Prediction ($\mathcal{M}_p$): This module takes the environments discovered by $\mathcal{M}_c$ and learns an invariant predictor. It applies a variance penalty to ensure stable performance across all discovered environments and uses a "soft" feature selection mask to separate invariant features ($\Phi$) from variant features ($\Psi$).

The Reciprocal Loop: These modules mutually improve each other. Better environment splits make it easier to isolate invariant features. Conversely, better identification of invariant features clarifies the "variant" noise, allowing $\mathcal{M}_c$ to create even more challenging and useful environment splits.

Key Insights

  • The Circular Dependency: Identifying variant features requires distinct environments, but defining environments requires knowing which features are variant. HRM elegantly resolves this through joint optimization.
  • Diversity over Quantity: Theoretical findings in the paper suggest that simply adding more data or more environments does not improve robustness unless those environments are diverse enough to tightly constrain the set of invariant features.
  • Clustering on the "Variant" Part: Clustering using the unstable parts of the data is mathematically proven to be more effective at pulling environment centers apart than clustering on the entire feature set, leading to superior OOD performance.

Experimental Results

The authors validated HRM across synthetic scenarios (Selection Bias, Anti-causal Effects) and real-world datasets (Car Insurance, Adult Income, King County House Prices).

  • Superiority over Baselines: In multiple tests, HRM outperformed standard IRM, even when IRM was provided with ground-truth environment labels. This suggests HRM's dynamically discovered environments are often more theoretically optimal for learning invariance than human-defined ones.
  • Unprecedented Stability: In selection bias experiments, while ERM's accuracy plummeted as spurious correlations shifted between training and testing, HRM's performance remained remarkably stable.
HRM maintains high accuracy during testing even as spurious correlation strength shifts, whereas ERM and IRM degrade significantly.
  • Real-World Robustness: On the House Price dataset, which features temporal distribution shifts (training on older sales, testing on newer ones), HRM achieved the lowest Root Mean Square Error (RMSE) across all test periods.

Limitations and Future Directions

While highly effective, the current HRM framework focuses primarily on raw feature selection in linear or simple settings. Extending this approach to complex deep representation learning—where features are learned from scratch—is a critical next step. Additionally, while the clustering module ($\mathcal{M}_c$) performs well empirically, formal theoretical guarantees for its convergence remain an open area for future research.

Summary updated

BibTeX
@inproceedings{liu2021heterogeneous,
  author = {Jiashuo Liu and Zheyuan Hu and Peng Cui and Bo Li and Zheyan Shen},
  title = {{Heterogeneous Risk Minimization}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=4pie6J-jQu},
}
Figure