Monitoring and drift
Data drift, concept drift and the PSI alarm — how you find out a model has gone stale before your users tell you.
A model is a snapshot of a relationship, and the world does not hold still. The population that uses your product changes; a vendor redefines a column; a pandemic rewrites what "normal" means. Once a model is live, the question is no longer "how accurate is it?" but "is it still accurate, and how would I know?" Monitoring is the instrumentation that answers both.
The monitor below compares a reference distribution to an incoming one and computes the population stability index (PSI), the standard drift alarm. Shift the incoming mean or variance and watch PSI cross the usual 0.1 and 0.2 thresholds; the timeline shows the same signal arriving window by window.
Shift the incoming data and read the PSI — the standard drift alarm
grey = reference · accent = current · bins are z-score ranges
PSI = 0.593
drift — retrain
< 0.1 stable · 0.1–0.2 moderate · > 0.2 act
PSI per monitoring window · dashed line is the 0.2 alert threshold
PSI is just a symmetric divergence over binned proportions; it is a real calculation here, on synthetic normal draws. Production monitors also track the label distribution, prediction distribution and per-feature KS tests, because a feature can drift without the aggregate PSI moving — and because a shift in inputs is only concerning if it changes the decision.
Three things can go wrong, and only one is the model's fault
Data drift moves the inputs. Concept drift moves the relationship between inputs and the target. Upstream breakage changes the plumbing — a renamed column, a delayed feed, a units bug. All three degrade performance, and they need different responses, so name which one you are looking at before you retrain.
Measuring drift
For a single feature, the population stability index bins both distributions and sums a symmetric divergence:
with the conventional reading: below stable, – moderate shift worth investigating, above act. The KS test and the test serve the same purpose for continuous and categorical variables respectively. For the data as a whole, multivariate tests compare the full feature distribution, which matters because individually innocent shifts can combine into a changed input region.
There is a subtle line to hold: a feature can drift without hurting the model (the model may ignore it), and the model can degrade without any input drift at all (that is concept drift, visible only against labels). Input drift is an early, cheap warning; it is not the outcome.
What to monitor
- Service health — latency, error rate, throughput, and the fraction of requests whose inputs fail validation.
- Data quality — the pipeline tests from the data-engineering chapter, applied to the live feed.
- Prediction distribution — a sudden shift in the score distribution often signals an input problem before labels arrive.
- Feature drift — PSI or KS per input feature.
- Outcome and labels — accuracy, calibration, business metric, and subpopulation slices, once ground truth arrives.
Label delay is the practical trap: churn or default may only be known weeks after the prediction, so outcome metrics lag. Proxy and input signals are what keep you from flying blind in between.
Responding to drift
Retraining is not the only answer and often not the best one. The response ladder runs: investigate the data pipeline first, then recalibrate, then retrain on recent data, then consider a genuinely different model. A recurring seasonal pattern may need a model that encodes the season, not a fresh fit every cycle. And every response must be validated against the incumbent before it ships — an automatic retraining loop with no evaluation gate will eventually deploy a worse model on drifted data.
Careful
Alert fatigue is the failure mode of monitoring itself. A threshold that fires weekly gets ignored, and then the real incident is missed in the noise. Tie thresholds to the decision they trigger, distinguish warnings from pages, and track whether alerts led to action — an alert that never changes behaviour is a metric to delete, not a safety net.
Illustrative vs real
The artifact draws synthetic normal samples and computes a real PSI from them, with the drift-magnitude inputs under your control. Production monitoring runs per-feature tests on live data of unknown shape, deals with missing values and schema changes, and must distinguish signal from the ordinary week-to-week noise. The arithmetic is exact; the setting is a simplification.
Check yourself
Eduspheria wiki · Data, MLOps & Deployment, MLOps
0 / 5 answered
From the exam paper
Modeled on NITJ AI-511, End-Sem December 2024
0 / 5 answered
Where next: time series — the one setting where observation order is the whole problem, and a random train-test split is a mistake.