Search

Search papers and lessons

LLM-as-a-Judge

Level 4 · 9 min read

LLM-as-a-judge uses a strong language model to grade or compare other models' answers, which scales evaluation that humans cannot cover, but the judge carries biases that must be measured and corrected.

On this page

  • Colour = topic mix
  • Calculus
  • Probability
  • Neural network basics
  • Linear algebra
  • Architectures
  • Discrete math
  • Sign in to see your progress

TL;DR

LLM-as-a-judge means prompting a strong language model to grade an answer, or to pick the better of two answers, against a rubric. It scales evaluation to open-ended questions where no single correct answer exists and where human raters are slow and expensive. Its verdicts can agree with expert human judgement at roughly the rate experts agree with each other, but the judge has systematic biases: it favours answers in certain positions, longer answers, and sometimes its own style. Those biases have to be measured and corrected before the scores mean anything.

Where you'll see it: in chat-model leaderboards such as MT-Bench, in automatic evaluation of instruction-following, and as a source of preference labels or rewards in post-training pipelines.

Intuition

Why reference-based scores break down

For a question like "translate this sentence", a machine can compare the output with a reference translation and count overlapping word sequences. Metrics like BLEU, introduced for machine translation in 2002, do exactly that. Open-ended chat has no single reference. Two very different replies can both be excellent, so overlap with a fixed answer says little.

A judge model reads the question and the candidate answers and forms an opinion using the same kind of understanding a human reader uses. This is the appeal: it is flexible and cheap compared with asking people to rate thousands of answers.

The cost is that the judge is itself a language model with its own quirks. A human grader gets tired and inconsistent. A model grader is consistent in the wrong way: the same quirk shows up every time, and it can be triggered by something as simple as the order in which the answers appear.

flowchart LR
  Q[Question] --> J[Judge prompt with rubric]
  A1[Answer A] --> J
  A2[Answer B] --> J
  J --> V[Verdict: A, B or tie]
  V --> S[Swap order and judge again]
  S --> R[Keep a verdict only if both orders agree]

The last two steps are the standard correction, and they come up again below.

The math

Two judging modes

Write the judge as a function JJ that takes a question qq and answers and returns a score or a verdict.

Single-answer grading gives each answer a score on a fixed scale:

sa=J(q,a)∈{1,…,10}.s_a = J(q, a) \in \{1, \dots, 10\}.

Pairwise comparison takes two answers and returns a verdict:

v=J(q,a,b)∈{A,B,tie}.v = J(q, a, b) \in \{\text{A}, \text{B}, \text{tie}\}.

Pairwise comparison is more reliable for close calls, and single-answer grading is cheaper and scales to many models. The paper that introduced the modern form of the method found that GPT-4 agreed with human experts about as well in single-answer mode as in pairwise mode (85% on non-tied votes in both), so the cheaper single-answer mode is a reasonable choice for scoring many models.

Position consistency

A pairwise judge should be symmetric. If it prefers aa when aa is shown first, it should prefer aa when aa is shown second. Define the consistency rate as the fraction of pairs where the two orderings give the same underlying winner:

consistency=#{pairs with J(q,a,b)=A and J(q,b,a)=B, or the reverse}#{pairs}.\text{consistency} = \frac{\#\{\text{pairs with } J(q,a,b) = \text{A} \text{ and } J(q,b,a) = \text{B}, \text{ or the reverse}\}}{\#\{\text{pairs}\}}.

Any shortfall from 100% is position bias, which is not a rare edge case. In the paper's test on hard, similar answers, GPT-4 with its default prompt was consistent only 65.0% of the time. It favoured whichever answer came first in 30.0% of pairs.

Debiasing by swapping

A simple correction is to ask twice and combine the verdicts. Declare a win for aa only if J(q,a,b)=AJ(q,a,b) = \text{A} and J(q,b,a)=BJ(q,b,a) = \text{B}. Declare a win for bb only in the mirror case. Everything else becomes a tie:

