Data Drift
Data drift is a change in the distribution of data a deployed model encounters, relative to a reference such as its training data or an earlier production period. The comparison can reveal that operating conditions have changed. It does not, by itself, establish that predictions have become less accurate or that retraining is the appropriate response.
The choice of reference determines the question being asked. Google Cloud’s Model Monitoring documentation distinguishes a production-to-training comparison, called training-serving skew in that context, from a comparison between production periods, called inference drift. Comparing with training requires a usable reference, which may be retained records or sufficient distribution summaries for the chosen measure. Losing the raw training data does not necessarily remove every possible comparison, but it limits analyses that need details the summaries did not preserve.
The term skew also has broader uses. Google’s Rules of Machine Learning discusses differences between training and serving performance arising from data changes, inconsistent processing, or feedback loops. Different transformations in training and serving are one cause, not a separate definition covering every case. The related training-serving skew entry explains that operational problem.
What a distribution change says about quality
A shift can leave quality unchanged, improve it, or make it worse. Suppose a classifier has an error rate of 5% in one customer segment and 20% in another. If the mix changes from equal proportions to 20% in the first segment and 80% in the second, its overall error rises from 12.5% to 17%, even though neither segment’s error rate changed. A stable relationship between inputs and outcomes therefore does not guarantee a stable aggregate score. Conversely, moving traffic between segments with the same error rate can leave that score unchanged.
Some changes are expected. Google’s Machine Learning Glossary uses seasonal swimsuit sales as an example of nonstationarity. Comparing different seasons can produce a real distribution difference without identifying a data defect. Whether the model handles that difference adequately depends on what it learned and the outcomes observed in the new period.
The reverse limitation matters too: stable input distributions do not guarantee stable quality. An upstream system might change the meaning of a status code while preserving its frequency. A detector comparing code counts would miss that semantic change. Even unchanged distributions for every individual feature do not guarantee that relationships between features are unchanged. Checks of schemas, units, joint behavior, and observed outcomes answer questions that a feature-by-feature distribution comparison cannot.
Which distribution changed?
Let X denote the inputs and Y the target outcome. P(X) describes the input distribution, P(Y) the outcome distribution, and P(Y|X) the outcome distribution conditional on the inputs. Distinguishing them makes the assumptions behind a diagnosis explicit.
| Pattern | Distribution and assumptions | Illustrative change | Implication |
|---|---|---|---|
| Covariate drift | Inputs P(X) change. Under the pure covariate-shift assumption, P(Y|X) remains stable | A loan model trained on incomes of 30–80k starts receiving applicants at 150k | Aggregate error can change with the mix. Predictions outside the training range need evaluation; extrapolation alone does not prove they are wrong |
| Label drift | Outcome frequencies P(Y) change. Pure label shift additionally assumes stable P(X|Y) | The fraud rate rises from 1% to 4% | A base-rate change warrants checking probability calibration and decision thresholds. The observed rate change alone does not establish the pure label-shift assumption |
| Concept drift | P(Y|X) changes | Legitimate senders increasingly use the phrase free gift, changing its relationship with spam | Previously learned probabilities can become inaccurate, but a changed probability need not cross a classification threshold or worsen every metric |
The stable conditional distributions in the pure-shift assumptions matter when choosing a correction. Lipton, Wang, and Smola’s study of label shift explicitly assumes stable inputs within each class while class proportions change. Real deployments can violate that assumption or exhibit several changes together. These patterns describe aspects of dataset shift; they are not mutually exclusive alarm categories. Input drift is directly observable without labels, whereas establishing a change in the input-to-outcome relationship needs evidence about outcomes or additional assumptions.
Choosing a comparison and interpreting its result
A drift measurement needs a reference population, a current population, and a measure of their difference. A training reference asks whether production resembles the data used to build the model. A recent production reference asks what changed since an earlier operating period. A rolling reference follows recent behavior but can absorb gradual changes, so baseline updates need to remain visible in the monitoring record.
Google Cloud’s Model Monitoring v2 objectives illustrate several comparison targets: input distributions, prediction distributions, and feature attributions. Its documented distribution metrics are L-infinity and Jensen-Shannon divergence for categorical values, and Jensen-Shannon divergence for numerical values; feature attribution uses SHAP values. Attribution changes describe a change in assigned feature contributions, not proof of an error. Comparisons also need a consistent model and explanation setup, or an explicit account of what changed between them.
Other approaches include a Kolmogorov–Smirnov test for numeric features, a chi-square test for categorical counts, and Jensen-Shannon or KL divergence between distributions estimated with chosen bins. Maximum mean discrepancy and classifier two-sample tests can compare multivariate samples, while text or image monitoring can compare embedding distributions. Their sensitivity depends on sample size, representation, and method configuration. A test may miss a consequential change, or detect a small difference that does not matter to the task.
Population stability index is another comparison of binned proportions. Cutoffs such as 0.1 or 0.2 do not establish a model’s fitness for use. Bin boundaries and smoothing affect the score, and sampling variation affects the estimated proportions. A threshold needs evaluation against both ordinary variation and changes the application must catch; a quiet historical period alone does not show that a detector will catch harmful shifts.
Repeated testing across many features creates more opportunities for false alarms. It does not guarantee an alert every day. Statistical error control, effect sizes, sample requirements, and the importance of affected features all inform alert design. Requiring persistence can reduce transient alerts but delays detection, so severe data-integrity failures may need immediate attention. A count of flagged features is not automatically a multiple-testing correction. These choices are developed in drift detection.
Interpreting drift when labels are incomplete
When representative outcomes arrive promptly and in sufficient numbers, accuracy, AUC, calibration, or task-specific loss provide direct evidence about quality. Distribution monitoring still helps diagnose a deterioration or detect an input problem before enough outcomes accumulate. It should complement those measurements rather than replace them.
Delayed outcomes leave a period in which input and prediction changes are early signals. Selective outcomes introduce a different problem: confirmed fraud labels may be concentrated among investigated transactions, so quality on that sample need not describe all transactions. Independent review can help obtain labels for additional cases when the target is ascertainable. Where a decision changes whether an outcome can occur, controlled evaluation may be needed to estimate policy effects; changing a decision does not reveal both potential outcomes for that individual. Proxy outcomes can help only within the limits of their assessed relationship to the target.
From an alert to a response
An investigation connects the measured change to its cause and impact. Checking recent schema, encoding, unit, join, and default-value changes is useful because these can corrupt inputs and make retraining inappropriate. Seasonality, market changes, and customer behavior are alternative explanations. These checks can proceed alongside quality evaluation; they are not a universal sequence that every incident must follow.
Compare quality on an appropriate cohort and inspect affected segments as well as the aggregate. A stable overall score can conceal a loss for one group. A small or selectively labeled sample may also fail to reveal deterioration. Evidence of stable quality supports continued operation within the population, period, and uncertainty assessed; it is not proof that every consequence of the shift is harmless.
The response follows the diagnosis. Repair corrupted inputs; evaluate recalibration or a threshold change when probability estimates or decision costs no longer fit; assess reweighting or additional training data when the population has changed; or test a model trained on recent examples. Rolling back a recent deployment requires checking that the previous version remains suitable. Continuing to monitor without changing the model is also reasonable when the available evidence supports that decision.
Google Cloud’s MLOps guidance identifies performance degradation and data changes as possible retraining triggers and includes data and model validation in automated pipelines. An alert may therefore launch automated evaluation or candidate training under defined checks. It does not, by itself, justify promoting the resulting model. Scheduling and validation are covered in continuous retraining.
The investigation needs to retain which baseline, model version, feature definitions, samples, and thresholds produced the alert, together with outcome coverage and the response taken. A monitoring pipeline connects that evidence across inputs, predictions, outcomes, and service behavior. Monitoring, Drift, and Retraining explains how those measurements inform ongoing model operation.
References
- Google Cloud, Introduction to Model Monitoring — skew, drift, and Model Monitoring v2 objectives
- Google, Machine Learning Glossary — Nonstationarity
- Google Cloud Architecture Center, MLOps: Continuous delivery and automation pipelines in machine learning
- Google, Rules of Machine Learning — Training-Serving Skew
- Zachary Lipton, Yu-Xiang Wang, and Alexander Smola, Detecting and Correcting for Label Shift with Black Box Predictors, ICML 2018
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
