Evaluation & Testing
Prompt A/B testing: measure outcomes without changing the judge
Keep assignment, tool conditions and evaluation rules stable so a prompt comparison measures the agent change you intended to test.
A prompt A/B test should answer a specific question about behavior. “The new prompt looks better” is not enough to decide whether to expose more users to it.
State the expected change
For a synthetic order agent, the hypothesis might be: requiring a confirmed receipt before saying an order is complete reduces false-completion claims without increasing unnecessary refusals. Define both outcomes and the evidence needed to review them.
Keep latency, cost and additional tool calls as guardrails. A change that fixes one wording problem by repeatedly retrying a non-idempotent write may create a worse operational problem.
Start with a paired offline comparison
Run both prompts on the same frozen cases and controlled tool conditions. Preserve the full responses, tool results, prompt versions and evaluator version. Include pending, rejected, recovered and wrong-object cases, not only the original failure.
Use repeated runs where model variability matters. Review which individual cases changed rather than relying only on the average score. These synthetic development results support a release decision but do not establish performance on customer traffic.
Assign production traffic consistently
Choose an assignment unit that fits the workflow, such as a conversation rather than a single message, so a user does not unexpectedly switch prompts halfway through a task. Record the assigned version and actual version used. Check assignment counts and logging completeness before comparing outcomes.
Keep tool policies, evaluation rules and unrelated application changes stable during the comparison. If they must change, record the change and reconsider which observations remain comparable.
Decide the review and stopping rules in advance
Specify a minimum observation window, the primary outcome and the conditions for stopping on harm. Avoid repeatedly checking results and declaring a win the moment a favorable difference appears. Small or biased samples should be reported as inconclusive.
Choose the assignment unit before the metric
A prompt A/B test can be invalid even when the dashboard calculates its arithmetic correctly. If one conversation alternates between prompts, earlier turns contaminate later ones. If two variants operate on the same order, one may change the state that the other observes. Assign at a unit that respects those dependencies, such as a conversation or account, and keep that assignment stable for the experiment.
For offline comparisons, give both variants equivalent inputs and independently resettable tool state. Do not execute real payment or cancellation writes twice just to obtain paired outputs. Use a sandbox for side effects and distinguish frozen-observation replay from a fresh agent run.
| Choice | Concrete example |
|---|---|
| Primary outcome | Correct account closure with an accurate final response |
| Guardrails | Unauthorized actions, unsupported completion and latency |
| Assignment | Stable per conversation, with spillover risks documented |
| Exposure | Only requests eligible for this workflow |
| Decision rule | A planned analysis window and a minimum improvement worth shipping |
| Rollback | A named owner and a clearly defined harmful outcome |
Why an average score can pick the wrong prompt
Imagine two synthetic variants evaluated on 100 cases. B fixes ten verbose responses but newly claims success on two rejected actions. A single averaged helpfulness score could favor B, even though the two new failures violate a release gate. Report critical subgroups and severe outcomes separately from overall preference.
Also inspect whether a variant avoids the task. A prompt that refuses every tool call may eliminate false completion by eliminating useful completion. Track task success alongside honest failure reporting. Keep the same evaluator policy for both variants, and blind reviewers to the variant where practical.
Decide what the experiment actually supports
A small pilot can reveal broken instrumentation or an obvious regression. It cannot prove a small conversion improvement without enough independent observations. Choose the sample size from the baseline rate and minimum effect that matters; avoid repeatedly stopping when a noisy result first looks favorable. Record inconclusive results as inconclusive, preserve the candidate versions and test new traffic after any eventual rollout.
Review alerts and an independently selected sample of unflagged cases. Keep reviewer corrections separate from original predictions. The evaluation guide explains why changing the judge during the test can manufacture an apparent improvement, and the recovery guide helps define the outcome boundary.