Automatic retraining for machine learning models: tips and lessons learned

Felipe Almeida19 Dec 2022

Problem

Models lose quality from the day they ship, because they learn from a frozen snapshot of the world while the data keeps changing (concept or data drift). Retraining on newer data is often the simplest fix. But a faulty retrained model making production decisions is one of the worst things that can happen in a data-driven company. Downstream score rules, retraining cost and label lag add further traps.

Example from the article: a credit-underwriting team can only observe repayment for customers it approved, so each retrain sees a biased sample shaped by the previous model.

Solution in brief

Automate the pipeline up to a pull request that shows baseline versus challenger metrics, and let a human merge it. Make the comparison trustworthy with an unbiased out-of-time holdout, synthetic sanity examples and per-segment metrics. Also re-fit the downstream policy, handle feedback loops and label lag, and weigh retraining cost against benefit.

Questions this case answers
  • How to refresh a deployed predictive model on newer data automatically while guarding against silently degraded replacements, biased comparisons and stale downstream decision rules
  • How to retrain a production model automatically without shipping a worse version
  • How to compare a retrained challenger with the current model fairly
  • How to catch a retrained model that got worse in one customer segment

Tools and methods

  • CI/CD, monitoring, data pipeline — prerequisites for automation
  • Pull request as the last pipeline step — human approval before the new model replaces the old one
  • Out-of-time holdout — shared test set outside both models' training periods
  • Synthetic example checks and per-stratum metrics — sanity tests for a challenger
  • Probability calibration — makes the policy threshold easier to re-fit
  • Kubeflow Pipelines, Papermill — pipeline orchestration and parameterized notebooks
Continue reading — it's free

Google or a one-time email code. No password.