NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

On Calibration and Out-of-Domain Generalization

Yoav Wald, Amir Feder, Daniel Greenfeld, Uri Shalit

Executive Summary

This paper reveals a surprising and highly practical connection: training machine learning models to be well-calibrated across multiple training domains naturally forces them to drop spurious correlations, leading to better out-of-domain (OOD) generalization. The authors introduce practical methods to achieve this, including a novel regularization term called CLOvE, which significantly boosts OOD performance on real-world benchmarks without the optimization headaches of existing invariance methods.

The Challenge of Out-of-Domain Generalization

Machine learning models are notorious for failing when deployed in new environments (out-of-domain or OOD). This usually happens because models latch onto "spurious correlations"—features that predict the label in the training data but do not hold true in the real world. For example, a model might predict a tumor based on a hospital-specific watermark on an X-ray rather than the actual pathology.

Causal graphs illustrating the relationships between environment, causal features, and spurious features.

Recently, researchers have tried to solve this by learning "invariant representations" (like Invariant Risk Minimization, or IRM), which force the model to only use features whose relationship with the label remains constant across different training environments. However, these methods are notoriously difficult to optimize and often fail to scale to high-dimensional, real-world data. This paper asks: is there a simpler, more observable property we can optimize to guarantee a model isn't relying on spurious correlations?

Multi-Domain Calibration as a Solution

The authors propose multi-domain calibration as a surrogate for invariant representation. A model is calibrated if its predicted probabilities match the true real-world frequencies (e.g., of all predictions where the model says "90% chance of rain," it actually rains 90% of the time).

To leverage this concept, the paper introduces several key components:

  1. Theoretical Foundation: The authors mathematically prove that in linear-Gaussian settings, if a model is perfectly calibrated across multiple distinct training environments, it cannot be relying on spurious features.
  2. Model Selection: Because OOD performance is hard to measure without OOD data, they propose using the average Expected Calibration Error (ECE) across in-domain training environments as a metric to select the best generalizing models.
  3. Post-Processing (Robust Calibration): They extend standard Isotonic Regression to a multi-domain setting, creating a convex optimization step that minimizes the worst-case miscalibration across all training environments.
  4. Training Objective (CLOvE): They introduce Calibration Loss Over Environments (CLOvE). This is a regularization term added to the training loss that directly penalizes calibration errors across multiple domains using a kernel-based metric called Maximum Mean Calibration Error (MMCE).

Key Insights

Calibration implies invariance: The core insight is that if a feature's correlation with a label changes between Hospital A and Hospital B, a model relying on that feature will output probabilities that are miscalibrated in at least one of those hospitals. Therefore, enforcing simultaneous calibration across both hospitals forces the model to drop that unstable feature.

IRMv1 misses what calibration catches: In a simplified "Two-Bit" environment, the popular IRMv1 objective actually fails to find the true invariant solution because of optimization shortcuts. Multi-domain calibration (CLOvE), however, successfully discards the spurious correlation and finds the optimal model.

In-domain calibration predicts OOD success: Model selection is a massive pain point in OOD generalization. The authors show a strong negative correlation between in-domain ECE and OOD accuracy. Simply picking the model with the best in-domain calibration is a highly effective strategy for OOD deployment.

Scatter plots demonstrating that in-domain Expected Calibration Error (ECE) is a strong predictor of OOD accuracy, unlike the IRMv1 penalty.

Experimental Results

The authors evaluate their methods on both synthetic datasets (Colored MNIST) and real-world distribution shift datasets from the WILDS Benchmark (including FMoW, Camelyon17, PovertyMap, and CivilComments).

  • Massive OOD Accuracy Gains: Fine-tuning models with the CLOvE regularizer improved OOD accuracy by >10% (absolute) on the FMoW dataset and >6% (absolute) on Camelyon17 compared to standard Empirical Risk Minimization (ERM).
  • Post-processing works (mostly): Even without retraining, simply applying their "Robust Calibration" post-processing to standard models improved OOD performance by ~4.5% on FMoW and ~4.5% on Camelyon17.
  • Stability: Models trained with CLOvE exhibited lower variance in performance across different random seeds compared to uncalibrated baselines.
  • Model Selection: On Colored MNIST, ID ECE showed a near-perfect correlation (Pearson r = -0.92) with OOD accuracy, proving it to be a vastly superior model selection metric compared to the IRMv1 penalty (r = -0.59).

Limitations and Future Work

The mathematical proofs guaranteeing that calibration removes spurious correlations are currently limited to linear models operating on Gaussian data in a population setting (assuming infinite data). Furthermore, while post-processing (Robust Calibration) helps, it cannot recover information if the underlying base model has already completely discarded invariant features in favor of spurious ones during training. Future work will likely expand these theoretical proofs to finite-sample settings and non-linear models like deep neural networks, further bridging the gap between calibration and OOD generalization.

Summary updated

BibTeX
@inproceedings{wald2021calibration,
  author = {Yoav Wald and Amir Feder and Daniel Greenfeld and Uri Shalit},
  title = {{On Calibration and Out-of-Domain Generalization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=XWYJ25-yTRS},
}
Figure