LLM-as-a-Judge

GPT-4 agrees with human experts on 85% of decided MT-bench votes. Humans agree with each other on 81%. But the same judge changes its verdict when you swap the two answers.

Learn why a model can stand in for human raters, where it breaks, and the cheap fixes that work.

Pick a judge. Run the swap test or pad one answer. Turn on a fix and watch the bars move.

You need a feel for what a chat model answer is and a little Python. We build the rest.

Based on Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena (arXiv 2306.05685, NeurIPS 2023 Datasets and Benchmarks) by Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric P. Xing, Hao Zhang, Joseph E. Gonzalez and Ion Stoica. We re-teach every idea in our own words and devices. It is a required reading for Stanford CS 329Z, Engineering AI Agents: see the Lecture 15 lesson, the course page and the slides.

Break the judge, then fix it

Swap test: Table 2 and Table 12 of arXiv 2306.05685 (counts are the printed percentages times 80). Padding: Table 3. Agreement with humans: Table 6, Chatbot Arena, which the paper measures with swap and tie.

Chapter 0

Standard Benchmarks Miss Chat Quality

See why a model that chats far better can look the same on the usual tests

You fine-tune a base model on 3,000 chat conversations. People like the new model much more. Its MMLU score, a multiple-choice knowledge test, barely moves.

The paper's diagnosis is simple. Standard benchmarks ask short closed questions with one checkable answer. Chat is open and multi-turn. No string match can tell you whether an answer was helpful.

Humans can tell, but they are slow and costly. The paper tests a cheaper rater: a strong model that reads the answers and picks. It calls this LLM-as-a-judge, then checks the judge against humans.

Rank ten models two ways

Sort by MMLU, then by the GPT-4 judge's MT-bench score. Watch where LLaMA-13B lands. MMLU MT-bench

Table 8 of arXiv 2306.05685. MMLU is 5-shot accuracy, 0 to 100. MT-bench is the GPT-4 score, 0 to 10. Each bar shows a share of its own maximum.

Worked number. LLaMA-7B to Vicuna-7B (selected): MMLU goes from 35.2 to 37.3, a gain of 2.1. MT-bench goes from 2.74 to 5.95, a gain of 3.21. Vicuna-7B (selected) trained on only 3K conversations.

Failure. The symptom: a model chats better and the usual score shows no gain. Measure it: rank the same models on both kinds of score and compare ranks. The fix: add a preference benchmark.

The road

  1. A model as the judge: three forms of judge and their cost.
  2. MT-bench, Arena and agreement: where human votes come from and how to score a judge.
  3. Position bias: the judge picks a slot, not an answer.
  4. Verbosity, self-favour and math: three more flaws.
  5. The fixes: swap, few-shot, reference.
  6. The main result: agreement with humans.
  7. Win rates by category: what a judge-based leaderboard shows.
  8. What the paper does not show: sort claims from non-claims.
  9. Field guide: terms, checklist, code, links.
Why did the authors add a preference benchmark next to MMLU?

Chapter 1

A Model as the Judge

Three forms of judge, what each costs, and what the verdict looks like

Two assistants answer the same question. You need to know which is better, for thousands of questions. A judge is a strong LLM that reads the question and the answers and returns a verdict with a short reason.

FormThe judge readsIt returnsStrengthWeakness
Pairwise comparisona question and two answersA, B or tiesees small gapspairs grow as n squared
Single answer gradinga question and one answera score from 1 to 10grows as nscores drift when the judge changes
Reference-guided gradinga question, answers and a reference solutiona verdict or scorehelps on mathneeds a reference

You can mix the three. The judge also gives its reasons, so you can read why it chose. The paper calls this explainability. It uses pairwise judging for its main agreement tables. It uses single answer grading for the model scores in Table 8, because that form scales.

Prompt and cost

Pick a form to see its prompt. Then slide the number of models and compare the calls per question.

6

The prompts are our shortened versions of Figures 5, 6 and 8 of arXiv 2306.05685. The call counts are arithmetic: n(n-1)/2 pairs against n answers.

Worked number. Six models give 6 x 5 / 2 = 15 pairs for each question, against 6 single grades. Thirty models give 435 pairs against 30 grades.

Failure. The symptom: your pairwise judge costs ten times more each time you add a model. Measure it: count calls per question. The fix: grade single answers for the leaderboard, and keep pairwise for the close calls.

Why does the paper say pairwise judging scales badly?

Chapter 2

MT-Bench, Arena and Agreement

