Sub topic 15
When and How to Retrain
Assume you know how to train and evaluate a supervised model, use basic Git and the command line, and deploy a simple web service. Retraining means fitting a new model with newer data or a changed training process. It is an operational decision, not an automatic response to every unusual observation.
What should trigger retraining?
A useful trigger connects an observed change to a likely loss of model quality.
- Scheduled trigger: Retrain daily, weekly, or monthly when data arrives on a predictable schedule.
- Data-drift trigger: Retrain when the distribution of an input feature changes enough to make the training data unrepresentative.
- Performance trigger: Retrain when labeled production outcomes show that accuracy, recall, or another business metric has fallen.
- Business trigger: Retrain after a policy, product, market, or user population changes.
- Data-volume trigger: Retrain after collecting enough new labeled examples to add useful information.
Drift alone does not prove that predictions are wrong. A changed feature distribution may be harmless, while stable features can hide a change in the relationship between inputs and outcomes. This relationship change is called concept drift.
| Trigger | Evidence needed | Typical response |
|---|---|---|
| Scheduled | New data is available | Start a routine training run |
| Data drift | Feature distribution differs from reference data | Investigate, then retrain if relevant |
| Performance drop | Recent labels show worse results | Retrain and compare with production |
| Business change | Requirements or population changed | Revisit features, labels, and metrics |
A safe retraining workflow
Treat retraining as a candidate-generation process:
- Collect and validate new data. Check schemas, missing values, label quality, and time boundaries.
- Freeze the data snapshot and record its version.
- Train a candidate using versioned code, dependencies, configuration, and random seeds.
- Evaluate on a recent holdout set. Do not use only the training score.
- Compare the candidate with the production model on quality, fairness, latency, and resource use.
- Register the candidate only if it passes release criteria.
- Deploy gradually or keep it in shadow mode while collecting evidence.
- Monitor the new model and retain a rollback path.
The holdout set should represent the decisions the model will make after release. For time-dependent problems, use a later time period rather than a random split. Otherwise, information from the future can leak into evaluation.
def should_retrain(candidate, production, min_gain=0.01, floor=0.90):
"""Return True only when the candidate clears the floor and improves production."""
return (
candidate >= floor
and candidate >= production + min_gain
)
print(should_retrain(0.94, 0.92)) # True
print(should_retrain(0.91, 0.92)) # FalseScheduled versus event-driven retraining
Scheduled retraining is simpler and easier to audit. It can waste compute when data and performance are stable. Event-driven retraining reacts faster, but noisy measurements can cause repeated or unnecessary runs. Use thresholds, minimum data windows, and a cooldown period to prevent retraining storms.
Exercise
Why might a team avoid retraining immediately after detecting feature drift?
Show answer
Drift does not necessarily reduce prediction quality. The team should check whether the changed feature matters, whether labels confirm a performance loss, and whether enough reliable data exists for a new model.