verdict(a,b)={aif both orders favour a,bif both orders favour b,tieotherwise.\text{verdict}(a,b) = \begin{cases} a & \text{if both orders favour } a, \\ b & \text{if both orders favour } b, \\ \text{tie} & \text{otherwise.} \end{cases}

The cost is double the calls. The gain is that a verdict now needs the judge to agree with itself, so the position effect cannot manufacture a win.

Win rates and agreement

Given nn questions, the win rate of model aa against model bb is the share of questions where aa wins, with or without ties counted in the denominator. The paper also defines agreement between two kinds of judge as the probability that two different judges of those kinds agree on a random question. Agreement is usually reported only on non-tied votes, because ties carry little information about who was better.

Connecting verdicts to scores

If each answer has a latent quality score βa\beta_a, the probability that aa beats bb is often modelled as

P(a≻b)=11+e−(βa−βb)=σ(βa−βb),P(a \succ b) = \frac{1}{1 + e^{-(\beta_a - \beta_b)}} = \sigma(\beta_a - \beta_b),

which is the Bradley-Terry model with a sigmoid link. Fitting it to pairwise verdicts by maximum likelihood turns many judged pairs into one ranking.

−4−3−2−10123400.20.40.60.81score gap beta_a minus beta_bprobability a beats b
  • P(a beats b) as a function of score gap
A score gap of 0 is a coin flip. A gap of 2 gives about 88% to the higher-scored answer. The judge's verdicts are noisy evidence for the gap.

Worked examples

Example 1: how many verdicts a judge loses to position

Take 100 answer pairs, each judged in both orders by GPT-4 with the default prompt. Using the paper's consistency figure of 65.0%.

Example
Counting position-driven ties
  1. Consistent pairs: 100×0.65=65100 \times 0.65 = 65. For these the verdict survives the swap.
  2. Inconsistent pairs: 100−65=35100 - 65 = 35. Under the swap rule these become ties.
  3. The paper also reports 30.0% of verdicts biased toward the first answer and 5.0% toward the second. Those account for the 3535 inconsistent pairs.
  4. Interpretation: if you had used only the first-order verdict, about 30 of the 100 pairs would have been decided by position rather than quality. Swapping converts those into ties, which is a loss of signal but not a false win.
  5. With few-shot examples in the prompt, the same paper reports consistency rising to 77.5%, which leaves 22.5 of 100 pairs as ties. The paper notes this costs about four times more per call because the prompt is longer.

Example 2: win rate after the swap rule

Illustrative counts, not from the paper. Suppose a judge compares model aa with model bb on 20 questions, each judged in both orders.

Example
Win rate with ties
  1. After applying the swap rule: aa wins 7 questions, bb wins 6, and 7 are ties.
  2. Win rate of aa with ties in the denominator: 7/20=35%7 / 20 = 35\%.
  3. Win rate of aa over non-tied votes: 7/13≈53.8%7 / 13 \approx 53.8\%.
  4. Interpretation: the honest summary is that aa is slightly ahead, but a 20-question test cannot separate the two. The large tie count is itself a signal that the judge could not decide, and reporting it is more informative than reporting only the 53.8%.

Tradeoffs and failure modes

situationwhat goes wrongbetter choice
Single-order pairwise judgingPosition bias decides close callsSwap order and count only consistent verdicts
Longer answersJudge favours verbosity even when padded with repeated contentLength-controlled comparison, or a rubric that penalises padding
Judge is a model from the same family as a candidateSelf-favouritism, which the paper measured at about 10 points for GPT-4 and 25 for Claude-v1Use a judge from a different family, or several judges
Math, reasoning or factual checksThe judge can be misled by the candidate answers it is grading and can fail to solve the problem itself, even for basic math it could solve when asked directlyReference-guided grading, or chain-of-thought before the verdict
Weak judge modelVerdicts are close to random, and the scores hide thatMeasure agreement with human labels first, and report it
Optimising a policy against the judgeThe policy learns to please the judge rather than to be better, a form of [[reward-modelreward hacking]]

The paper's verbosity test is a useful template. It rewrote answers with extra repeated content and checked how often the judge preferred the padded version. GPT-4 was fooled in 8.7% of cases, while Claude-v1 and GPT-3.5 were fooled in 91.3%. A judge should be validated against attacks like this before it is trusted.

The most important practice is calibration against humans. Collect a set of human judgements, measure agreement with the judge, and report it alongside every score. Agreement between two human experts sets a practical ceiling. In the paper, GPT-4 agreed with human experts on 85% of non-tied votes, while two humans agreed with each other on 81%.

History

Zheng and colleagues, in a 2023 paper, introduced MT-Bench, a set of 80 multi-turn questions, and Chatbot Arena, a crowdsourced arena of pairwise human votes. They used GPT-4 as a judge and measured its agreement with 58 expert labellers. Their study named and measured position, verbosity and self-enhancement biases and reported the swap-and-count correction described above.

The method makes it cheap to score open-ended models. It is also close to a training tool: preference judges and reward models trained on human comparisons, as in RLHF, are the same idea used to produce a training signal rather than a score.

Check yourself

QuestionWhy is position bias a problem for pairwise judging, and what simple procedure reduces it?Show answer

A judge that favours the first answer will declare a winner partly because of order, which adds noise and can manufacture wins. Asking the judge twice with the order swapped, and counting a win only when both orders agree, removes the position effect from the verdict, at the cost of more ties and twice the calls.

QuestionA judge's consistency is 60%. Out of 250 pairs judged in both orders, how many pairs does the swap rule turn into ties?Show answer

Inconsistent pairs are 250×(1−0.60)=100250 \times (1 - 0.60) = 100. The swap rule turns those 100 into ties, so 100 of the 250 pairs become ties. The remaining 150 keep a verdict.

QuestionWhy can a judge from the same model family as a candidate give misleadingly high scores, and what would you do about it?Show answer

The judge may prefer answers written in its own style, which the paper called self-enhancement bias. Its high score then reflects familiarity rather than quality. The fix is to use a judge from a different family, to compare several judges, or to check the ranking against human labels.

QuestionTwo answers have Bradley-Terry scores 1.5 and 0.5. What probability does the model give that the first answer beats the second, and why is that a sensible but uncertain number?Show answer

The score gap is 1.5−0.5=11.5 - 0.5 = 1, so P=1/(1+e−1)≈0.731P = 1 / (1 + e^{-1}) \approx 0.731. It is sensible because the higher score wins more often. It is uncertain because the scores themselves were estimated from noisy judge verdicts, and a biased judge shifts all the scores in ways the model does not see.

Sources