Where the human votes come from, and the one number that scores a judge

The paper builds two sources of human votes.

SourceQuestionsVotersVotes used
MT-bench80, written by the authors: 8 categories of 10, each with a follow-up turn58 expert labelers, mostly graduate studentsabout 3,000, on 6 models
Chatbot Arenaanything a user types, one turnthe crowd, 2,114 unique IPs in the sample3,000 sampled from 30,000

In the Arena a user asks one question and two anonymous models answer. The user votes for the better answer. The model names show after the vote. The authors ran the Arena for one month.

The paper scores a judge by agreement: the chance that a random judge of each type, on a random question, casts the same vote. Two setups. S1 counts ties and order-inconsistent verdicts as ties; random guessing scores 33%. S2 keeps only non-tie votes; random guessing scores 50%.

Compute agreement

Tap a voter to flip its vote between A and B. Green lines are agreement. Red lines are disagreement.

The three-vote example is from Appendix D.3 of arXiv 2306.05685. The code of the page counts pairs exactly as the paper describes.

Worked number. Humans vote A, A, B. The pairs are (1,2) agree, (1,3) disagree, (2,3) disagree. Human-human agreement is 1 of 3, or 33%. If GPT-4 votes A, it agrees with 2 of 3 humans, or 67%.

Worked example (ours). A judge returns 10 verdicts. Four are ties or order splits. Six carry a winner, and 5 match the human. S2 reads 5 of 6, or 83%. S1 asks about all 10. A tie verdict agrees only if the human also voted tie.

Failure. The symptom: humans seem to disagree with each other more than with GPT-4. Measure: compare each side against the human majority. The paper adds a human-majority judge for this, so the human ceiling is not too low.

What does setup S2 do?

Chapter 3

Position Bias

The judge can pick the slot an answer sits in, not the answer

You show a judge answer X first and answer Y second. It picks X. You swap them. It now picks Y. The judge followed the slot.

That is position bias. The paper measures it with near-twins: for each of the 80 first-turn questions, GPT-3.5 answers twice at temperature 0.7. The judge sees each pair in both orders. Consistency is the share of pairs where the same answer wins in both orders.

Where the order decides

Pick a slice. same winner both orders favours first favours second format error

Tables 2, 9, 10 and 11 of arXiv 2306.05685. Table 2 and 9 use 80 twin pairs. Tables 10 and 11 use GPT-4 with the default prompt.

Worked number. GPT-4, default prompt: 65.0% consistent, 30.0% favour the first slot, 5.0% the second. That is 52 of 80 pairs. Claude-v1 is consistent on 19 of 80 and favours the first slot on 60.

The "rename" prompt calls the assistants something else. Claude-v1 then favours first less (75.0% to 11.2%) and second more (0% to 28.7%). So it also has a name bias toward "Assistant A".

Bias is largest on open questions (humanities 36% consistent) and smallest on math (86%). It nearly vanishes when the two models differ a lot: 98.8% for GPT-3.5 against LLaMA-13B. The paper guesses the cause is the training data or the left-to-right design of causal transformers. It leaves the cause for later work.

Failure. The symptom: a leaderboard changes when you reorder the answers. Measure it: consistency on twin pairs. The fix is in Chapter 5.

What does the "rename" prompt test?

Chapter 4

Verbosity, Self-Favour and Weak Math

Three more ways a judge goes wrong, and what the paper measured for each

Verbosity bias means the judge likes longer answers.

The paper builds a "repetitive list" attack. It takes 23 MT-bench answers that hold a numbered list. GPT-4 rewords the list. The reworded list goes in front of the original. Five items become ten, with no new fact. The attack works if the judge prefers the padded answer.

Self-enhancement bias means a judge favours its own answers. GPT-4 gives itself a win rate 10% higher than humans do. Claude-v1 gives itself 25% higher. GPT-3.5 shows no gain.

Weak math grading means the answers it reads can mislead the judge, even when it can solve the problem alone.

Three flaws, three numbers

Pick a flaw. The bars show the paper's measurement.

Table 3, Section 3.3 and Table 4 of arXiv 2306.05685. Padding: 23 answers. Math: 10 questions in both orders, so 20 judgments, GPT-4 only.

Worked number. A bookstore question: 5 novels at $20, 3 history books at $30, 2 philosophy books at $45. The sum is 100 + 90 + 90 = 280. GPT-4, shown two wrong answers ($115 and $295), wrote the same sum and called it 295. Asked alone, it got 280.

