How do you design a CI/CD (continuous integration and continuous delivery) pipeline for a production ML system, and how does it differ from ordinary software CI/CD?

ML system design, Deployment
Level L3 Intermediate. Length Medium. Nature Th Theoretical.

What's being asked

Whether you know the automated test, validation and rollout gates required to ship ML pipelines safely, and why code-only testing is insufficient.

Key idea

Ordinary software CI/CD validates code changes alone, whereas an ML system is shaped by code, data and trained weights together—so production behaviour can break without a single line of code changing. An ML CI/CD pipeline therefore adds automated data validation, reproducible training smoke tests, multi-slice model evaluation gates and progressive live rollouts, alongside a separate CT (continuous training) loop triggered by fresh data or drift.

Steps

  1. Run code and training smoke tests on every pull request: unit-test feature transforms, loss functions and data loaders, then run a fast end-to-end training job on a tiny synthetic or sample dataset to catch shape mismatches, NaNs (not-a-number errors) and serialisation bugs.
  2. Validate incoming data automatically before training: check schema, column types, null rates, value ranges and distribution shifts against a saved baseline so corrupted upstream tables fail early.
  3. Run offline evaluation gates on a candidate model: evaluate against the current production model on a fixed holdout set and critical slices (rare classes, key user segments, fairness slices), and verify inference latency, memory footprint and training–serving feature parity.
  4. Deploy progressively with guardrails: stage the validated artefact through shadow deployment (comparing predictions and latency asynchronously with zero user impact) and canary rollout (routing a small live traffic slice and ramping up only while business and system guardrails hold), triggering automatic rollback on regressions.
  5. Separate CI/CD from CT (continuous training): CI/CD ships tested pipeline code, whereas CT is triggered on a schedule, new data volume or drift alerts to retrain weights and pass the same data, evaluation and rollout gates automatically.
  6. Highlight what differs from traditional software CI/CD: tests are statistical rather than strictly deterministic pass/fail, training jobs are expensive so full training runs move to CD/CT stages, and data changes alone can degrade a previously healthy pipeline.

Common mistakes

How long your answer should be

About 3–4 minutes; walk through CI tests, data checks, eval gates, progressive delivery, CT, and differences from software CI/CD.

Read this

Previous in ML system design: What artefacts and metadata must you version so that a trained ML model can be reproduced and safely rolled back in production, and why can bit-exact reproduction still fail?
Next in ML system design: How do you decide how often to retrain a production ML model, and what are degenerate feedback loops and how can you mitigate them?