Sub topic 1
Why Production Models Need Retraining
A model is trained on a snapshot of the past, but it is used on the present. This chapter explains why the gap between the two grows, how to recognize it, and what an automated retraining pipeline does about it. Later chapters cover each trigger and pipeline stage in detail.
Prerequisites
This chapter assumes you know the following:
- The basic machine learning workflow: train, validate, test, deploy.
- Python and NumPy basics.
- How batch or online model serving works.
- Version control and CI/CD at a basic level.
A model is a frozen snapshot
Training fits a function to a dataset collected up to some date. After deployment, the function does not change. The world does. Customers change behavior, upstream systems change formats, and competitors change prices. The model keeps applying the patterns it learned, and those patterns slowly stop matching reality.
This is called model decay, or model degradation. Nothing in the code breaks. The service returns predictions with normal latency and no errors. Only the quality of the predictions falls, which is why decay is easy to miss without deliberate monitoring.
Some examples:
- A fraud model learns the tactics of last year's attackers. Attackers adapt, and recall drops.
- A demand forecast is trained before a pricing change. After the change, historical sales no longer predict future sales.
- A recommender is trained before a new product category launches. It never recommends the new items.
Why quality drops
Three kinds of change cause most decay. The next chapter treats them precisely. Here is the short version.
| Kind of change | What moves | Example |
|---|---|---|
| Data drift | The distribution of input features | A new mobile app sends shorter session durations |
| Label drift | The distribution of the target | The share of fraudulent transactions rises from 0.5% to 2% |
| Concept drift | The relationship between inputs and target | The same income and age no longer predict default after an interest rate change |
Not every change is gradual. Drift can be sudden (a policy change), gradual (changing tastes), seasonal (holidays), or caused by a bug (an upstream job starts sending nulls). A bug is not a reason to retrain. Retraining on corrupted data makes the model worse, so the pipeline must tell the two cases apart.
Retraining does not fix everything
Retraining refits the same model design on newer data. It helps when the world changed and new data describes the new world. It does not help in these cases:
- The input data is broken. The fix is in the data pipeline, not the model.
- The features no longer carry the needed signal. You need new features or a new model design.
- There are no new labels yet. You cannot learn from outcomes you have not seen.
- The problem itself changed, for example the business now wants a different target.
A useful habit is to ask, when quality drops, "Is the world different, or is my data different?" Only the first case is a retraining problem.
From manual retraining to a pipeline
Many teams start by retraining by hand. Someone notices a dashboard dip, reruns a notebook, and uploads a file. This works for one model. It fails as models multiply, because it depends on a person remembering, on a notebook that may not reproduce, and on an ad hoc decision to ship.
An automated retraining pipeline replaces that with a repeatable process. It has two parts:
- Triggers decide when to retrain: a schedule, a performance drop, detected drift, or enough new data.
- The pipeline decides what happens after a trigger fires: validate data, train, evaluate against the current model, register, and roll out safely.
Notice that two exits return to monitoring without deploying anything. A good pipeline often ends with "do nothing", and that is correct behavior.
The four trigger families
The plan for this tutorial groups triggers into four families. This chapter only names them.
| Family | Fires when | Main weakness |
|---|---|---|
| Schedule | A calendar time arrives | Wastes compute when nothing changed, and reacts late when something did |
| Performance | A quality metric falls below a threshold | Needs labels, which often arrive late |
| Data drift | Input distributions move away from training | Drift does not always hurt accuracy |
| Data volume | Enough new training rows have accumulated | Says nothing about whether the data is useful |
No single family is enough. Real policies combine them, for example a maximum model age plus a drift signal, guarded by a cooldown.
A first look at the decision
The following snippet shows the idea in its smallest form. It retrains if the model is older than a limit, or if a drift score is high and enough new data exists. It returns the reason, which you should always log.
from datetime import datetime, timedelta, timezone
def simple_trigger(now, last_trained, drift_score, new_rows):
"""Return (decision, reason) from model age, drift, and data volume."""
if now - last_trained >= timedelta(days=30):
return True, "max_model_age"
if drift_score >= 0.2 and new_rows >= 50_000:
return True, "drift_with_enough_data"
return False, "no_trigger"
now = datetime(2026, 11, 30, tzinfo=timezone.utc)
last = now - timedelta(days=10)
print(simple_trigger(now, last, 0.31, 80_000))
print(simple_trigger(now, last, 0.05, 80_000))The first call prints (True, 'drift_with_enough_data'), and the second prints (False, 'no_trigger'). Chapter 9 extends this into a full policy with a cooldown.
Common errors in thinking about retraining
- "Retrain as often as possible." Each run costs compute, adds a deployment risk, and can introduce regressions. More retraining is not better by default.
- "Never retrain, the model works." Without monitoring, you do not know whether it still works.
- "Automatic means unattended." Automation removes repetitive work. It does not remove the need for evaluation gates, budgets, and, for high-stakes models, human approval.
- "New data means a better model." New data can be mislabeled, biased by the model's own past decisions, or poisoned. Validation comes before training.
- "Drift means retrain." Drift is a signal to investigate. Whether it justifies retraining depends on its effect on quality.
What the rest of the tutorial covers
The remaining chapters follow the loop in the diagram. First come the kinds of drift and what to monitor. Then each trigger family, and how to combine them into a policy. Then the pipeline stages: data validation, versioning, the champion-challenger gate, the registry, and rollout with rollback. Finally come orchestration, guardrails, testing the pipeline itself, and a maturity path from manual retraining to continuous training.
Exercise
Your fraud model's accuracy dropped last week. Investigation shows a upstream job started sending null values for the transaction amount field starting last Tuesday. Should the pipeline retrain on the last week of data? Explain why or why not, and name one trigger family that would probably have fired.
Show answer
No. The cause is a data bug, not a change in the world. Retraining on rows with null amounts would teach the model the corrupted pattern and make it worse. The fix belongs in the upstream job, and data validation before training should block such data. A data drift trigger would probably have fired, because the distribution of the amount feature changed sharply. A performance trigger could also fire once labels arrived, but later. The drift signal should lead to an investigation, not an automatic retrain.
Exercise
Give two reasons why retraining on a fixed weekly schedule can be wasteful or risky, and one reason it is still useful.
Show answer
It can be wasteful because it retrains even when nothing changed, which spends compute and risks needless deployments. It can be risky because a sudden change mid-week goes unaddressed until the next run, and because a run may use corrupted data without any check. It is still useful as a simple safety net: it bounds the maximum age of the model even if drift and performance signals fail to fire.