How would you deploy a new model version safely?
Written by the mlprep team · Updated
Walk me through how you'd deploy a new model version to production safely. What strategies exist and how do you choose between them?
Model deployment is riskier than code deployment because you can't fully verify correctness offline — a model that looks great on your eval set can still fail in ways that only surface on live traffic. The goal of safe deployment is to limit blast radius while gathering evidence that the new model works.
Blue-green deployment#
Maintain two identical serving environments: blue (current production) and green (new model). Route all traffic to blue. When ready, cut over 100% to green. If problems surface, flip back immediately.
Simple to reason about and fast to rollback. The downside: the cutover is all-or-nothing — you go from 0% exposure to 100% with no intermediate validation on live traffic.
Canary deployment#
Route a small fraction of traffic (1%, 5%) to the new model. Monitor prediction quality, latency, error rates, and downstream business metrics on both old and new. Gradually increase traffic if metrics look healthy. Rollback by routing back to the old model.
This is the standard approach for most ML teams. You get real production signal before full rollout. The key question is what metrics to watch and what thresholds trigger a rollback.
Shadow mode (dark launch)#
Run the new model in parallel with production — both models score every request, but only the old model's output is used. The new model's output is logged but discarded.
Shadow mode is ideal when you can't afford any risk (medical, financial) or when the new model is architecturally very different. You get a large sample of production predictions to compare against without any user impact. The cost: you pay for double inference compute, and you won't see effects that depend on the model's output actually being used (e.g., if the model's predictions drive user behavior that feeds back into future features).
A/B testing#
Technically a form of canary, but with statistical rigor: split users into control (old model) and treatment (new model) groups and run the experiment long enough to detect a meaningful effect with statistical significance. Used when the metric you care about is a business outcome (click-through rate, conversion) that requires enough sample size to measure reliably.
How to choose#
If risk is low and you have good offline eval confidence: canary with progressive traffic increase. If risk is high or the model change is large: shadow mode first, then canary. If you're measuring business outcomes that need statistical power: A/B test with a fixed holdout. Blue-green is fine for fast rollback capability, but shouldn't replace progressive exposure.
Interview red flags#
- Swapping the model in place for all traffic at once with no canary, shadow, or rollback plan.
- Treating shadow mode as proof of business impact. It cannot capture user feedback loops.
- Rolling back the model but not the feature pipeline or preprocessing version it depends on.
- No automated guardrails: rollout continues even when prediction distributions or error rates shift.
You mentioned shadow mode — but you said the model's output is discarded. How do you actually evaluate whether the shadow model is better if users never see it?
Shadow mode gives you production features with production distribution — which is more valuable than you might think, even without user feedback.
What you can evaluate without user interaction#
Prediction distribution: Compare the old and new model's output distributions on identical inputs. If the old model averages a fraud score of 0.3 and the new model averages 0.6 on the same traffic, that's a signal worth investigating — even before you see any ground truth labels.
Offline metrics on shadow logs: As ground truth labels arrive (fraud confirmed days later, user churned after 30 days, item clicked after the session), join them back to your shadow logs. You now have a real offline evaluation that used production features, not your training set. This is significantly more reliable than evaluating on a held-out split from training data, which may have data leakage or staleness issues.
Agreement rate: How often do the two models make the same decision (at your decision threshold)? High disagreement on a large population warrants investigation — are the new model's disagreements mostly on edge cases, or on your most important users?
Latency and resource usage: Shadow mode gives you a real measurement of production latency under actual load, which synthetic benchmarks often miss.
The fundamental limit#
You can't measure the effect of the new model's decisions on user behavior in shadow mode — because users never see those decisions. If your model's ranking changes what users click on, which feeds back into future training data, shadow mode can't capture that feedback loop. For those systems, you eventually need a canary or A/B test to close the loop.
The practical workflow: shadow mode to de-risk the distribution shift, then a controlled canary to validate the feedback loop.
The key takeaway unlocks after you reveal an expert answer.
Key Takeaway
Safe model deployment is about limiting blast radius while gathering live evidence. Shadow mode gives you production-distribution predictions without user risk — useful for validating prediction distributions and gathering labeled data. Canary progressive rollout is the workhorse for most deployments. A/B testing adds statistical rigor when you're measuring business outcomes. Shadow mode can't capture feedback-loop effects, so you need a canary to close that gap.
Follow-up Questions to Test Yourself
Interviewers often pivot here once you cover the core concept.
- How do you handle the case where your model's predictions drive downstream features — how do you break that feedback loop during evaluation?
- What's the rollback strategy if a model has been in production for two weeks and you've already retrained downstream models on its outputs?
- How would you design a deployment system for a model that serves 100k requests per second?
How confident do you feel explaining this?
Track your understanding or flag it to revisit before your next loop.
Related Questions