Sub topic 2
Data drift, label drift, and concept drift
This chapter assumes you know the train, validate, test, deploy workflow and basic NumPy. It also assumes you have seen a model served in batch or online. It does not cover detection statistics. The PSI and KS test come in a later chapter.
Why the distinction matters
A deployed model is a fixed function learned from a past sample. Production data keeps changing, so you need to know which part of the world changed. The three kinds of drift call for different monitors, different triggers, and sometimes different fixes. Retraining on new data repairs some kinds of drift. For others it only helps if the new data contains fresh labels.
The three kinds of drift
Treat the data as a joint distribution of inputs X and outcomes Y. It factors as P(X, Y) = P(Y | X) · P(X). Each kind of drift is a change in one part of that expression.
Data drift (covariate shift)
Data drift means P(X) changes while the rule connecting X to Y stays the same. Examples are a new customer segment, a changed upstream unit (dollars to cents), or a marketing campaign that brings in younger users.
- The model's rule is still correct. Its accuracy may stay the same.
- It can still hurt if inputs move into regions the training data barely covered, where the model extrapolates badly.
- You can detect it without labels, which makes it the cheapest signal to monitor.
Label drift (prior shift)
Label drift means P(Y) changes. Examples are fraud rates rising during a holiday season, or a disease becoming more common.
- A model tuned for a 2% positive rate gives miscalibrated probabilities at 8%.
- Decision thresholds chosen for the old base rate become wrong, even if the model ranks examples well.
- It often appears as a side effect of data drift. If the inputs shift toward the positive region, the positive rate rises with them.
- Measuring it directly requires labels. The predicted-positive rate is a label-free proxy.
Concept drift
Concept drift means P(Y | X) changes. The same inputs now lead to different outcomes. Examples are fraudsters adapting to your rules, a pandemic changing what a "normal" purchase looks like, or a new competitor changing which customers churn.
- The model's learned rule is wrong. This is the most damaging kind.
- Input monitoring alone can miss it, because P(X) may look unchanged.
- It can only be confirmed with labels.
Concept drift also has a shape over time:
| Shape | What happens | Example |
|---|---|---|
| Sudden | The relationship flips at one point | A policy change or a pricing change |
| Gradual | Old and new relationships mix for a while | A new product slowly replaces an old one |
| Incremental | The relationship moves in small steps | Slow shifts in user taste |
| Recurring | An old relationship returns | Seasonal buying patterns |
Recurring drift is a warning against trusting only the latest data. A model retrained in January on a window of December data may be wrong in July.
Seeing the difference in code
This simulation uses a fixed model that predicts "positive" when x is above 0. It runs on three scenarios. Only the third changes the relationship between x and y.
import numpy as np
rng = np.random.default_rng(42)
def sample(n, mu=0.0, boundary=0.0, slope=3.0):
"""Draw x ~ Normal(mu, 1); y depends on x through a logistic curve."""
x = rng.normal(mu, 1.0, n)
p = 1.0 / (1.0 + np.exp(-slope * (x - boundary)))
y = rng.random(n) < p
return x, y
def report(name, x, y):
pred = x > 0.0 # the "model", frozen at training time
print(f"{name:<18} mean_x={x.mean():5.2f} "
f"pos_rate={y.mean():4.2f} accuracy={(pred == y).mean():4.2f}")
report("baseline", *sample(20_000))
report("data drift", *sample(20_000, mu=1.5))
report("concept drift", *sample(20_000, boundary=1.0))Read the three rows this way:
- Baseline gives the reference accuracy.
- Data drift moves
mean_xand raisespos_rate. Accuracy stays about the same or improves, because the ruley ~ xis unchanged and more points sit far from the boundary. An input monitor fires, and a performance monitor does not. - Concept drift leaves
mean_xnear 0, so an input monitor stays quiet. The positive rate falls and accuracy drops. Only outcome monitoring catches this.
Note that the data drift row also shows label drift. The positive rate moved because the inputs moved. In real systems you will often see several of the three together, and you must separate them with the monitors that apply to each.
What each drift means for retraining
| Drift | Detectable without labels? | Does retraining help? | Main signal |
|---|---|---|---|
| Data drift | Yes | Often, if the new region needs coverage. Not needed if accuracy holds. | Input distribution tests |
| Label drift | Partly (predicted-positive rate) | Recalibrating or moving the threshold may be enough. | Outcome rate, calibration |
| Concept drift | No | Yes, but only with recent labeled data. | Performance on labeled outcomes |
Two consequences follow for pipeline design.
- Retraining without fresh labels cannot fix concept drift. If the pipeline retrains on the same old labels plus new unlabeled inputs, the model keeps the old relationship. The pipeline needs a path that delivers recent ground truth.
- Label delay hides concept drift. If outcomes arrive 60 days after prediction, concept drift in the last two months is invisible to performance monitoring. Until labels arrive, input and prediction monitors are your only early warning.
Common errors
- Treating any input drift as a failure. Seasonal and expected shifts will trip alarms constantly. Compare against a reference that matches the season, or require a performance signal as well.
- Assuming a stable input distribution means a healthy model. Concept drift can leave inputs untouched.
- Using a stale reference window. Comparing production against the original training set forever makes every long-lived model look drifted. Decide when the reference resets, for example after each promotion.
- Mixing up the label and the prediction. The distribution of predictions is a model output and can shift for any of the three reasons. It is a useful proxy, not a measurement of label drift.
- Retraining on the drifted window only. For recurring drift, this discards patterns the model will need again. Consider keeping a longer history or weighting recent data.
Exercise
A fraud model's inputs (amount, merchant category, device type) show no distribution change for three months, but chargeback reports confirm precision has fallen sharply. Which kind of drift is most likely, why did input monitoring miss it, and what must the retraining pipeline have access to in order to fix it?
Show answer
Concept drift. Fraudsters changed their behavior so that the same kinds of transactions now have a different fraud probability, which changes P(Y | X) while P(X) stays the same. Input distribution tests only look at P(X), so they cannot see it. The pipeline needs recent labeled outcomes (confirmed chargebacks) in its training data. Retraining on old labels would reproduce the old rule.
Exercise
Your positive rate in production rises from 2% to 6%, and the model's ranking quality (AUC) is unchanged. Name the drift and name one cheaper fix than a full retrain.
Show answer
Label drift (prior shift). Because the ranking is unchanged, you can recalibrate the output probabilities or adjust the decision threshold for the new base rate instead of retraining the whole model.