MLOps / Observation, recovery, and lifecycle decisions / Lesson 21
Shadow Evaluation and Coverage
Compare a candidate model in shadow with the active model while controlling side effects and missing comparisons.
On this page
Lesson goals
- Define shadow isolation and paired prediction identity.
- Measure disagreement alongside comparison coverage.
- Set promotion and rollback criteria using outcome evidence.
Define shadow boundaries
A shadow candidate receives eligible inputs for evaluation while the active model continues to drive the production decision. The candidate must not trigger the active workflowโs side effects. Define permitted inputs, privacy controls, timing, resource limits, and the mechanism that enforces isolation before starting a shadow run.
Record active and candidate artifact identities, preprocessing, thresholds, and request identifiers. Compare equivalent inputs and versions; a disagreement may reflect a model change, a feature mismatch, or a timing difference. Shadowing is an observation mechanism, not approval to promote the candidate.
Count paired disagreements
The synthetic example pairs predictions by request identifier and counts differences. Two of three pairs disagree. This is a descriptive comparison, not a quality metric: without reliable outcomes, neither prediction is known to be correct. Inspect consequential disagreements and track how many eligible requests lack a candidate result.
active = {"a": 1, "b": 0, "c": 1}
shadow = {"a": 1, "b": 1, "c": 0}
paired = sorted(active.keys() & shadow.keys())
print("paired", len(paired))
print("disagreements", sum(active[k] != shadow[k] for k in paired))
The two models disagree on b and c among three paired synthetic requests.
Measure missing comparisons
A candidate can appear stable if difficult requests time out or fail before producing a shadow result. Report eligible, paired, failed, and excluded counts with reasons. The second fixture identifies one active request without a shadow prediction; real systems should also distinguish intentional exclusions from failures.
active = {"a": 1, "b": 0, "c": 1}
shadow = {"a": 1, "b": 1}
print("missing shadow", sorted(active.keys() - shadow.keys()))
Request c has an active result but no shadow result in this synthetic fixture.
Wait for comparable outcomes
When labels arrive, compare outcomes for equally mature cohorts and relevant slices, accounting for missing or selective labels. A lower disagreement rate does not imply a better model, and shadow predictions may not reveal the consequences of a different action. Define what the available evidence can and cannot establish.
Make a bounded decision
Set acceptance criteria, owners, observation window, and rollback plan before promotion. Verify candidate capacity and latency without degrading the active service. If coverage or safety checks fail, investigate or extend the evaluation; do not promote based only on a favorable aggregate. Record the decision and retain the previous configuration.
Common errors and fixes
Shadow predictions trigger real actions.
- Why it happens
- The candidate path shares side-effect permissions with the active workflow.
- How to fix it
- Disable or isolate side effects and verify the boundary.
- Prevent it next time
- Test an attempted action before shadow traffic starts.
A candidate looks good because failed requests are omitted.
- Why it happens
- Comparison coverage and exclusions were not reported.
- How to fix it
- Count eligible, paired, failed, and excluded requests.
- Prevent it next time
- Set a minimum coverage criterion.
Agreement is interpreted as accuracy.
- Why it happens
- Predictions were compared without outcome labels.
- How to fix it
- Evaluate mature labeled outcomes and inspect disagreements.
- Prevent it next time
- Separate agreement, coverage, and task performance metrics.
2 practice exercises
1. Active and shadow predictions disagree on two of three paired requests. What does that prove?
Show worked solution
It shows two disagreements in this fixture, not which model is correct. Inspect the cases and compare reliable outcomes when available.
2. One eligible request has no shadow result because of a timeout. How should it be reported?
Show worked solution
Count it as an unpaired failure with its reason, include it in coverage, and investigate whether failures are concentrated in difficult inputs before drawing conclusions.
Key takeaways
- Shadow predictions must not create production side effects.
- Report comparison coverage as well as disagreement.
- Promotion requires outcome and operational evidence.