Retraining and CI/CD
Professional Machine Learning Engineer · Lesson 17 of 19 · 2:07:27
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Google Cloud Professional Machine Learning Engineer exam, on the official exam guide. In this lesson: MLOps levels 0, 1, and 2, retraining triggers (on demand, on a schedule, on new data, on degradation, on distribution changes), CI, CD, and continuous training for machine learning, Cloud Build triggers, and continuous training in production. Includes three original practice questions, with Cymbal Insurance, a fictional car and home insurer, as the example.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Every Sunday, no matter what
Cymbal Insurance's fraud model retrains every Sunday, whether or not anything has changed, and that costs a lot. Yet after a sudden wave of storm fraud, the model waited a whole week for its next retraining. And every change to the pipeline code is copied to production by hand.
MLOps levels
MLOps maturity is often described in three levels. At level zero, every step is manual, from data preparation to deployment, which works only when models rarely change. At level one, the training pipeline is automated, with data and model validation, triggers, and metadata, so the model retrains continuously. At level two, a CI and CD system also builds, tests, and deploys the pipeline itself, with source control, a model registry, a feature store, a metadata store, and an orchestrator.
Choosing a retraining policy
A retraining policy says what starts a new training run. On demand means a person starts it, and on a schedule fits labeled data that arrives every day, week, or month. When new data arrives at unpredictable times, trigger the run on its arrival. And retrain when the model's performance degrades, or when the distributions of its input features change significantly. Choose the frequency by how fast the patterns change, and by how much each retraining costs.
CI and CD for machine learning
Continuous integration for machine learning tests more than code: it also validates data, schemas, and models. Continuous delivery ships a training pipeline, which in turn deploys a prediction service. Continuous training is new: it retrains and serves models automatically. Cloud Build runs each build as a series of steps in containers, and a trigger can start one on every commit. A typical build runs the unit tests, builds the component images, pushes them to Artifact Registry, and publishes the updated pipeline, first to a test environment and then to production.
Continuous training in practice
In production, a schedule or an event starts the training pipeline, such as new data or an alert from model monitoring. The pipeline validates the data, trains, validates the model, and registers the new version in Model Registry. A better model is then rolled out with a canary, or by moving an alias, and ML Metadata tracks every step. If something goes wrong, rolling back is a matter of moving traffic, or the alias, back to the previous version.
Recap
Let's recap. Level zero is manual, level one automates the training pipeline, and level two also automates CI and CD for the pipeline. Retrain on demand, on a schedule, on new data, on degraded performance, or on changed feature distributions. In machine learning, CI also validates data, schemas, and models, and continuous training retrains automatically. Cloud Build triggers test, build, and publish on every commit. And a pipeline validates, registers, and rolls out each better model, with quick rollback.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Confirmed fraud labels arrive in irregular batches, whenever investigations finish: sometimes twice in a week, sometimes not for a month. When should the pipeline retrain?
- Every Sunday, as it does today
- When an analyst remembers to start it
- Once a quarter, on a fixed date
- When a new batch of labeled data arrives
Show the answer
When a new batch of labeled data arrives
Triggering on the arrival of new labeled data retrains exactly when there is something new to learn. “Every Sunday, as it does today” would often retrain on nothing new, and still miss batches between runs. “When an analyst remembers to start it” would depend on someone noticing each batch. And “Once a quarter, on a fixed date” would wait far too long when batches arrive close together.
Every commit to the pipeline's repository must run the unit tests, build the component images, and publish the updated pipeline. Nothing should be copied by hand. What should the team set up?
- A Cloud Build trigger on the repository
- A checklist for each release
- A weekly retraining schedule
- A Model Monitoring job
Show the answer
A Cloud Build trigger on the repository
A Cloud Build trigger runs the tests, builds the images, and publishes the pipeline on every commit. “A checklist for each release” would keep the manual copy that the team wants to end. “A weekly retraining schedule” would retrain the model, but never test or ship the new pipeline code. And “A Model Monitoring job” would only watch the model, not build anything.
Fraud patterns shift without warning, and true labels take weeks to arrive. Yet changes in the input features show up within days. What should trigger retraining?
- Accuracy measured on new labels
- A drift alert on the input features
- A fixed monthly schedule
- A complaint from the claims team
Show the answer
A drift alert on the input features
When labels are slow, a significant change in the input feature distributions, flagged by monitoring, is the earliest signal that the model has gone stale. “Accuracy measured on new labels” would wait weeks for labels that arrive too late. “A fixed monthly schedule” would retrain on a fixed calendar, whatever happens. And “A complaint from the claims team” would only react when a person notices, which is the slowest signal of all.