Sub topic 15
Responding to drift: investigate, retrain or roll back
This chapter assumes you can already compute drift scores (KS, chi-square, PSI), you have data quality checks in place, and you know how your team deploys and versions models. It covers what to do after an alert fires.
Triage before you act
A drift alert says the inputs or predictions changed. It does not say why, or whether the model is hurt. Retraining on the first alert is a common mistake. If the cause is a broken pipeline, retraining teaches the model the broken data.
Work through the causes from cheapest to most expensive to fix:
- Pipeline or schema fault, such as a renamed column, a unit change, or a new default value for missing data.
- A recent deployment of the model, a feature, or upstream code.
- A real change in the population or the world.
- A change in the relationship between features and target (concept drift).
Investigate
Start with the features that drifted most. Check whether the shift lines up in time with a release, an upstream schema change, or a seasonal event. Slice the data by segment, such as region or device, because drift often sits in one slice while the overall score looks mild. Compare drifted features with the model's most important features. Drift in a feature the model barely uses rarely matters.
If labels are delayed, use proxy signals such as prediction drift, confidence scores, or the business metric that follows the prediction. Treat them as hints, not proof.
Choose a response
| Situation | Response | Reason |
|---|---|---|
| Inputs are malformed | Fix the pipeline, then backfill | The model is fine. The data is wrong. |
| Drift began right after a release | Roll back | It is fast and reversible, and it restores a known state. |
| Real shift and performance dropped | Retrain on recent data | The model must learn the new population or relationship. |
| Drift without a performance drop | Watch and document | Retraining adds cost and risk for no measured gain. |
| Concept drift and retraining does not help | Redesign features or the task | New data cannot fix a missing signal. |
Encode the playbook
Writing the rules as code makes the response consistent and testable. The function below follows the diagram.
def triage(data_quality_ok, performance_dropped, recent_deploy):
if not data_quality_ok:
return "fix_pipeline"
if not performance_dropped:
return "watch"
if recent_deploy:
return "roll_back"
return "retrain"
print(triage(True, True, False)) # retrain
print(triage(False, True, True)) # fix_pipeline
print(triage(True, False, False)) # watchIn practice performance_dropped may come from a proxy while labels are late. Record which signal you used.
Retrain safely
Retraining is a new release, so treat it like one. Train on a window that reflects the current population, and keep a holdout from the recent period. Compare the candidate with the current model on that holdout, not on old data. Release it gradually, for example in shadow mode or to a small share of traffic. Keep the previous version ready for rollback.
Close the loop
After any response, write down the cause, the signal that caught it, and the fix. Then adjust the monitoring. If an alert was a false alarm, raise its threshold or lengthen its window. If drift was caught late, add a check earlier in the pipeline. Reset the reference window only when you have decided the new data is the new normal.
Exercise
A PSI alert fires on a key feature the day after an upstream team changed a data export. Data quality checks show the feature's null rate rose from 1% to 30%. Should you retrain?
Show answer
No. The null rate points to a broken input, so fix the pipeline and backfill first. Retraining would teach the model the broken data. Once inputs are healthy, recheck drift and performance and retrain only if the shift persists and hurts performance.