Compare Two Versions

Each time you change an LLM app, whether that is a reworded system prompt, a different model or a new step, you want to know if it got better or worse. Running the old version and the new one over a test set and comparing the scores answers that question, but only under three conditions. The comparison has to be set up fairly, you have to read the cases behind the totals, and you have to know how far the scores move on their own. They move on their own because a model gives varied answers, so two scores can differ even when nothing changed. These ideas let you tell a real improvement or regression from chance.

A fair comparison changes one thing

A comparison is fair when the score difference has only one possible cause. Both versions answer the same test set, the same graders judge their answers, and exactly one deliberate change separates them. Say you rewrite the system prompt and the pass rate goes from 75% to 85%. If the model, its settings, the cases and the graders are all the same on both sides, the rewrite is the only thing that could have moved the score.

Change two things at once and you lose that. Suppose that in the same week you rewrite the prompt and also add five harder cases to the test set. If the score drops, you cannot say whether the new prompt is worse or the new cases are harder. Graders work the same way: a stricter grader on one side lowers that side's score without the app doing anything different. When a test set or grader has to change, run the old version again with the new set or grader first, so both sides are measured the same way.

What each side of the comparison uses
PartVersion A (accepted)Version B (candidate)
Test setThe same 40 casesThe same 40 cases
GradersThe same graders and judge promptThe same graders and judge prompt
Model and its settingsUnchangedUnchanged
System promptOld wordingNew wording

Using the same cases on both sides also has a statistical benefit. Every case has a result from both versions, so you can compare them case by case instead of only comparing two totals. The next section shows why that matters.

True or false?

If version B scores higher than version A, but B was also graded with a newer, more lenient judge prompt, the higher score shows that B is better.

False. Two things changed, so there are two possible explanations. Grade both versions with the same judge prompt before you credit the app change.

When the test set has to grow, the fair move is to run the old version on the new set too, so both scores come from the same cases.

True. A score only compares with another score measured on the same cases, so the old version needs a fresh result on the grown set.

Read the cases that changed

The difference between two pass rates is a net figure: the cases that started passing minus the cases that started failing. Two versions can therefore have identical totals while many cases changed underneath. Think of a 40-case test set where version A passes 30 and version B also passes 30. The totals suggest nothing happened. Lining up the results case by case can show otherwise.

The same 40 cases, sorted by their result on each version
Result on AB passesB fails
A passes26 (still pass)4 (broken)
A fails4 (fixed)6 (still fail)

The change fixed four cases and broke four others. Those two groups are the only part of the comparison with new information, and they need to be read separately:

  • Fixed cases show what the change did well. If they all belong to the failure mode the change was meant to fix, the change did what you intended.
  • Broken cases show what the change cost. Read each one: what did the new answer get wrong that the old answer got right? Four broken cases that share a cause, such as the new prompt making answers so short that a required fact drops out, point to a real regression to fix before shipping.

Reading the answers also tells you whether the app or the grader failed. A case can break because a correct new answer was worded in a way a strict text check did not expect. In that case the grader needs fixing, not the app.

The case-by-case view works best grouped by failure mode. A version can improve one failure mode by 3 cases and worsen another by 3, and that tradeoff matters more than the unchanged total. A failure mode that harms users, such as stating a wrong refund policy, can outweigh several fixed cases of a minor one.

The changed cases, listed for reading
CaseFailure mode it probesAB
case 07Missing required factpassfail
case 12Missing required factpassfail
case 19Answers out of scopefailpass
case 23Answers out of scopefailpass

True or false?

If the new version passes the same number of cases as the old one, the change had no effect on behaviour.

False. An equal total can hide cases fixed and cases broken in equal numbers. Only the case-by-case comparison shows them.

A case that went from pass to fail may point to a grader problem rather than an app problem.

True. A correct answer worded differently can fail a strict check. Reading the answer tells you which one needs fixing.

The same app scores differently from run to run

Some of the cases that move between two versions would move even without any change. A language model does not always give the same reply to the same input. API documentation describes model outputs as non-deterministic by default: send an identical request twice and the replies can differ. Most of the time the difference is only in wording, but sometimes it decides whether a required fact is included or a rule is broken, and the case flips between pass and fail.

The sampling temperature is the setting that controls how much randomness the model uses when it picks each next word, and 0 asks for the least. Setting it to 0 does not remove the variation: providers state that identical inputs can still produce different outputs at temperature 0. Studies of inference servers trace a main cause to batching. The server processes your request together with other requests, and the size of that batch depends on the current load. With a different batch, the arithmetic can come out slightly differently, and so can the reply. In one published experiment, 1000 requests with the same prompt at temperature 0 produced 80 distinct completions. Some providers offer a seed option that makes output more repeatable, but they describe it as best effort, not a guarantee.