On padding, calibration holds: every judge returns a tie for two identical answers. Only the padded pair fools them.

Failure. The symptom: your judge praises long, repeated answers. Measure it: pad a copy of an answer and see if the judge prefers it. The paper tests no fix for padding. It only shows GPT-4 resists better.

How did the paper test verbosity bias?

Chapter 5

The Fixes: Swap, Few-Shot and Reference

Cheap changes to the judge prompt that cut the damage, with their prices

FixWhat it targetsThe paper's numberPrice
Swap positionsposition biasorder-dependent verdicts become tiestwo calls per pair
Few-shot examplesposition biasGPT-4 consistency 65.0% to 77.5%calls cost 4 times more
Chain-of-thought judgeweak mathfailures 14 of 20 to 6 of 20judge often copies the answers' mistake
Reference-guided judgeweak mathfailures 14 of 20 to 3 of 20needs a reference answer first
One prompt for both turnslost context on turn twofixes a faulty reference to turn onelonger prompt

The swap rule is the paper's default. Call the judge twice, once with each order. Declare a win only if the same answer wins both times. Otherwise call it a tie.

Swap and call a split a tie

Choose what the judge says in each call. Each verdict maps back to answers X and Y. Or tap a preset.

The rule is from Section 3.4 of arXiv 2306.05685. The verdicts here are your choices, not data.

def judge_pair(question, x, y, ask):
    v1 = ask(question, first=x, second=y)      # returns "first", "second" or "tie"
    v2 = ask(question, first=y, second=x)
    w1 = {"first": "X", "second": "Y", "tie": "tie"}[v1]
    w2 = {"first": "Y", "second": "X", "tie": "tie"}[v2]
    return w1 if w1 == w2 else "tie"           # a win needs both orders to agree

Worked number. GPT-4, default prompt: 52 of 80 pairs are consistent. The other 28 (24 + 4) become ties. No order-driven verdict is left. The price: 35% of pairs give no winner, and each pair costs two calls.

Failure. The symptom: few-shot raises consistency but not accuracy. Measure it: compare the judge with human votes, not only with itself. The paper did: GPT-4 with few-shot agrees with humans about as well as zero-shot, so it kept the cheaper zero-shot prompt.

A judge says "first" in both calls of the swap test. What is the final verdict?

Chapter 6

The Main Result: Agreement With Humans

Tables 5 and 6, made interactive

This is the paper's main test. GPT-4 judges every pair, in both orders. Humans vote on the same questions. The paper counts how often they match.

Who agrees with whom

Pick a dataset and a setup. The tick marks what random guessing scores. judge vs humans humans vs humans judge vs judge

Table 5 (MT-bench) and Table 6 (Arena) of arXiv 2306.05685. Judges use pairwise comparison with swap and tie, except "single" which is GPT-4 single-answer grading. The Arena table has no human-human figure.

Worked number. MT-bench turn 1, S2: GPT-4 against humans, 85% on 859 votes. Humans against humans, 81% on 479 votes. Random guessing: 50%. With ties counted (S1) the same pair reads 66% against 63%, where random is 33%.

The win rate curves from the LLM judges track the human curves closely on both benchmarks (Figures 3 and 4). MT-bench has six models and all pairs. The Arena sample has nine models.

GPT-4 single-answer grading agrees with pairwise GPT-4 on 97% of decided votes. The paper reads this as a stable internal rubric, and it is cheaper. On the Arena, GPT-4 casts 1,944 decided votes against 1,567 for GPT-3.5 and 1,475 for Claude: it is more affirmative. Where GPT-4 and a human differed, humans found GPT-4's reason reasonable in 75% of cases, and changed their vote in 34%.

Failure. The symptom: you quote "85% agreement" for a leaderboard of close models. The paper's Figure 2 shows agreement runs from about 70% for close pairs to nearly 100% for pairs far apart. Measure agreement by gap in win rate. Report both setups.

Why is GPT-4's 85% on MT-bench not directly comparable to a plain accuracy?

Chapter 7

Win Rates by Category

What a judge-based leaderboard shows, and where it blurs

The average win rate of a model is its win rate against every other model. Because MT-bench has eight categories, you can read it per category. Pick one.

Win rate by category

Pick a category. Bars show the average win rate of four models.

Table 7 of arXiv 2306.05685.

GPT-4 leads almost everywhere. Math and coding are the exception: GPT-4 and GPT-3.5 sit close, 66.1% against 63.8% in math. The paper explains that both failed some hard questions. A direct pairwise comparison or single-answer score still puts GPT-4 ahead.

