Shadow deployment

Also known as: shadow mode

On this page 7

Shadow deployment is a release technique in which a candidate machine learning model receives a copy of real production requests and produces predictions that are logged but never returned to users, while the current model keeps serving every response. In MLOps & deployment, it is the standard way to validate a new model against live traffic with zero user exposure, before any canary rollout or A/B test begins.

The approach is also called shadow mode, dark launching or traffic mirroring. Its value lies in answering a question offline evaluation cannot settle: whether a model that scored well on a held-out dataset still behaves correctly, quickly and stably when it meets real inputs, real feature pipelines and real load.

How shadow deployment mirrors production traffic

A shadow deployment works by duplicating each inference request so that two models process it: the production model whose answer goes back to the caller, and the shadow model whose answer goes only to a log or analytics store. The caller sees no difference in behavior, and in a well-built system it sees no difference in latency either.

Mirroring can happen at several layers. A service mesh or API gateway can copy HTTP traffic to a second endpoint, a model server such as KServe or Seldon Core can route a request to a shadow predictor, and an application can publish requests to a message queue that a separate shadow consumer reads. The safest designs make the shadow call asynchronous and fire-and-forget, so a slow or failing shadow model can never delay or break the production response.

The following table shows the main components of a typical shadow setup and the role each one plays.

ComponentRoleTypical implementation
Traffic mirrorCopies requests to the shadow pathGateway rule, mesh mirroring, queue fan-out
Shadow model serviceComputes candidate predictionsSeparate deployment or inference pipeline
Prediction logStores paired outputs with request IDsEvent stream, data lake table
Comparison jobMeasures agreement and qualityBatch analysis or streaming metrics
Isolation controlsBlocks shadow side effectsRead-only credentials, disabled writes
Components of a shadow deployment

What a shadow model is measured on

Shadow evaluation covers three families of evidence: operational health, behavioral agreement and, when labels arrive, predictive quality. Operational checks often reveal more problems than accuracy checks, because they expose training-serving skew, missing features and resource limits that offline tests never touch.

The metrics below are the ones teams most often track during a shadow period, together with what each one reveals.

MetricWhat it revealsTypical acceptance signal
Latency percentilesServing cost of the new modelp99 within the service budget
Error and timeout rateStability under real loadComparable to or below production
Prediction agreementHow often outputs match productionDisagreement explained, not random
Output distributionShifts in scores or classesNo unexpected prediction drift
Feature null rateMissing or malformed inputsMatches values seen in training
Delayed quality metricsAccuracy once ground truth arrivesEqual to or better than production
Common shadow deployment metrics

Disagreement alone is not a verdict. A candidate model is often deployed precisely because it should disagree on certain cases, so analysts segment disagreements by input type and inspect samples. Where outcome labels arrive late, as in fraud or credit risk, the shadow period must last long enough to collect delayed ground truth before a quality claim is credible.

Shadow deployment compared with other release strategies

Shadow deployment is the lowest-risk validation step among progressive release strategies, because no user ever receives a shadow prediction. That safety has a price: shadow testing cannot measure the effect of a model on user behavior or business outcomes, which only exposed traffic can reveal.

The table compares shadow deployment with neighboring strategies used in model promotion.

StrategyUser exposureMeasures user impactMain purpose
Shadow deploymentNoneNoValidate behavior and performance safely
Canary releaseSmall share, often 1-10%PartiallyCatch failures with limited blast radius
Model A/B testingSplit cohortsYesCompare business outcomes statistically
Champion-challenger modelVaries by designOftenKeep a standing contest between models
Blue-green deploymentFull switchAfter switchFast cutover and simple rollback
Release strategies for machine learning models

In practice these strategies form a sequence. A typical promotion path runs offline evaluation, then shadow, then canary, then A/B test, with model rollback available at each stage. Shadow mode is sometimes confused with the champion-challenger pattern; the difference is that a challenger may actually serve some decisions, while a shadow model never does.

Designing a safe shadow setup

The central design rule is strict isolation of side effects. A shadow model must never send emails, write to production databases, trigger payments or update caches that the production path reads. Models that call external tools or agents need special care, because any action they take in shadow mode would be a real action with real consequences.

Teams also decide how much traffic to mirror. Full mirroring doubles inference cost, so many organizations sample 5-20% of requests for expensive models and mirror everything for cheap ones. Each mirrored request should carry a shared request identifier so that production and shadow outputs can be joined reliably for comparison.

The decision table below summarizes common design choices.

SituationRecommended choiceReason
Cheap model, high trafficMirror all requestsMaximum evidence at low cost
Large language modelSample a fixed shareControls GPU spend
Stateful or tool-using modelStub every write actionPrevents real side effects
Rare-event predictionRun for weeks, not daysEnough positive cases to judge
Strict latency budgetAsynchronous mirroringProduction path stays unaffected
Design choices for shadow traffic

Limitations and common mistakes

Shadow deployment has blind spots that experienced practitioners plan around. The most important is the feedback loop problem: in recommendation and ranking systems, the logged user behavior was shaped by the production model, so the shadow model is judged on outcomes it never influenced.

  • Hidden coupling: a shared cache or feature store write lets the shadow model affect production indirectly.
  • Unequal inputs: the shadow path reads features from a different source, so the comparison tests two pipelines rather than two models.
  • Cost surprises: full mirroring of a large model can double the inference bill without anyone noticing.
  • Endless shadowing: without predefined exit criteria, candidates stay in shadow for months and block model promotion.
  • Privacy scope: mirrored requests may carry personal data, so logs need the same retention and access rules as production.

Mature teams address these risks by writing explicit promotion criteria before the shadow period starts, such as latency limits, a maximum unexplained disagreement rate and a minimum sample size, so the decision to advance is evidence-based rather than a matter of impatience.

In everyday language

Think of a new pilot sitting in a flight simulator that receives the exact same signals as a real aircraft. The pilot makes every decision, but the controls are not connected to anything. Instructors watch and compare those choices with the real captain’s choices.

A shadow deployment does the same for software that makes predictions. The new model sees real requests from real customers. It gives its answers, but nobody receives them. Engineers compare them with the answers of the trusted model. If the new model proves fast, stable and accurate, it earns a real job. If it fails, no customer ever noticed.

Seen in the real world

A payments company plans to replace its card fraud model with a new gradient-boosted model trained on fresher data. Offline tests show a higher detection rate, but the team knows that fraud labels arrive up to 60 days later through chargebacks, and that several features are computed differently in real time than in training.

The team mirrors all authorization requests to the new model for eight weeks through an asynchronous queue, logging scores next to production decisions. In the first week the logs reveal a feature null rate of 12% for merchant category, caused by a schema mismatch, which is fixed before any customer is affected. After chargebacks arrive, the shadow model shows fewer false declines at equal fraud capture, and it moves on to a 5% canary release with clear evidence behind the decision.