Production evaluation for LLMs: replay, canaries, and rollback
Production evaluation connects model quality, system reliability, and user outcomes. Compare versions on paired requests, set release gates for critical slices, and use shadow traffic, canaries, and randomized experiments to answer different release questions.
After this page you will be able to
- Define replayable tasks, success criteria, and critical slices for an LLM application.
- Calculate improvements, regressions, and the overall difference from paired outcomes.
- Choose the question and observation unit for shadow traffic, a canary, and an A/B experiment.
- Set explicit coverage and quality criteria for promotion, further observation, and rollback.
On this page
- From a product goal to a grading contract
- Start with paired offline replay
- What to hold fixed in replay
- Experiment: improvement and release eligibility
- Choose the online stage based on the question
- Recover and turn the incident into a regression case
- Summary and exercises
- Quick self-check
- Design a shadow run for a tool with writes
- Further reading
- FAQ
An LLM release raises three questions. Does the candidate improve a fixed set of tasks? Does it meet system constraints on real requests? Do users complete their tasks more successfully? Paired offline replay, shadow traffic, and online experiments answer different parts of this. Define quality requirements, coverage, and stop conditions before looking at the results.
From a product goal to a grading contract
For an internal documentation assistant, a successful response gives the right steps and valid supporting references. A justified refusal can also count as success when the user lacks access or evidence is insufficient. JSON validity says little about correctness, and a citation can point to a page that fails to answer the question. Write down a traceable task contract.
| Field | Example | Purpose |
|---|---|---|
| Task and input | Ask how to rotate an expiring credential with organizational and access context | Determine whether to answer or refuse |
| Reference evidence | The applicable department’s document revision and section | Inspect retrieval and generation errors |
| Final state | Correct instructions or a handoff to the designated support queue | Distinguish a claim from task completion |
| Traffic slices | Language, access path, short question or multi-turn session | Identify where failures concentrate |
| Version manifest | Model, prompt, index, tools, and application | Reproduce and roll back |
| Observation window | One support session or a specified time limit | Use consistent definitions for timeout and follow-up |
A task can span multiple requests. If you measure success per session, retain the whole session in replay. Choose the unit of online assignment according to where effects can persist. If the same person may retry, keep their assignment consistent and account for repeated observations by user. Groups can also interfere through shared capacity, such as competition for the same GPU pool. Check this with instrumentation or isolation.
Start with paired offline replay
Send the same task to the baseline and the candidate. When evaluating a single component, keep the rest of the configuration fixed where possible. Record both outcomes and count improvements separately from regressions.
For tasks, let count failures that become successes and successes that become failures. The paired change in success rate is:
A pair where both versions fail contributes zero to the difference. Keep it in the denominator and use it to track capabilities both versions lack. A net difference can hide simultaneous improvements and regressions. For uncertainty estimates, see evaluation statistics and keep task or session pairs intact.
What to hold fixed in replay
When testing a prompt or model, provide the same retrieved evidence to both versions to isolate generation changes. For an index change, let each version retrieve from its own index, then measure evidence coverage separately from answer accuracy. Align the document snapshot with the time of a historical request. Use a sandbox or recorded responses for tools with writes. If an external API cannot be restored, report its version, recording date, and replay coverage.
Experiment: improvement and release eligibility
Three synthetic groups represent an update to an internal documentation assistant. This example requires ten paired requests for each critical slice and permits at most a ten-point observed drop. This is a screening rule. Confidence intervals and statistical power require a fuller design. The example ran on an Apple M2 Max and uses the Python 3.12.14 standard library.
# Pairs are (baseline succeeded, candidate succeeded).
groups = {
"common": [(True, True)] * 70 + [(False, True)] * 12
+ [(True, False)] * 3 + [(False, False)] * 5,
"critical": [(True, True)] * 5 + [(False, True)]
+ [(True, False)] * 3 + [(False, False)],
"new locale": [(True, True)] * 2,
}
def score(pairs):
wins = sum(new and not old for old, new in pairs)
losses = sum(old and not new for old, new in pairs)
return wins, losses, (wins - losses) / len(pairs)
combined = [pair for pairs in groups.values() for pair in pairs]
overall = score(combined)[2]
assert overall > 0 and score(groups["critical"])[2] < -0.10
print(f"overall: n={len(combined)}, delta={overall:+.1%}")
for name, pairs in groups.items():
wins, losses, delta = score(pairs)
if len(pairs) < 10:
decision = "collect evidence"
elif delta < -0.10:
decision = "regression"
else:
decision = "pass"
print(f"{name}: +{wins}/-{losses}, {delta:+.1%}, {decision}")
overall: n=102, delta=+6.9%
common: +12/-3, +10.0%, pass
critical: +1/-3, -20.0%, regression
new locale: +0/-0, +0.0%, collect evidence
The widget below makes this table adjustable: drag each slice’s improvements and regressions, tune the gate and the coverage minimum, and watch the overall delta and every slice’s decision — try dragging the critical slice’s regressions from 3 to 7: the total stays positive, but release is already impossible.
The common slice drives the aggregate gain while the critical slice regresses. Two successes in the new locale provide little evidence about reliability, so the gate calls for more observations. One outcome can move a small slice substantially. Keep denominators and both directions of change. For a real release, choose sample sizes based on risk and the effect size of interest and account for multiple slices in your inference or intervals.
Choose the online stage based on the question
| Stage | What users receive | Question | Common mistake |
|---|---|---|---|
| Shadow | Baseline responses | How does the candidate handle real inputs, errors, and load? | Treating unseen candidate responses as observed user outcomes |
| Canary | Candidate responses for a small group | What should stop promotion when users first encounter the candidate? | Overinterpreting a short window or one average |
| Randomized A/B | Responses from the assigned version | How does the candidate affect user outcomes? | Attributing differences in nonrandom traffic to the version |
Keep duplicate writes and billing side effects out of the shadow path. Factor the copied traffic and data access into its design. Canary releases limit the impact of a failure. Estimating product impact requires an assignment unit, observation window, metrics, and stopping rules. A primary metric can track task resolution. Guardrails can cover critical-slice errors, tool timeouts, latency, or cost. Include abandoned requests and those with no response in the outcome definition.
Recover and turn the incident into a regression case
When task completion drops, identify the affected versions and slices. Follow a trace ID through input, retrieval, generation, tools, and final state. Separate deployment, traffic, and dependency changes. After halting further rollout, restore a verified compatible bundle of the model, prompt, index, and tool configuration. Reverting weights alone can leave a mismatched contract.
Check production latency, failures, and task outcomes after recovery. Verify the fix on independent examples. Add traces that distinguish the cause to the regression set. If an index missed documents in a less common language, test that omission and retain a separate holdout to check generalization. Keep enough metadata to trace deployments and failures while limiting copies of sensitive content.
Summary and exercises
- Track improvements and regressions on paired inputs. Define separate quality and coverage gates for critical slices.
- Shadow traffic measures behavior on real inputs, canaries limit exposure, and randomized A/B tests estimate user impact.
- Define the version manifest, stop conditions, and recovery checks before release.
Quick self-check
1. Which measurement can shadow traffic provide directly?
- Candidate timeouts on production inputs
- User resolution after seeing the candidate answer
Users keep receiving the baseline, so the candidate’s effect on user outcomes is unobserved.
2. The average improves but a critical slice has too few cases. What should happen next?
- Follow the predeclared coverage gate and collect more evidence
- Replace the slice measurement with the global average
The global metric cannot supply direct evidence for that slice.
3. Why retain each version’s success flag?
- To count improvements and regressions separately
- Only to calculate two unpaired totals
The same net difference can reflect very different changes across requests.
4. What should a rollback restore?
- A compatible model, prompt, index, and tool bundle
- Any file with the same model name
The application contract and its dependencies need to match after the rollback.
Design a shadow run for a tool with writes
A ticket assistant sends reminders. Design trace fields, an isolated environment, and three criteria for halting rollout.
Worked answer
Record a version manifest, request and session IDs, intended recipients and send times, simulated deliveries, and final ticket state. Reset the sandbox between historical replays and send shadow reminders to an isolated queue. Stop on duplicate delivery, a drop below the critical-slice quality threshold, or a candidate timeout rate above the predeclared limit. Set thresholds according to task costs and coverage.
Further reading
- Machine Learning in Production, Chapter 19 on production testing, shadow traffic, and experimental design.
- Chapter 13 on planning for operations and observability.
- LLM serving and building evaluation sets.
FAQ
- How does shadow traffic differ from a canary release?
- Shadow traffic lets the candidate process production requests while users keep receiving the baseline response. A canary gives the candidate response to a small share of users, making real experience observable while limiting exposure.
- Can I promote a candidate if overall accuracy improves?
- Check the predeclared quality, coverage, and system requirements for critical slices. A regression or inadequate evidence can justify holding traffic steady for more evaluation or rolling back.
- What should I retain for replay?
- Retain authorized task inputs, evidence or reproducible snapshots, the deployment manifest, grading criteria, and expected side effects. Set retention and access rules and isolate dependencies that would otherwise affect real systems.