Lowering the temperature to make scores less noisy also changes the app you are measuring. If the app runs at a certain temperature for users, evaluate it at that temperature and handle the noise by measuring it. A model grader is a model too, so its verdicts can also vary between runs.

True or false?

With temperature set to 0, running an unchanged app twice on the same test set always gives the same score.

False. Identical requests can still return different outputs at temperature 0, for example because the server batches requests differently under different load.

Measure the spread before you compare

The way to find out how much your score moves on its own is to measure it. Run the unchanged version over the same test set several times, for example five, and look at the range of its pass rates. That range is the size of the noise. A difference between two versions is only believable when it is clearly larger than that range.

Five runs of unchanged version A, then one run of B (40 cases)

pass rate (%)

  • A run 1 72.5
  • A run 2 77.5
  • A run 3 75
  • A run 4 70
  • A run 5 77.5
  • B run 1 77.5

Version A alone ranges from 70% to 77.5% over five runs, three cases apart. If B scores 77.5% once, that is a result A also reached, so it gives no evidence that B is better. Had you compared B against A's run 4 only, you would have seen a 7.5-point gain that comes entirely from noise.

The same measurement works case by case. The runs of A show which cases are unstable: those that pass in some runs and fail in others. When one of those cases changes between A and B, it tells you little. A case that A passed in every run and B now fails is much stronger evidence of a regression. To reduce noise, run each case several times on both versions. Each case then has its own pass rate on each side, the average of its runs, and comparing those per-case pass rates is steadier than relying on single runs.

Five runs of each version, same 40 cases

pass rate (%)

  • Version A
  • Version B

Here the two spreads do not overlap: B's lowest run is still above A's highest. That gap is larger than what A does on its own, so it is a difference worth believing. You would still read B's broken cases before accepting it.

True or false?

A case that passes in some runs of the old version and fails in others is weak evidence when it changes between versions.

True. It already changes without any change to the app, so a flip between versions can be noise alone.

Small test sets give wide margins

A pass rate from a test set is an estimate: it is your best guess, from a sample, at how often the app would pass cases of this kind in general. How precise that estimate is depends mostly on how many cases you have. With 40 cases each case is worth 2.5 percentage points, so a single answer that changes between runs moves the score by 2.5 points. With 25 cases one answer is worth 4 points, and with 100 cases it is worth 1.

The standard way to put a number on that precision is the standard error of the pass rate. The first formula below computes it from two numbers: \( p \), the pass rate as a fraction (0.8 for 80%), and \( n \), the number of cases. About 95% of the time, the true rate lies within 1.96 standard errors of the measured one, a range called the 95% confidence interval.

$$SE = \sqrt{\frac{p\,(1 - p)}{n}}$$

Standard error of a pass rate

$$p \pm 1.96 \times SE$$

95% confidence interval

Put in numbers: at an 80% pass rate on 40 cases, the standard error is about 0.063, so the interval runs about 12 points either side. A measured 80% is consistent with a true rate anywhere from about 68% to 92%. The table shows how the margin narrows as the set grows.

Precision of an 80% pass rate by test set size
CasesOne case moves the score by95% interval
254 points± 15.7 points
402.5 points± 12.4 points
1001 point± 7.8 points
4000.25 points± 3.9 points
10000.1 points± 2.5 points

The number of cases sits under a square root, so the margin shrinks slowly. Ten times as many cases narrows the interval only about 3.2 times (the square root of 10). Going from 40 to 400 cases takes the margin from about 12 points to about 4.

95% margin of an 80% pass rate as cases grow

margin (± points) against cases in the test set

  • margin

That does not make a small set useless. It decides which differences the set can detect. A few dozen cases built from real failures will reliably show a large effect: a change that fixes a failure mode outright, or one that breaks a whole group of cases. Small differences of a few points get lost in the margin. One statistical analysis of evals works out that detecting a 3-point difference takes close to a thousand questions. When you need to tell small differences apart, adding cases is the way to narrow the margin.

Comparing the same cases on both versions also helps. Many cases are easy for both versions or hard for both, so they give the same result on each side. The per-case differences therefore vary less than the two totals do. A comparison built on those per-case differences has a smaller error than two separate intervals placed side by side. That is a second reason for keeping the test set identical on both sides.

True or false?

On a 40-case test set, a version that scores 5 points higher than another in a single run has shown that it is better.

False. Five points is two cases out of 40, well inside a margin of about 12 points, and within what run-to-run variation alone can produce.

Doubling a test set from 100 to 200 cases does not halve the width of the confidence interval.

True. The width shrinks with the square root of the number of cases, so doubling it narrows the interval only about 1.4 times.