Mandoline: Model Evaluation under Distribution Shift

Mayee F. Chen, Karan Goel, Nimit Sharad Sohoni, Fait Poms, Kayvon Fatahalian, Christopher Ré

Abstract

Machine learning models are often deployed in different settings than they were trained and validated on, posing a challenge to practitioners who wish to predict how well the deployed model will perform on a target distribution. If an unlabeled sample from the target distribution is available, along with a labeled sample from a possibly different source distribution, standard approaches such as importance weighting can be applied to estimate performance on the target. However, importance weighting struggles when the source and target distributions have non-overlapping support or are high-dimensional. Taking inspiration from fields such as epidemiology and polling, we develop Mandoline, a new evaluation framework that mitigates these issues. Our key insight is that practitioners may have prior knowledge about the ways in which the distribution shifts, which we can use to better guide the importance weighting procedure. Specifically, users write simple "slicing functions" - noisy, potentially correlated binary functions intended to capture possible axes of distribution shift - to compute reweighted performance estimates. We further describe a density ratio estimation framework for the slices and show how its estimation error scales with slice quality and dataset size. Empirical validation on NLP and vision tasks shows that Mandoline can estimate performance on the target distribution up to 3x more accurately compared to standard baselines.

Introduction

Machine learning models are notorious for failing when deployed in environments that differ from their training data—a phenomenon known as distribution shift. To predict how a model will actually perform, practitioners often use Importance Weighting (IW). If you have labeled data from a source (e.g., a lab dataset) and unlabeled data from a target (e.g., live user data), IW tries to reweight the source examples to look like the target.

However, standard IW breaks down in two major ways:

  1. The Curse of Dimensionality: In high-dimensional spaces (like images or text), the variance of the weights explodes, leading to erratic and unreliable estimates.
  2. Support Shift: If the target distribution contains types of data that simply do not exist in the source (non-overlapping support), standard IW mathematically fails to provide an answer.

Mandoline seeks to put the "expert in the loop," leveraging their intuition about how the data is shifting to guide the estimation process through a more robust framework.

The Mandoline Framework

The core innovation of Mandoline is the use of Slicing Functions. Instead of performing density ratio estimation on raw, high-dimensional features, Mandoline performs it on a set of discrete "slices" defined by the user.

Overview of the Mandoline framework, illustrating how noisy slicing functions are used to reweight source data for target performance estimation.

Key Components

  • User-Guided Slices: Users write simple, potentially noisy binary functions to group data (e.g., "Does this sentence contain a negation?" or "Is this image blurry?"). These slices act as a low-dimensional proxy for the distribution shift.
  • Graphical Model for Noise: Because human-written heuristics are often correlated or imperfect, Mandoline represents the slices using a probabilistic graphical model (specifically, an Ising-like model). This allows the system to account for dependencies between slices.
  • Noise-Aware KLIEP: The framework extends the standard Kullback-Leibler Importance Estimation Procedure (KLIEP) to be "noise-aware." By using user-provided "correction matrices" (which describe how often a slice heuristic is wrong), Mandoline can denoise the density ratios.
  • Reweighting: Finally, these denoised ratios are used to calculate a weighted average of the model's performance on the labeled source data, providing a robust estimate for the target.

Experimental Evaluation

The authors validated Mandoline across a variety of synthetic and real-world tasks, ranging from image classification to natural language inference. These experiments tested the framework's ability to handle different types of shifts, such as changes in image quality or demographic proportions.

Summary of experimental tasks, distribution shifts, and the specific slicing functions used for evaluation.

Key Results

  • Superior Accuracy: Mandoline consistently outperformed standard baselines like Classifier-Based Importance Weighting (CBIW) and Kernel Mean Matching (KMM). On the CelebA task, it reduced estimation error by 3x compared to the best baseline.
  • Robustness to Noise: Even when slicing functions were intentionally made noisy, Mandoline’s performance remained stable, whereas noise-unaware methods degraded quickly.
  • Real-World Utility: In the IMDB-to-Twitter shift, Mandoline accurately predicted a massive 23-point drop in model accuracy, demonstrating its value for "in-the-wild" monitoring.

Insights and Discussion

Mandoline demonstrates that slices act as a powerful form of dimensionality reduction. By projecting complex data onto a few meaningful slices, the framework bypasses the variance issues of high-dimensional IW. Furthermore, while raw features might not overlap between source and target, the slices almost always do, allowing Mandoline to provide estimates in scenarios where standard IW is mathematically undefined.

A major finding is that slices do not need to be perfect. The framework is designed to handle noisy, correlated, and incomplete slices, meaning practitioners can use "quick and dirty" regex or metadata labels effectively. Users can even use the model's own internal states (like prediction entropy) as slices to detect where the model is becoming "confused" by the shift.

Limitations

Mandoline's accuracy depends on the user identifying the correct axes of shift. If the distribution shifts along a dimension the user did not create a slice for (a "hidden" property), the estimate will remain biased. Future work may involve integrating automated "slice discovery" tools to mitigate this dependency on manual definition.

Summary updated

BibTeX
@inproceedings{chen2021mandoline,
  author = {Mayee F. Chen and Karan Goel and Nimit Sharad Sohoni and Fait Poms and Kayvon Fatahalian and Christopher Ré},
  title = {{Mandoline: Model Evaluation under Distribution Shift}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=PwF5JWp1itH},
}
Figure