Retrain and promote only when it's better

DevOps, Hands On20 minutesFreeSteps checked 23 November 2026By Cloud Hands On

In this task you'll retrain on new data and let the comparison, not a hunch, decide whether to switch models.

When drift appears, retrain on recent data and register the result as a challenger. Then compare it with the champion on recent labelled data (new holdout), because the old holdout describes the old world. Promote only if the challenger wins by a margin.

Keep the old champion's version: if the new one misbehaves in use, moving the alias back is an instant rollback. Some teams also run a shadow period, where the challenger scores live requests without its answers being used, before promoting.

Example. After SS Kaiser's south warehouse changed courier, the old model kept flagging south orders as risky. A model retrained on the new month scored an AUC of 0.88 on new holdout data against the champion's 0.83, was promoted, and the false alarms stopped.

Before you start

You need: Python 3.10 or newer, and about 500 MB of disk for MLflow and scikit-learn. No cloud account. Time: 20 minutes.

Where to look

  1. mlops folder
  2. train.py --register
  3. promote.py --holdout
  4. MLflow UI
  5. Models

Steps

  1. Make a month of new labelled orders and a new holdout: the two make_data.py lines in Commands.In this Example month weekends got busier and a new courier fixed the south warehouse, so the pattern itself changed.
  2. Train on the new month and register it: python train.py --data data/orders_new.csv --register.
  3. Compare on the new holdout: python promote.py --holdout data/holdout_new.csv. The challenger scores about 0.88 against the champion's 0.83 and is promoted.
  4. In the MLflow UI, see @champion on the new version and the old version kept for rollback.

Commands

# A new month with a changed pattern, then retrain and compare
python make_data.py --rows 5000 --seed 13 --drift 1 --out data/orders_new.csv
python make_data.py --rows 2000 --seed 14 --drift 1 --out data/holdout_new.csv
python train.py --data data/orders_new.csv --register
python promote.py --holdout data/holdout_new.csv

Watch out for

Cost
Free.
Security
Retraining data comes from live systems; check it for errors and tampering before it can change a model.
Common mistakes
Promoting without a comparison, and comparing on a holdout from the old world.

Clean up

Keep the mlops folder for the next tasks in this section; delete it (and its .venv) at the end.

Words to know

Retraining
Training a fresh model on newer data.
Shadow deployment
Running a new model on real traffic without using its answers.
Rollback
Moving the alias back to the previous version.
Margin
How much better a challenger must be before it's promoted.

Tick off each step and track your progress in the guide.

Open this task in DevOps, Hands On

Keep going