Lesson 6 of 6 Evaluating ML Models

Validating New Models with Shadow Tests

This lesson explains shadow testing, which runs a new model on real requests alongside the current model without letting its responses reach users, so it can be compared safely before promotion.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe how SageMaker AI shadow tests copy traffic.
  • Compare operational and prediction behaviour.
  • Choose between shadow testing and A/B testing.

How SageMaker AI shadow tests work

A shadow test adds a shadow variant to a production endpoint. SageMaker AI copies a chosen percentage of incoming requests to the shadow variant. Callers always receive the production variant's response; shadow responses are discarded or logged through data capture for comparison. The test runs for a set duration, and a dashboard compares latency, error rates and other CloudWatch metrics of both variants.

What to compare

Operational comparisons include model latency at real request mixes, error rates, timeouts and resource utilisation, often on a different instance type. Quality comparisons use captured predictions: agreement rates with production, prediction distributions and, once labels arrive, accuracy. At the end, the shadow variant can be promoted to production in place, or the test is ended and the variant removed.

The following diagram shows how requests reach both variants during a shadow test of a new recommendation model.

The shadow test of the new recommendation variant. Callers always receive the production variant's response, while SageMaker AI copies 50% of requests to the shadow variant on Inferentia2 for seven days. Both variants' predictions are captured, and the dashboard compares p99 latency, error rates and top-10 agreement before the shadow variant is promoted.
The scenario is illustrative.
Select all that apply

Shadow test metrics

Exam skills 2.3.3

Identify what a shadow test should compare between the production and shadow variants.

Log in to try this activity Interactive activities are free with an account.

Shadow testing compared with A/B testing

Shadow testing has no user impact and suits validating stability, latency and agreement. A/B testing serves the new model's responses to a share of real users, which is needed to measure business outcomes such as conversions, but exposes those users to any defects. Teams often shadow test first, then A/B test. The following table compares them.

Shadow test
Users see new model's responsesNo
MeasuresLatency, errors, prediction agreement, offline accuracy
Risk to usersNone
SageMaker AI featureShadow variant
A/B test
Users see new model's responsesYes, for a traffic share
MeasuresBusiness outcomes, user behaviour
Risk to usersSome
SageMaker AI featureProduction variants with weights
Sort into groups

Shadow test or A/B test?

Exam skills 2.3.3 · 4.1.4

Choose the testing method for each goal.

Log in to try this activity Interactive activities are free with an account.
Worked example

Moving to a new instance type

A team wants to move a recommendation model to a new version on Inferentia2 instances to cut cost, but must not risk user-facing latency or errors.

  • Create a shadow test sending 50% of requests to the new variant on ml.inf2 instances for 7 days.
  • Compare p99 latency and error rates in the shadow test dashboard; capture both variants' predictions.
  • Check that top-10 recommendations agree for at least 95% of requests.
  • Promote the shadow variant when all criteria pass.

Users never received a response from the untested variant, yet the team validated it on a week of real traffic patterns that a synthetic load test would not reproduce.

Check yourself

Which responses do callers receive during a shadow test?

Show answer

Only the production variant's. The shadow variant's responses are recorded for comparison.

Exam Tips

Remember for the exam

  • Validate on live traffic with no user impact: shadow test.
  • Callers only receive the production variant's responses.
  • Compare latency, errors and prediction agreement before promotion.
  • Business outcome measurement needs an A/B test instead.
  • A shadow variant can be promoted to production at the end of the test.