Mandoline: Model Evaluation under Distribution Shift

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

Machine learning models often fail in production because the data they encounter in the "wild" differs from their training and validation data—a phenomenon known as distribution shift. MANDOLINE is a new framework designed to evaluate models under these conditions. By allowing practitioners to guide the evaluation using "slicing functions," MANDOLINE produces performance estimates up to 3x more accurate than standard statistical baselines.

The Challenge of Distribution Shift

To predict how a deployed model will perform, researchers typically use Importance Weighting (IW). The concept is straightforward: if a target dataset has twice as many blurry images as the source dataset, IW gives blurry validation images twice the weight. However, standard IW has two major vulnerabilities:

  1. The Curse of Dimensionality: Estimating weights in high-dimensional spaces (like raw pixels or text embeddings) is statistically noisy and prone to massive variance.
  2. Support Shift: If the target distribution contains data types that are completely absent from the source set, IW mathematically breaks down.

Furthermore, standard evaluation pipelines treat practitioners as passive observers. If a developer intuitively knows their model struggles with specific demographics or linguistic features (like negations), standard IW offers no principled way to incorporate that domain knowledge into the evaluation math.

Enter Mandoline: Slicing for Robust Evaluation

MANDOLINE addresses these issues by shifting the focus from raw, high-dimensional features to user-defined "slices."

Overview of the Mandoline framework showing how noisy slices are used to reweight source data and estimate target accuracy.
  • Slicing Functions: Users write simple binary functions (e.g., contains_word("not") or is_high_resolution) to group data along expected axes of shift. Crucially, these functions do not have to be perfect; they can be noisy, correlated, or incomplete.
  • Noise-Aware Density Ratio Estimation: MANDOLINE treats the "true" intended slice as a latent variable. It uses user-provided "correction matrices" (which act as confidence scores for the slices) to denoise the density ratios, utilizing a novel extension of the KLIEP (Kullback-Leibler Importance Estimation Procedure) algorithm.
  • Graphical Modeling: To handle overlapping or related slices (e.g., "male pronoun" and "man"), the framework uses a graphical model to represent dependencies, ensuring robust reweighting.

Key Insights

  • Human-in-the-loop Evaluation: By projecting complex data onto simple, interpretable slices, MANDOLINE makes the math of distribution shift tractable by leveraging human domain knowledge.
  • Dimensionality Reduction: Evaluating on slices rather than raw features acts as a targeted form of dimensionality reduction, taming the variance that typically breaks standard IW.
  • Robustness to Imperfection: Slices don't need to be perfect ground-truth metadata. Even noisy, programmatic heuristics significantly improve performance estimates.

Results and Performance

MANDOLINE was validated across diverse vision and NLP tasks, including CelebA (gender classification with blur shift), CivilComments (toxicity detection with demographic shifts), and Natural Language Inference (NLI) datasets.

Table comparing average estimation error across different methods on CelebA and CivilComments datasets.
  • Superior Accuracy: On the CelebA vision task, MANDOLINE reduced estimation error by 3x compared to the best baseline (CBIW), achieving an error rate of just 0.16%.
  • Handling Under-Specification: Even when users only identified a subset of the shifting variables, MANDOLINE still outperformed baselines by up to 2x.
  • Real-World Utility: In "in-the-wild" sentiment analysis, MANDOLINE closely estimated absolute performance drops of up to 23% accuracy points, where unadjusted validation scores would have been dangerously optimistic.
  • Model Selection: MANDOLINE achieved a Kendall-Tau score of 0.786 for model ranking, proving highly effective at identifying which candidate models will actually perform best post-deployment.

Limitations and Future Work

While highly effective, MANDOLINE has a few limitations that present opportunities for future research:

  • Slice Engineering: The framework's success relies on identifying the right "axes of shift." While some entropy-based slices can be automated, designing optimal slices remains an iterative, manual process.
  • Correction Matrix Estimation: Users must estimate slice quality ($\\sigma$ matrices). Automated confidence estimation would improve usability.
  • Concept Drift: MANDOLINE assumes the relationship between features and labels remains constant, focusing only on data distribution shifts. Handling "concept drift" (where the fundamental meaning of the labels changes) is a noted area for future work.

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