Worked number. Reasoning: GPT-4 49.3%, GPT-3.5 32.6%. The gap is 16.7 points.

The paper also finds that on turn two, humans prefer Claude and GPT-3.5 more than on turn one. A multi-turn benchmark tells models apart better.

Failure. The symptom: two models tie in one category though one is clearly better. Measure: compare them head to head. The fix: pair a win-rate board with direct comparison and single-answer scores.

In the math category GPT-4 and GPT-3.5 have similar win rates. What does the paper say?

Chapter 8

What the Paper Does Not Show

Sort six claims into shown and not shown

A strong result invites claims it never made. Judge each claim below. Then read why.

Shown or not shown?

    Each answer cites a table, section or appendix of arXiv 2306.05685.

    The paper states its own limits. It studies helpfulness and largely skips safety. It folds accuracy, relevance and creativity into one number. Its position test uses answers from one model. We add: the judges are 2023 models, and the labelers were mostly graduate students.

    The paper names three next steps. One: more categories. Two: an open-source judge aligned with human preference. Three: better math and reasoning in open models. A fine-tuned Vicuna-13B judge gets only preliminary results (Appendix F).

    Failure. The symptom: you copy "85% agreement" to your domain. Measure it: collect your own human votes and compute S1 and S2. The fix: treat the paper as a method to repeat, not a number to reuse.

    Which limit does the paper name itself?

    Chapter 9

    Field Guide

    Terms and numbers, a checklist, the core code, and where to go next

    Terms

    TermPlain meaning
    LLM-as-a-judgea strong model that rates another model's answers
    Pairwise comparisonthe judge picks A, B or tie for two answers
    Single answer gradingthe judge scores one answer from 1 to 10
    Position biasthe judge favours a slot, not an answer
    Consistencyshare of pairs with the same winner in both orders
    Verbosity biasthe judge favours the longer answer
    Self-enhancement biasthe judge favours its own answers
    Agreement S1, S2S1 counts ties (random 33%). S2 drops ties (random 50%)

    Numbers to remember

    NumberWhat it isSource
    85% / 81%GPT-4 vs human, and human vs human (S2, MT-bench turn 1)Table 5
    65.0%GPT-4 consistency on twin pairsTable 2
    77.5%GPT-4 consistency with few-shotTable 12
    91.3% / 8.7%padding attack: Claude-v1 and GPT-3.5 / GPT-4Table 3
    14, 6, 3 of 20math failures: default, chain of thought, referenceTable 4

    A checklist before you trust a judge

    This list is our own summary. Tick what you have done on a project of yours.

    Check your judge

    Our summary of the paper's lessons. It is not a list from the paper.

    The core as code

    Our sketch of the agreement measure. The swap rule is in Chapter 5.

    def agreement(judge_votes, human_votes, drop_ties):
        pairs = list(zip(judge_votes, human_votes))
        if drop_ties:                                    # S2: decided votes only
            pairs = [(j, h) for j, h in pairs if j != "tie" and h != "tie"]
        return sum(j == h for j, h in pairs) / len(pairs)   # S1 keeps ties (random = 1/3)
    
    def consistency(verdicts_ab, verdicts_ba):
        same = sum(a == b for a, b in zip(verdicts_ab, verdicts_ba))
        return same / len(verdicts_ab)                  # same winner in both orders

    Where next

    The lecture lesson for this reading is CS 329Z Lecture 15: LLM as a judge. For a judge you check against your own grades, read Who Validates the Validators?. For a judge that escalates when unsure, read JEV as a Judge. For the basics of evaluation, see CS 329Z Lecture 13.

    Credit

    The paper is by Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric P. Xing, Hao Zhang, Joseph E. Gonzalez and Ion Stoica (UC Berkeley, UC San Diego, Carnegie Mellon, Stanford and MBZUAI). It appeared at NeurIPS 2023 as arXiv 2306.05685. The reading belongs to Stanford CS 329Z, Lecture 15 slides.

    Swap the order, then test against humans. A judge that was never checked is a guess. A judge that passes the swap test and agrees with your raters is a tool.
    Go back to the hero, switch on both fixes, and pick each judge. Ask which one you would trust, and why.
    Which statement matches the paper?
    Based on "Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena" by Zheng, Chiang, Sheng, Zhuang, Wu, Zhuang, Lin, Li, Li, Xing, Zhang, Gonzalez and Stoica (2023)
    Read the paper · Back to Veanors