Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Judge Two Answers in Both Orders

In this lesson, you compared your two prompt versions with a pairwise judge, ran every pair in both orders, and counted a win only when both orders agreed.

Key Points

  • A pairwise judge compares two answers. Your checks in the first lesson passed both prompt versions, v1 and v2, on all thirty-six answers. A pairwise judge sees both answers at once and picks the better one on one criterion: here, your status criterion from the last lesson, asked as a comparison.
  • A pointwise judge can’t rank two answers. Your status judge grades one answer at a time, so it gives each version its own pass rate: how often an answer is good enough, not which of two answers states the status better.
  • Save the pairs first. evals/pair-answers.js asks the assistant each of the twenty status questions once with each version and saves the question, the latest report, and both answers as one line of evals/pairs.jsonl, so every judge call sees the same pairs.
  • The judge’s reply is a reason, then a winner: "first", "second", or "tie" when neither answer states the status better, checked with Zod. The answers go inside <first> and <second> tags. pick() sends a pair in the order you give it, turns "first" or "second" back into a version name, and passes a tie through as it is.
  • The order can change the verdict. On the pair for “Le col de Fenêtre est-il enneigé ?”, both answers give the old snow below the col. With v1 first, the judge picked v1, the first answer. With the same answers swapped, it called them a tie, so the pair fails the both-orders check.
  • A split can come from position bias. The split is consistent with position bias, a judge favoring a place whatever the answer, though a repeated call can also change a verdict. Whichever place a judge leans toward, always putting one version there hands it that lean on every pair.
  • Count a win only when both orders pick the same version. Two ties make a tie, and a pair whose orders disagree is a split. A tie is the judge’s verdict that neither answer is better; a split is two verdicts that disagree.
  • One order hides the splits. In one recorded run on 1 December 2026, with v1 first, v1 won ten pairs, v2 won one, and nine tied. Counted both ways, v1 won eight, v2 won one, eight tied, and three pairs split.
  • Three splits can name the wrong winner. In this run, three of the twenty pairs failed the check: between two closer versions, that’s enough to name the wrong winner, and one order can’t tell you which three. In three judge runs over one saved set of answers, one to three pairs split, and v1 led every time. Your numbers will differ.
  • Both orders double the judge calls: forty for twenty pairs.
  • v1’s lead is on one set of answers, by the judge’s word alone. v2 is the shorter version, and judges can also favor longer answers, so the lead isn’t settled until you check the judge against your own grades.

Final Code

The lesson adds three files to the project. Add two scripts to package.json, so npm run pair-answers saves the pairs once and npm run pair judges them in both orders as often as you like:

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

00:00 In the first lesson, your checks passed both prompt versions, v1 and v2, on all thirty-six answers. v2 adds one rule: answer in one short sentence.

00:12 Your status judge from the last lesson grades one answer at a time, so it gives each version its own pass rate. That tells you how often an answer is good enough.

00:22 It can’t tell you which of two answers states the status better. For that, you show a judge both answers at once and ask which one is better. That’s a pairwise judge.

00:35 First, this script asks the assistant each of the twenty status questions twice, once with each version. It saves the question, the latest report, and both answers as one line of a file.

00:48 So every judge call sees the same pairs.

00:53 The judge keeps your criterion from the last lesson, asked as a comparison. Of the two answers, which one states the status the way the report gives it? Two answers can state it equally well, so the judge can also answer tie.

01:09 The answers go inside first and second tags. Zod checks that the reply has a reason, then the winner, which is first, second, or tie. A short function, pick, sends a pair in the order you give it.

01:24 Then it turns first or second back into a version name, and passes a tie through as it is.

01:32 The loop calls pick twice for every pair. The first call puts v1 first. The second call swaps them, so v2 goes first. Run it, and look at the v1 first column.

01:46 v1 won ten pairs, v2 won one, and nine tied. That looks like a clear lead.

01:54 Take one pair. A hiker asks, in French, whether there’s snow on the Col de Fenêtre. Both answers give the old snow below the col, from the same report. With v1 first, the judge picked v1, the first answer.

02:11 The second call swaps them. Same two answers, same report, with v2 now first. Which does the judge pick now? It called them a tie. v1 won in first place, but only tied in second.

02:26 The answers stayed the same and only their places moved, yet the two orders disagree on this pair. A judge that favors a place, whatever the answer, has position bias.

02:38 A repeated call can also change a verdict, so one disagreement doesn’t prove which cause it was. Whichever place a judge leans toward, putting one version there every time gives that version the lean on every pair.

02:52 So you judge both orders.

02:56 So count a win only when both orders pick the same version. Two ties make a tie. When the orders disagree, the pair is a split. A tie is the judge’s verdict that neither answer is better.

03:10 A split is two verdicts that disagree.

03:14 Now the v2 first column. Three pairs changed. Counted both ways, v1 won eight, v2 won one, eight tied, and three pairs split. With one order, v1 led ten to one.

03:30 In this run, three of the twenty pairs failed the check. Between two closer versions, that’s enough to name the wrong winner, and one order can’t tell you which three.

03:41 In three judge runs over one saved set of answers, one to three pairs split, and v1 led every time. Your numbers will differ. Both orders also double the judge calls, to forty for twenty pairs.

03:56 Run a pairwise judge in both orders, and count a win only when both agree.

04:03 Judges can also favor longer answers, and v2 is the short one. So for now, v1 leads on one set of answers, by the judge’s word alone. In Check the Judge Against a Person, you’ll grade a sample yourself and see how often the judge agrees with you.

Become a Member to join the conversation.