Does Invariant Risk Minimization Capture Invariance?

Pritish Kamath, Akilesh Tangella, Danica J. Sutherland, Nathan Srebro

Abstract

We show that the Invariant Risk Minimization (IRM) formulation of Arjovsky et al. (2019) can fail to capture "natural" invariances, at least when used in its practical "linear" form, and even on very simple problems which directly follow the motivating examples for IRM. This can lead to worse generalization on new environments, even when compared to unconstrained ERM. The issue stems from a significant gap between the linear variant (as in their concrete method IRMv1) and the full non-linear IRM formulation. Additionally, even when capturing the "right" invariances, we show that it is possible for IRM to learn a sub-optimal predictor, due to the loss function not being invariant across environments. The issues arise even when measuring invariance on the population distributions, but are exacerbated by the fact that IRM is extremely fragile to sampling.

Introduction

Standard machine learning relies on Empirical Risk Minimization (ERM), which assumes the training and test data come from the same distribution. However, models often "cheat" by picking up on spurious correlations—shortcuts that work in the training set but fail in the real world (e.g., identifying a "camel" based on the presence of sand rather than the animal's shape).

Invariant Risk Minimization (IRM) was proposed to solve this by finding a data representation where the optimal predictor is the same across multiple training "environments." If a correlation is truly "invariant," it should hold up everywhere. This paper, presented at AISTATS 2021, asks a critical question: Does the practical implementation of IRM actually deliver on this promise?

The "Linear Trap" and Pseudo-Invariance

The authors demonstrate that the practical, linear version of IRM (IRMv1) frequently fails to find truly invariant features, even on simple toy problems. They introduce the "Two-Bit" environment, a synthetic dataset with binary features, to prove that IRM's failures are fundamental to the objective function itself rather than deep learning complexity.

Geometric representation of the IRMv1 constraint in the Two-Bit environment. The ellipses represent the set of predictors that satisfy the IRMv1 constraint for different environments. The intersection points, such as $f_{IRM}$, illustrate how the algorithm can converge to "pseudo-invariant" solutions that do not capture the true underlying mechanism.

IRMv1 assumes a linear relationship between the representation and the label. The authors prove that this "linear relaxation" creates a massive loophole. In their Two-Bit test, IRMv1 found "invariant" solutions that actually relied more on spurious features than standard ERM did, leading to poor generalization.

Invariant Predictors vs. Invariant Loss

Even if IRM finds a truly invariant predictor, it might pick the "wrong" one. If one environment has more noise than another, the loss (error) won't be invariant. IRM might choose a predictor that is mathematically "stable" but consistently mediocre, rather than one that is actually correct. This highlights a significant gap between the "ideal" IRM (a complex bi-level optimization problem) and the practical gradient-based penalty used in IRMv1.

Empirical Results and Fragility

The theoretical shortcomings of IRMv1 translate into poor empirical performance. The authors show that IRM is extremely fragile to sampling; even tiny amounts of noise in finite samples can make the set of "invariant" solutions empty, causing the algorithm to collapse and output a "null" predictor (guessing the average).

Test loss comparison between ERM (blue) and IRMv1 (orange) across different training and test environment configurations. The results show that IRMv1 often fails to outperform ERM and can exhibit significantly higher variance in test performance.

In the Two-Bit environment, the authors found cases where ERM had a test loss of 0.28, while the practical IRMv1 had a much higher loss of 0.38. On benchmarks like Colored-MNIST, IRMv1 often failed to outperform a model that ignores the input entirely when training environments weren't perfectly tuned.

Conclusion and Future Work

While the goal of IRM remains vital for robust machine learning, this work provides a sobering reality check. The practical IRMv1 is essentially a different algorithm than the "ideal" IRM, prone to picking up "pseudo-invariances." Future research should focus on developing non-linear IRM variants, improving robustness to sampling noise (e.g., "$ε$-IRM"), and establishing better model selection criteria to distinguish between multiple invariant predictors.

Summary updated

BibTeX
@inproceedings{kamath2021does,
  author = {Pritish Kamath and Akilesh Tangella and Danica J. Sutherland and Nathan Srebro},
  title = {{Does Invariant Risk Minimization Capture Invariance?}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2021},
  url = {https://openreview.net/forum?id=dKv6hAwcwO},
}
Figure