When a machine learning model that worked perfectly in the lab starts failing in the real world, the standard response is often a frustrated "the data shifted." But "distribution shift" is a broad umbrella. Did the relationship between features and labels change? Did the demographics of the users shift? Or did a sensor start producing noisier data?
In their ICML 2023 paper, Zhang et al. move beyond simply detecting shift to attributing it. They provide a framework to answer: "Which specific part of the data-generating process is responsible for our model’s performance degradation?"
TL;DR
The authors propose a method to attribute changes in model performance to shifts in specific causal mechanisms. By combining causal graphical models with Shapley values and importance sampling, they can quantify exactly how much each part of the data pipeline (e.g., a specific feature's distribution or a labeling process) contributed to a drop in accuracy or an increase in error.
What Problem Does This Paper Address?
Machine learning models are rarely static; they exist in dynamic environments where the underlying data distribution ($D$) changes between training (source) and deployment (target). While we have many tools to detect if a shift happened, we lack principled ways to explain why that shift hurt the model.
Existing methods often focus on the shift in the joint distribution itself (e.g., measuring KL-divergence). However, a massive shift in a variable the model doesn't rely on might have zero impact on performance, while a tiny shift in a critical feature could be catastrophic. This paper fills the gap by focusing specifically on performance-relevant attribution.
Methods
The authors frame attribution as a cooperative game played by causal mechanisms.
- Causal Factorization: They assume the data-generating process follows a known Directed Acyclic Graph (DAG). This allows the joint distribution to be broken down into independent "mechanisms" (conditional distributions like $P(\text{Feature} | \text{Parents})$).
- The Game Theory Approach: Each mechanism is a "player" in a game. The "value" of a group (coalition) of players is the change in model performance if only those specific mechanisms shifted from the source to the target distribution.
- Shapley Values: To fairly distribute the total performance drop among these mechanisms, they calculate Shapley values. This ensures that if two shifts interact (e.g., a change in age distribution combined with a change in how age affects health), the credit/blame is assigned fairly.
- Importance Sampling: A key technical hurdle is estimating model performance on "hybrid" distributions (where some parts are from the source and some from the target). The authors use an importance sampling approach, training probabilistic classifiers to estimate density ratios. This allows them to estimate performance changes without needing to collect new "hybrid" datasets or retrain the model.
Datasets
The authors validated their method across a diverse range of modalities:
- Synthetic Tabular Data: Used to verify the math against known ground-truth shifts.
- ColoredMNIST: A classic "spurious correlation" benchmark where the model might rely on digit color instead of shape.
- CelebA: High-dimensional facial images used to test attribution to complex attributes (e.g., "Wearing Lipstick" vs. "Smiling").
- eICU Collaborative Research Database: Real-world clinical data used for a mortality prediction case study.
- Camelyon17: A histopathology image dataset used to attribute performance drops across different hospital sites.
Key Insights and Ideas
- Performance vs. Distribution Shift: The most important "aha" moment is that attributing a change in distribution is not the same as attributing a change in performance. Their method prioritizes the latter, ignoring shifts that the model is robust to.
- Actionability: By identifying the specific mechanism, the method suggests a cure. If the shift is in $P(\text{Age})$, you collect more diverse data. If it's in $P(\text{Outcome} | \text{Vitals})$, you might need to retrain the model or rethink your features.
- Succinctness through Causality: Using a causal graph prevents "blame bloat." If a root variable shifts, all its descendants will also show a distribution shift. A purely statistical method might blame all of them; this causal method correctly pinpoints the root variable as the culprit.
Key Results
- Actionable Clinical Insights: In the eICU study, the model’s Brier score (a measure of error) increased when moving from Midwest to South hospitals. The method attributed 29.5% of this drop to a shift in the age distribution. By performing "targeted data collection" (adding more older patients to the training set), the researchers reduced the performance drop by 36.6%, outperforming naive retraining.
- Identifying Spuriousness: In ColoredMNIST, the method correctly identified when the model was failing because the spurious correlation (color) it relied on had vanished in the target set.
- Robustness to Misspecification: Even when the causal graph was slightly wrong (e.g., using a fully connected graph), the method still provided more meaningful results than standard baselines, though the attributions were less "succinct."
Limitations and Future Work
- The Causal Requirement: The biggest hurdle is the assumption of a known causal graph. In many real-world scenarios, the exact DAG is unknown or debated.
- Hidden Confounders: The current framework assumes all relevant variables are observed. If a hidden variable causes the shift, the attribution might be misleading.
- Importance Sampling Variance: Like all importance sampling methods, the estimates can become high-variance if the source and target distributions have very little overlap (the "weight explosion" problem).
The authors suggest that future work could involve integrating causal discovery to learn the graph from data and extending the framework to unsupervised or reinforcement learning settings.
Summary updated