MLOps Platform Design
What You'll Learn
- 1Distinguish MLOps Level 0, 1 and 2 and state what each level automates
- 2Size CI/CD cycle time and canary sample size for a model rollout
- 3Design quality gates that block a bad model without blocking the team
- 4Compute the monthly training and serving cost of a model fleet
Why This Matters
MLOps bridges the gap between ML research and production. Without MLOps, models degrade silently, deployments take weeks, and reproducibility is impossible. A well-designed MLOps platform enables rapid iteration, reliable deployments, and governance over the entire ML lifecycle.
Architecture Overview
Core Components
1. Experiment Tracking
Experiment tracking logs all parameters, metrics, artifacts, and code versions from ML training runs. Key capabilities include:
- Run management: Create experiments with multiple runs, each logging params (learning rate, batch size), metrics (accuracy, loss, AUC), and artifacts (model checkpoints, confusion matrices).
- Best run selection: Query the best run by any metric in min/max mode for automated model selection.
- Run comparison: Compare multiple runs side-by-side with parameter diffs and metric trends.
- Reproducibility: Each run captures the full context needed to reproduce results, including environment, code version, and data version.
2. Model Registry
The model registry manages the lifecycle of model artifacts through stage transitions:
- Stages: None -> Staging -> Production -> Archived
- Version management: Each model can have multiple versions; only one version per model can be in production at a time.
- Stage transitions: When a new version transitions to PRODUCTION, the current production version is automatically moved to ARCHIVED.
- Metadata: Each version stores metrics, parameters, description, who registered it, and timestamps.
3. CI/CD Pipeline for ML
The ML CI/CD pipeline orchestrates the full workflow from code to deployment:
- Code validation: Lint, unit tests, type checks, security scanning.
- Data validation: Schema checks, data quality tests, drift detection.
- Model training: Automated training runs with registered experiments.
- Model evaluation: Compare metrics against baseline and fairness thresholds.
- Quality gates: Configurable gates that block deployment if metrics fall below thresholds (for example accuracy of at least 85 percent, p99 latency of at most 100 ms, disparate impact of at least 0.8).
- Deployment: Canary, blue-green, or A/B deployment to Kubernetes.
Sizing the Platform
Three numbers decide whether an MLOps platform is trustworthy: how long a full pipeline run takes, how much traffic a canary needs before it can be trusted, and what the model fleet costs per month.
Cycle time is additive, and every stage that is not parallelized lands directly in the developer's wait:
A realistic split is 4 minutes of lint, tests and image build, 6 minutes of data validation, 45 minutes of training, 10 minutes of evaluation and 5 minutes of a canary rollout, giving 70 minutes end to end. Teams that ship daily usually get there by caching the data validation step on unchanged partitions and running evaluation in parallel with the canary warm-up.
A canary is a proportion test, so it needs a sample size you can defend:
At 95 percent confidence, , with and a 2 percentage point margin of error this gives requests per arm. On a 10,000 QPS service that is 0.24 seconds of traffic, so statistical power is rarely the constraint; latency and accuracy metrics that move slowly are.
Fleet cost is the number that gets an MLOps budget approved:
With 100 models retrained weekly (400 runs per month), 6 GPU-hours per run and 1.50 USD per GPU-hour, training costs USD per month. Double the retrain frequency without touching efficiency and the bill doubles with it, which is why drift-triggered retraining beats a fixed nightly schedule.
Failure Modes
The failure that hurts most is an irreproducible run: a model passes its gates but nobody can say which data snapshot produced it, so a rollback rolls back to unknown behavior. Fix it by pinning the data version, code commit and container digest in the same metadata record. The second failure is gate bypass under deadline pressure, so gates must be enforced in the pipeline rather than as a review checklist. The third is a rollback that cannot execute because the previous version's replicas were reclaimed; keep at least one warm replica of every production version.
Common Mistakes
Treating the ML pipeline like a software pipeline with unit tests only
Fix: Add data validation, drift checks and model quality gates so a bad dataset is caught before training.
Letting teams override quality gates to hit a deadline
Fix: Enforce gates in the pipeline with an audited exception path, because a bypassed gate teaches everyone gates are optional.
Retraining every model on a fixed schedule
Fix: Trigger on drift and performance decay so compute goes to models that actually need it.
Best Practices
- Pin code commit, data version and container digest in one run record so any model can be rebuilt
- Keep one warm replica of the previous production version so rollback is a routing change
- Measure the full cycle time per stage and parallelize data validation with training
Key Takeaways
- Cycle time is T = T_code + T_data + T_train + T_eval + T_deploy; 4 + 6 + 45 + 10 + 5 is 70 minutes
- A canary comparing a 2 point regression at 95 percent confidence needs about 2,401 requests per arm
- Fleet training cost is M x f x h x c: 400 runs of 6 GPU-hours at 1.50 USD is 3,600 USD per month
- MLOps Level 1 adds pipeline automation and Level 2 adds full CI/CD with rapid, tested deployment
Frequently Asked Questions
What separates MLOps Level 0, 1 and 2?
Level 0 is manual: a data scientist trains a notebook model and hands an artifact to an engineer who deploys it by hand, with no continuous training. Level 1 introduces an automated, reproducible pipeline with continuous training and a model registry. Level 2 adds end to end CI/CD, rapid experimentation, automated testing and continuous deployment with monitoring that feeds retraining. Most organizations should target Level 1 first, because Level 2 on top of manual data validation only automates the wrong thing.
How long should a model CI/CD run take?
Long enough to be trustworthy and short enough that nobody skips it. Seventy minutes is a workable target: 4 minutes of code checks, 6 of data validation, 45 of training, 10 of evaluation and 5 of rollout. If training dominates, cache unchanged data partitions or drop to a smaller proxy dataset for the pull request check and run full training only on merge.
What must be versioned to reproduce a model a year later?
Four things: the code commit, the data snapshot or table version, the container image digest, and the feature transformation version. Log them together with hyperparameters and random seeds in the experiment tracker, then register the artifact with those identifiers. Without the data version a rebuild produces a different model even when every other input matches.
Interview Questions
Q1: What are the key differences between MLOps Level 0, 1 and 2?
Level 0 is manual and script-driven with no continuous training. Level 1 adds an automated, reproducible pipeline with continuous training and a registry. Level 2 adds full CI/CD, rapid experimentation, automated testing and continuous deployment. Most production systems should reach Level 1 before investing in Level 2 automation.
Q2: How do you implement model rollback in production?
Keep the previous version registered with its serving image and at least one warm replica. Use a canary that shifts 1 to 5 percent of traffic, watch accuracy, error rate and p99 latency against baseline, and route traffic back automatically when a threshold breaks. Rollback is then a routing change measured in seconds rather than a redeploy.
Q3: How do you handle reproducibility in ML pipelines?
Pin dependencies in a container, version data with DVC or Delta Lake, log parameters and commits for every run, fix random seeds, and store feature transformations as versioned artifacts. The test is simple: check out an old run, rebuild it, and confirm the metrics match the ones recorded at the time.