09 — Monitor & Observe

Shadow Mode & Champion/Challenger#

ValidationPractice 1 min read
◆ The PatternValidating new models in production without serving their predictions

In shadow mode, the new model scores every request alongside the current champion, but only the champion's prediction is served. You collect real production data to compare — without risking user experience. When the challenger wins on key metrics, you promote it.

// Interactive — champion vs challenger comparison
Pattern bridge: Shadow scoring is walk-forward validation running live. In markets, paper trading serves the same purpose — test with real data without real consequences.
Worked example

Champion at 90% accuracy, challenger at 91%, both scoring the same labelled requests. McNemar’s test looks only at the cases where they disagree. After 2,000 requests the p-value is 0.65 — no evidence either way. After 20,000 it is 0.0009. Shadow mode is safe, but a one-point improvement needs a lot of traffic to show.

Where it misleads
  • Shadow mode only sees the champion’s world: if the challenger’s decisions would change user behaviour, the shadow comparison cannot see it.
  • Comparing on the requests that happen to get labels quickly can bias the result.
  • A shadow model doubles serving cost while it runs; set an end date.
In code
from scipy.stats import binomtest
rng = np.random.default_rng(3)

def shadow(n, p_champ=0.90, p_chal=0.91):           # both models score the same n labelled requests
    champ = rng.random(n) < p_champ
    chal = np.where(rng.random(n) < 0.5, champ, rng.random(n) < p_chal)   # they agree half the time by construction
    only_chal, only_champ = (chal & ~champ).sum(), (champ & ~chal).sum()
    return binomtest(only_chal, only_chal + only_champ).pvalue           # McNemar's exact test

p_2k, p_20k = shadow(2_000), shadow(20_000)
Python, in your browser — edit the code and run it again

Assumes import numpy as np and import pandas as pd. Each snippet carries its own example numbers; the comments say which are made up or simulated.

Sources
  • T. G. Dietterich, “Approximate Statistical Tests for Comparing Supervised Classification Learning Algorithms”, Neural Computation 10(7), 1998 — McNemar’s test
  • Trustworthy Online Controlled Experiments, R. Kohavi, D. Tang & Y. Xu, Cambridge University Press, 2020
  • Designing Machine Learning Systems, C. Huyen, O’Reilly, 2022

Last reviewed October 2026 · How this site checks its content · Report a mistake

Check yourself

1. What does shadow mode test?

Show answer

C. Shadow predictions are logged, never served, so any feedback loop through user behaviour stays invisible until an A/B test.

2. On 2,000 shadowed requests the challenger is right 91% of the time, the champion 90%. Promote it?

Show answer

A. The standard error of the difference is about one point here. Paired comparisons (same requests) help, but the sample is still small.

3. What does shadow scoring cost?

Show answer

B. Run the challenger asynchronously, off the request path, and sample traffic if compute is tight.

Linked from 1
← Previous
Alerting & SLOs
Open in the full reader, with the topic sidebar