Own Weights

Shadow testing a new model in production before you switch

Shadow deployment for an LLM: run the new model beside your current API on live traffic, compare outputs, then cut over or roll back safely.

Updated

A shadow deployment for an LLM sends every live request to your current model and to a new model at the same time. Users get only the current model’s answer, and the new model’s answer is logged beside it, so you can compare the two on real inputs before anything changes for users.

This is the step after offline evaluation. You should already have a test set built from your own data, the current model scored on it, and a candidate that beat the current model on that test. Shadow testing checks that the win holds on the traffic you actually receive, which is never exactly the test set. For building that test set, see how to test an LLM on your own data.

What is shadow deployment for an LLM?

A shadow deployment is the normal request path with the new model attached. A router sends the request to the current model and returns that response. It also sends the same request to the candidate in the background. Both outputs go to a log with the request id, the model name, the prompt version, the token counts and the time each call took.

Nothing the candidate returns reaches a user, so a bad answer costs you only the extra inference for the test window. That makes shadowing the lowest-risk way to see a new model on real traffic.

How do you run two models side by side in production?

Keep the prompt identical for both models. That means the same system prompt, the same retrieved context and the same output format instructions. If the prompts differ, you are measuring your setup, not the models.

Give the candidate call a short timeout, and treat a timeout as a logged result, not a silent drop. Log errors too. A candidate that returns output your parser rejects is a finding you need before the switch. The background call must never hold up the user’s response, so run it asynchronously.

Shadow testing, A/B testing or canary: which one first?

Shadow testing and A/B testing answer different questions. A shadow test compares outputs and changes nothing for users. An A/B test splits real users between the two models and measures an outcome, such as whether a reviewer accepted the answer. A/B testing needs a metric you trust and enough traffic to see a difference. Shadow testing needs neither to start.

A canary release comes after shadowing. You send a small share of real requests to the new model and return its answers to those users. If the checks on that share look wrong, you set the share back to zero. Canary is the point where the new model’s answers reach people, so take that step only after the shadow logs look good.

How do you roll out a new AI model without breaking things?

Use stages, and make each one reversible:

  1. Shadow. All requests return the current answer. The candidate runs beside it, and you label a sample of the differences.
  2. Canary. A small share of real requests returns the candidate’s answer. In a hypothetical rollout, that share might be 5 percent, held there while you check.
  3. Ramp. Raise the share in steps while your checks hold.
  4. Cutover. All requests go to the new model. Keep the old model’s version and config ready to restore until the new one has carried full traffic for a while.

Write the pass and fail rules before step one. Decide what counts as a failure, such as a schema error rate or a reviewer rejection rate, before you see the numbers. Otherwise every result can be explained away as acceptable.

Agreement with the current answer is a weak signal. Two models can disagree, and the new one can be right. Label the disagreements, by hand or against a written rubric. Count the cases where the candidate is right and the current model is wrong, and the reverse. That count decides the switch. Keep your offline test set running during the rollout too, because it catches regressions that a few days of shadow traffic will not show. For more on reading small score gaps, see is the new model really better.

When is shadow testing the wrong choice?

Shadow testing costs more than it looks like. You pay for two inference calls on every request during the window, and the candidate’s bill is real even though no user sees its output. Low volume is another problem. Few requests means few disagreements to read, so the test runs for a long time before it says anything.

Skip it, or shorten it, in these cases:

  • The task is broad or changes every week. A fine-tuned model can win on a narrow task with good data. For a moving target, it may be the wrong tool.
  • You cannot switch back quickly. Fix the rollback path first.
  • A wrong answer is costly and nobody reviews the output. A shadow log shows disagreement, not truth. Keep a reviewer in the loop.
  • Your offline test set is small or unlabeled. Shadow results on unlabeled traffic mostly show where the models differ, not which one is right.

The free AI cost audit maps your AI calls from your code, so you can see which task is the best first candidate for a shadow test. Start at Own Weights, or ask for a call about one task.

Questions

How do I safely switch LLM models in production?

Finish offline evaluation first, then run the new model on live traffic without showing its output. Move a small share of real requests to it, raise that share in steps while your checks hold, and keep the old model ready to take all traffic back.

Is A/B testing LLM models in production the same as shadow testing?

No. A/B testing splits real users between two models and measures an outcome, so users see different answers. Shadow testing shows users only the current answer and compares the new model's output in the background.

What is a canary release for an AI model?

A canary release sends a small share of real requests to the new model and returns its answers to those users. It comes after shadow testing, once the logs show the new model's answers are worth letting some users see.

How do I roll out a new AI model without breaking things?

Use stages with a way back at each one: shadow, a small canary, a ramp, then full cutover. Keep the old model's version and configuration deployable until the new one has carried full traffic for a while.

Can I run two models side by side in production?

Yes. A router sends each request to both models, returns only the current answer, and logs both outputs. You pay for both calls for as long as the test runs, so keep the window short and the logs useful.