Think Build Implement Repeat
London, UK +44 7367 067226
WhatsApp FOLLOW f in X
  1. Home
  2. Blog
  3. CI/CD for Machine Learning Projects
Cloud & DevOps

CI/CD for Machine Learning Projects

Software pipelines test code. Model pipelines must also test data and behaviour. What to add, and which gates should stop a release.

Updated 2 min readBy SpiderHunts Technologies

Free estimateNo obligation

Get a free estimate

Tell us what you need. A senior engineer reads every enquiry.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →

Quick answer — TL;DR

A model release changes behaviour without changing code, so standard CI is not enough. Add data validation, a performance gate against the current model, and a behavioural check on known cases - then deploy gradually rather than all at once.

Why normal CI is insufficient

Continuous integration tests that code does what it should. A retrained model can pass every unit test and behave quite differently, because the change is in learned parameters rather than logic.

The pipeline therefore needs gates on data and behaviour as well as code. Without them, a retraining job can quietly push a worse model into production on schedule.

The gates worth having

  1. Code tests - the ordinary ones, including feature transformation logic, which is where subtle bugs live.
  2. Data validation - schema, ranges, missing-value rates and row counts on the training set, with the job failing rather than warning.
  3. Training success - convergence and sane parameters.
  4. Performance gate - the new model must beat the current one on a fixed held-out set by an agreed margin.
  5. Behavioural checks - a set of known cases with expected outcomes, including edge cases and any case that previously caused an incident.
  6. Subgroup check - no important group materially worse than before.

The behavioural set is the most valuable and least common. Each production surprise should add a case to it, so the same mistake cannot ship twice.

A performance gate that is not gameable

The comparison set must be fixed and separate from anything used in training or tuning. If it moves with each release, the gate compares two different things and means little.

Require a margin rather than any improvement, so noise alone cannot pass a model. And decide in advance what happens on failure - block, or alert and hold for review - because that is a policy question, not a technical one.

Deploy gradually

StageWhat it catches
Shadow - score without actingPipeline errors, wildly different outputs
Small share of live trafficReal-world behaviour on a limited blast radius
Progressive increaseEffects that only appear at volume
Full-

Keep the previous model deployable throughout, and make rollback a single documented action rather than a rebuild. Most teams discover their rollback is not actually one step at the worst possible moment.

Version everything together

A deployment is the combination of model, feature code and configuration. Versioning them separately allows mismatches - a new model with old feature code produces silently wrong predictions rather than an error.

Release them as one unit with one version number. It is the single change that prevents the most confusing class of production failure. Our note on versioning and rollback covers the mechanics.

A retrained model is a behaviour change. It deserves more scrutiny than a code change, not less.

FAQ

Frequently asked questions

The questions readers ask us after this guide.

Still have a question?

Ask us directly — a senior engineer will get back to you.

Ask about your project

Should retraining be fully automatic?

Automatic training with a gated, reviewed release is a good middle ground. Fully automatic deployment needs strong gates and monitoring.

How large should the behavioural test set be?

Small enough to review by hand, large enough to cover the cases you care about. It grows naturally as incidents occur.

What margin should the performance gate require?

Enough to exceed run-to-run noise. Measure that variation on your own pipeline and set the margin above it.

Do we need a feature store for this?

Not necessarily. Consistency between training and serving matters; a feature store is one way to get it, not the only one.

Keep reading

More on Cloud & DevOps

Cloud & DevOps

Batching Predictions to Reduce Cost

Scoring records individually is the most expensive way to run a model. When batching works, and how to keep results fresh enough.

Start here

Want machine learning project details from us?

Tell us what you are trying to predict and roughly what data you hold. We will come back with an honest view on whether machine learning is the right tool, what the work would involve and a realistic cost range. If a spreadsheet would do the job, we will say so.

  1. You tell us what you needTwo minutes on the form, or a message on WhatsApp.
  2. A senior engineer reviews itAnd comes back with questions, a realistic range and an honest view on fit.
  3. Free 30-minute scoping callWe talk through scope, options and a realistic estimate — with no obligation.
Free estimateNo obligation

Talk to someone who builds this

Send a short brief and we will come back with an honest view and a realistic range.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →