Retraining

Guarded retraining: rerun a recipe on new data and promote only when it beats the current model.

A deployed model gets stale as the world changes. Retraining builds a new model on fresh data. The risk is that the new model is not better, or is worse. Guarded retraining removes that risk: mlflow trains a candidate, compares it with the model that is serving, and replaces the deployed model only if the candidate wins by a margin you choose. Otherwise the current model stays.

How guarded retraining works

On each run of the schedule, mlflow:

  1. Finds the recipe behind the deployed model: the pipeline you built in Pipeline Studio, in its latest saved version.
  2. Finds the newest version of the dataset that the recipe was built on, so new rows are picked up when you refresh the data source.
  3. Trains the recipe on that data as a normal run.
  4. Compares the best new model with the deployed one on the primary metric.
  5. If the candidate wins by at least the margin, it creates a new version of the model and points the deployment at it. Otherwise it keeps the current model.
  6. Writes the outcome, with the reason, to the Decision log.

The previous model is never changed or deleted. A promotion creates a new version, so the earlier one is still listed under Versions and you can roll back with one click.

What you need

The deployed model must come from a Pipeline Studio recipe, and that recipe's dataset must still exist. A model that was only downloaded or created in another way has no recipe to rerun, and the decision log says so ("No Pipeline Studio recipe found for this deployment"). Models served outside mlflow cannot be retrained and promoted from here.

Schedule it

Open the deployment, select the Monitor tab and find the card Scheduled retraining. Admins can change it; other members can read it.

Turn it on

Switch on Retrain on a schedule. The card shows the Deployed model with its version, what it Retrains with (the recipe and its dataset version), and its Current metrics. If the model has no recorded metrics, mlflow cannot compare and will keep the current model.

Choose how often

Pick the Frequency: Daily, Weekly, Every 2 weeks or Every 30 days.

Choose the metric and the margin

Set the Primary metric, the Margin type and the Required improvement. See Margins.

Choose a timeout

Give up after (hours) limits how long one retraining may run. A run that is still going after this time is settled as failed. The default is 6 hours.

Save

Select Save schedule. The card then shows when it Last run.

To try it without waiting, select Run now and confirm Start retrain. It trains a new model immediately, with the same rules. The button is available once you have saved an enabled schedule without problems.

You can see and manage the same schedule under Settings > Automation, where it appears as a retrain schedule for the deployment. Each deployment has at most one.

Margins

The margin is how much better the candidate has to be. It protects you from replacing a good model because of a small difference that is only random noise.

  • Primary metric. The metric used for the comparison. Leave it on Automatic and mlflow picks one the deployed model reports, in this order: Accuracy, AUC, F1, R2, MAE, RMSE, MSE. You can also choose a specific one. For error metrics, such as RMSE or MAE, a lower value is better; for the others, higher is better. mlflow knows which direction each metric has.
  • Margin type. Absolute (metric units) means the candidate must be better by a fixed amount of the metric. Relative (% of current) means a fraction of the current value, up to 100%.
  • Required improvement. The size of the margin.

The candidate must always be strictly better than the current model, even if the margin is 0. Here are two examples with a primary metric of AUC (higher is better) and a current value of 0.850:

Candidate AUCMarginRequiredImprovementDecision
0.862Relative, 1%0.850 x 0.01 = 0.00850.012Promoted
0.862Absolute, 0.020.0200.012Kept current

With RMSE (lower is better), a current value of 4.20 and a candidate of 4.05, the improvement is 4.20 - 4.05 = 0.15. An absolute margin of 0.10 promotes the candidate, and one of 0.20 keeps the current model.

Choose a margin that is larger than the normal run-to-run variation of your metric. If you do not know it, start with a relative margin of 1% to 2%.

Decisions and rollback

The Decision log lists every scheduled or manual retraining, newest first. Each entry has one of these results:

ResultMeaning
TrainingThe retraining run is still going.
DecidingThe run finished and the comparison is being made.
PromotedThe candidate won. The log shows the metric values and which version replaced which ("replaced by v3").
Kept currentThe candidate did not win by the margin, or no comparison was possible. The reason says why.
FailedSomething went wrong, for example the run failed, timed out or produced no usable model.
SkippedA retraining was not started, for example because the previous one is still running.

Every entry links to the run with View run, so you can open the leaderboard and see the candidate yourself. Each settled decision (promoted, kept or failed) also sends a retrain.decision event to your webhooks. See Integrations and automation.

To undo a promotion, open the Versions tab and select Rollback to v followed by the earlier version number. See Deploy and test a model. Rolling back restarts the drift reference too.

Combine it with drift monitoring

Retraining on a fixed schedule works well when data changes slowly. When you want retraining to follow a real change, watch drift alerts and use Run now when one opens, or choose a shorter frequency. The margin keeps a retraining on unchanged data from replacing a good model.

Next steps

Learn the theory

Lessons on learning.mlflow.es that explain the ideas behind this page.

Updated 2026-11-22