Chapter 10. Comparing Prompts, Models, and Agent Configurations Offline
Northstar has an offline evaluation that checks a support agent against reviewed cases. The team now wants to compare a candidate with its current configuration: should a revised prompt, a different model, or a tool-routing change become eligible for the next release stage? Running each configuration on unrelated cases would make the comparison difficult to interpret. Instead, the team can evaluate both on the same versioned tasks and inspect what changed for each one.
This chapter uses fictional cases and outcomes. Its shared Python lab executes two scripted configurations against the same isolated fixtures and pairs the results. It does not call a model or establish production readiness.
10.1 Define the question before looking at results
An offline candidate comparison runs configurations on controlled, versioned cases. It is not a randomized online A/B test of user outcomes, nor is it off-policy evaluation from logged interactions. Those methods have different populations, assignments, estimands, and assumptions.
Northstar’s primary question might be: “On the specified offline task set, what is the candidate-minus-baseline difference in verified task completion?” The unit is the case, or the case family if the sampling and analysis plan treats related variants as one cluster. The team also declares safety gates, relevant task slices, latency and cost measures, a minimum meaningful effect, the uncertainty method, and an owner. Predeclare how to handle multiple comparisons, repeated looks, missing attempts, and stopping.
A positive mean cannot compensate for a confirmed unauthorized state change. Likewise, an incomplete result is not a failure automatically attributable to the agent or a passing case. It needs a separately reported status and a predeclared decision rule.
10.2 Freeze the comparison envelope
Record a comparison plan before executing either variant:
| Artifact | Baseline and candidate requirements |
|---|---|
| Candidate manifests | Resolve prompt content and renderer, model/provider identifiers and settings, agent code, tool schemas, policy, permissions, and relevant configuration. Record which component changed. |
| Cases and splits | Use the same versioned cases and initial state for both variants; identify family groupings, selection basis, and protected holdouts. |
| Harness and environment | Pin versions, tool behavior, sandbox settings, reset policy, budgets, retry policy, and isolation. Do not send test writes to production. |
| Evaluators | Pin deterministic checks, rubrics, judge and parser versions, and qualification evidence. If a grader changes, regrade both sides comparably and distinguish a measurement change from an agent change. |
| Execution and analysis plan | Specify repetitions, execution order, time windows, outcome definitions, safety and slice gates, missingness, sample plan, uncertainty, and decision rules. |
A seed can help reproduce a local stochastic fixture, but it does not ensure the same random events or paired randomness across two models. Provider aliases may change even if their names do not; save the identifiers and metadata actually available, and report any inability to reproduce the model. If time or order effects matter, balance or randomize run order under the declared plan.
Keep the final holdout out of candidate selection, prompt tuning, and evaluator calibration. Related case variants should not leak across protected splits. A comparison used to choose a candidate is development evidence; independent confirmation requires separately governed evidence.
10.3 Run matched cases and retain every attempt
For each planned case, create isolated state for baseline and candidate, then capture the same required evidence for each: case and attempt IDs, configuration and evaluator versions, status, response, tool events, state checks, latency, cost, and any safety findings. A run envelope and result record can reference access-controlled evidence rather than embedding unnecessary sensitive content.
When stochastic behavior warrants repetitions, specify how many attempts each variant receives and how they are aggregated. Attempts from the same case or family are not automatically independent observations. Analyze at the declared unit and use uncertainty methods that respect clustering; plan sample size or power for the intended effect and analysis rather than counting paraphrases as independent users.
Keep timeouts, evaluator abstentions, budget exhaustion, infrastructure errors, and retries in the record. Apply the same predeclared retry policy to both variants. If a required side of a pair is missing, report the missing pair and investigate its reason; complete-case differences alone can be biased when missingness depends on the variant or task. Do not silently drop the missing row, select the first favorable retry, or fill it with a passing score.
10.4 Inspect the paired result and the safety gate
The following fixture represents one complete attempt per variant on each of eight fictional cases. The outcomes are supplied, not generated by an agent or validated against a policy. In the last case, the candidate has a confirmed unauthorized write, so the example applies a hold even if its average completion improves. It illustrates the arithmetic and decision priority, not a production-ready result aggregator.
cases = [
("routine-1", True, True, False),
("routine-2", True, True, False),
("routine-3", True, False, False),
("boundary-1", False, True, False),
("boundary-2", True, True, False),
("tool-failure", False, True, False),
("ambiguous", False, False, False),
("unauthorized", True, True, True),
]
baseline = sum(row[1] for row in cases)
candidate = sum(row[2] for row in cases)
unsafe = sum(row[3] for row in cases)
paired_difference = sum(int(row[2]) - int(row[1]) for row in cases) / len(cases)
print(f"complete pairs: {len(cases)}")
print(f"baseline completion: {baseline}/{len(cases)}")
print(f"candidate completion: {candidate}/{len(cases)}")
print(f"paired candidate-minus-baseline: {paired_difference:+.3f}")
print(f"candidate unauthorized writes: {unsafe}")
print("decision:", "hold" if unsafe else "needs remaining gates")complete pairs: 8
baseline completion: 5/8
candidate completion: 6/8
paired candidate-minus-baseline: +0.125
candidate unauthorized writes: 1
decision: hold
Here the candidate improves two cases and regresses one, so the net difference is one completion across eight matched cases. The denominator is eight complete fixture pairs, not production users; a single unsafe write blocks advancement. The example does not calculate an interval, apply the rest of the release gates, validate missing data, or implement an insufficient-evidence decision. “Needs remaining gates” is deliberately not a ship decision.
In a real analysis, report the paired estimate together with an uncertainty interval suitable for the planned sampling and clustering design, counts per slice, all missing attempts, and critical safety outcomes. A fixed, selected regression set describes those cases; it does not by itself establish population-level improvement. Small samples and rare harms need particular caution. If required evidence, evaluator qualification, or a planned interval is unavailable, follow the plan’s insufficient-evidence rule instead of claiming a reliable gain.
10.5 Decide and hand off
The comparison report links the plan, manifests, case-set and split versions, attempt records, grader qualification, per-case results, aggregate and slice metrics, costs, uncertainty, missingness, and decision owner. A confirmed non-compensable safety failure means hold. Otherwise, missing required evidence means insufficient evidence; an eligible candidate must still meet every predeclared quality, safety, and evidence gate.
Eligibility is a handoff, not automatic deployment. Release integrity controls must bind the evaluated artifacts to the candidate being deployed. Shadow evaluation and bounded canary deployment then provide different operational evidence, and neither alone estimates a randomized live user effect. After production review, privacy-approved findings can return as new development or regression cases without contaminating protected holdouts.
Hands-on lab: matched fixture runs
The eight-case example above isolates the arithmetic using supplied outcomes. The separate lab below uses three cases to show how a runner records paired attempts and applies decision rules; its results are not the eight-case results.
Run python code\workflow\lab_workflow.py from the repository root after installing the companion package. The offline portion runs baseline and candidate on the same three cases. The baseline intentionally misses one eligible refund; the candidate satisfies all three fixture checks. The output reports three complete pairs and a candidate-minus-baseline check-pass difference of approximately +0.333. Correct refusal is a passing check, not an independently verified user completion. Both per-case attempt records and their configuration, case and evaluator identities are retained in memory.
The comparator reports a candidate safety failure as hold even when its mean improves. Otherwise it returns insufficient_evidence, including when a pair is incomplete: these selected cases, a descriptive difference and no independent confirmation cannot authorize rollout. The complete-pair estimate is displayed alongside missing-pair counts, and may be biased if missingness depends on the configuration. The lab has one attempt per case, no confidence interval, no real model calls, no slice-level inference, and no evaluator calibration. It rejects holdout cases during candidate comparison. Protect holdouts with access controls in a real system; a Python flag is not an authorization system.
Run python -m unittest discover -s code\tests -p "test_workflow_lab.py" -v to check pairing, missing evidence, holdout restrictions and safety priority.
Exercises
- Change one candidate completion in the fixture and recompute the paired difference. Explain why the safety hold remains independent of the mean.
- Specify how your report changes if a candidate attempt times out and its final state is unknown. What evidence is needed before calling it safe?
- Design a repeated-attempt plan for related case families and explain the unit used for uncertainty. Why is the number of attempts not necessarily the number of independent cases?
- Describe how to compare both variants after a rubric or judge version changes, without attributing a measurement change to the agent.
For product managers. Ask what changed between the two configurations, which cases were compared, whether any safety or slice regressed, and what remains unknown. A favorable offline average is not permission to expose users or a causal estimate of product impact.