Skip to content

LLM as a judge: how to build an evaluator you can trust

LLM as a judge means grading model output with another model. The three judge types, their measured biases, and how to calibrate a judge against human labels.

Published
Reading time
9 min read

In short

  • LLM as a judge is the practice of using one language model to grade another model's output against written criteria. It scales review to volumes that people cannot read.
  • Judges have measured biases: they favor an answer because of its position, favor longer answers, and can favor their own model family. Swap the order, control for length, and judge with a different model family.
  • Ask one pass-or-fail question per criterion and have the judge reason before it gives a verdict. Scores from 1 to 10 cluster and drift.
  • Before you trust a judge, label a sample by hand and report Cohen's kappa and the judge's recall on failures. Raw percent agreement flatters a judge when most outputs pass.

LLM as a judge is the practice of using a language model to grade the output of another model against written criteria. The judge reads a response, and sometimes the input, a reference answer, or a second response, and returns a verdict. It is how teams score thousands of outputs a day for qualities that code cannot check, such as whether an answer follows policy or addresses the question.

A judge is a model, so it has biases and blind spots of its own. The hallucination detection article lists the short version: ask yes-or-no questions, use a different model family, and measure agreement with human labels. This article goes through each step in detail, with the numbers behind them.

What an LLM judge is for

An LLM judge grades qualities that need reading comprehension but not a person's full attention: relevance, tone, policy compliance, whether a summary covers the source. Use it where a code check cannot decide and human review cannot keep up. Do not use it where a code check can decide, because the code check is cheaper and never drifts.

The tradeoff is precision for scale. A person can review a few hundred responses a day. A judge can grade every response in an offline test suite and a sample of live traffic, which is what makes LLM evaluation run on every change rather than once a quarter.

The cost is that you now have two systems to trust. If the judge is wrong in a consistent direction, every chart built on it is wrong in that direction too.

Three ways to ask a judge

Zheng and colleagues, in the 2023 paper that introduced MT-Bench, describe three ways to use LLM as a judge: pairwise comparison, single answer grading, and reference-guided grading. Each fits a different decision. Pick the setup from the question you need answered, not from what is easiest to prompt.

SetupThe judge seesBest forWeakness
Pairwise comparisonA question and two answers, and picks one or a tieChoosing between two prompts or two modelsPairs grow quadratically with the number of candidates
Single answer gradingOne answer, and returns a score or a verdictMonitoring quality over time, release gatesAbsolute scores can shift when the judge model changes
Reference-guided gradingOne answer and a known-correct referenceMath, extraction, factual questions with a known answerNeeds a reference for every case

In production, single answer grading with a pass-or-fail verdict does most of the work. It is the only setup that scores one live response on its own, which is what monitoring and release gates need. Keep pairwise comparison for experiments, where the question is which of two candidates is better.

The biases, measured

Research on LLM as a judge documents four biases well enough to plan for: position bias, verbosity bias, self-preference, and leniency. A fifth limitation, weak reasoning on math and logic, behaves like a bias in practice. The figures below come from models that are a few generations old. Measure the judge you actually use.

Position bias is the most reliable finding. In the MT-Bench study, judges gave the same verdict after the two answers were swapped only 23.8 percent of the time for Claude-v1, 46.2 percent for GPT-3.5, and 65.0 percent for GPT-4. Wang and colleagues showed how far this goes: with ChatGPT as the judge, Vicuna-13B beat ChatGPT on 66 of 80 questions purely by changing the order of the answers.

Verbosity bias came out of a padding test. The MT-Bench authors rewrote answers as longer, repetitive lists with no new content. Claude-v1 and GPT-3.5 preferred the padded version in 91.3 percent of cases. GPT-4 did in 8.7 percent.

Self-preference is subtler. The same study saw GPT-4 give its own answers a win rate about 10 percent higher than human raters did, and Claude-v1 about 25 percent higher, though the authors note their data was too limited to confirm it. Panickssery and colleagues later found that models can recognize their own writing and rate it higher.

Leniency is the bias that hurts monitoring most. Thakur and colleagues, testing many judge models, found a tendency toward leniency, and warned that judges with high percent agreement can still assign very different scores from humans.

Reasoning is the limitation. On math questions in the MT-Bench study, the GPT-4 judge was misled by the answers it was grading even when it could solve the problem. Its failure rate was 70 percent with the default prompt, 30 percent with chain-of-thought, and 15 percent when given a reference answer.

How to counter each bias

Each bias has a known countermeasure, and each countermeasure has a cost. Apply them in proportion to what a wrong verdict costs you. A release gate deserves all of them. A dashboard that tracks a trend may need only the cheap ones.

BiasCountermeasureWhat it costs
PositionJudge both orders and count a win only if both agree, otherwise a tieTwice the judge calls
VerbosityTell the judge length is not a criterion, and check whether verdicts correlate with lengthOne analysis per rubric change
Self-preferenceJudge with a different model family from the generatorA second provider
LeniencyBinary verdicts, and require the judge to quote the evidence for a failLonger judge outputs
Weak reasoningGive the judge a reference answer where one existsBuilding and maintaining references

The swap-and-agree rule for position bias comes from the MT-Bench paper. For verbosity at benchmark scale, length-controlled AlpacaEval fits a model of how much a judge's preference depends on length and predicts the preference with the length difference removed. That correction raised its correlation with human rankings on Chatbot Arena from 0.94 to 0.98.

Write the rubric as pass-or-fail questions

Write each criterion as a yes-or-no question about one property, define pass and fail with an example of each, and have the judge write its reasoning before its verdict. Binary questions are easier for a judge to answer consistently and easier for you to calibrate. A single 1-to-10 quality score mixes several properties into one number nobody can act on.

G-Eval, from Liu and colleagues, showed the value of structure. It has the judge generate evaluation steps through chain-of-thought and then fill in a form, and with GPT-4 it reached a Spearman correlation of 0.514 with human ratings on summarization, well above earlier automatic metrics. The same paper warns that LLM-based evaluators may favor LLM-generated text.

A judge prompt built this way looks like the following. One criterion, one verdict, with reasoning first and evidence required for a fail.

judge-policy.txt
You are grading a support assistant's reply for one criterion only.
 
Criterion: The reply states only refund rules that appear in the policy below.
PASS: every refund rule in the reply appears in the policy.
FAIL: the reply states any refund rule that is not in the policy,
      or contradicts the policy.
 
Ignore tone, length, and formatting. They are graded separately.
 
Policy:
{policy}
 
Reply:
{reply}
 
Think step by step about each refund rule in the reply.
Then answer in JSON: {"reasoning": "...", "evidence": "...", "verdict": "PASS" | "FAIL"}
For FAIL, "evidence" must quote the sentence from the reply that breaks the rule.

Run one prompt per criterion, or one prompt that returns a verdict per criterion. Each call is cheaper to debug than a single prompt that grades everything at once.

Calibrate the judge against human labels

Calibration is the step that makes LLM as a judge trustworthy: measure how often the judge agrees with careful human graders on a sample of real outputs, before you rely on its verdicts. Label a sample by hand with the same rubric, run the judge on it, and compare. Report Cohen's kappa and the judge's recall on failures. Raw percent agreement is not enough.

OutputsSAME RUBRICLLM judgePASS OR FAILHuman reviewA LABELED SAMPLEJudge verdictsPPFPFPHuman labelsPFFPFPDISAGREEAgreement83% AGREEKAPPA 0.67
Calibration. The same outputs go to the judge and to a human reviewer with the same rubric. Here they agree on five of six, but Cohen's kappa, which corrects for agreement by chance, is 0.67.

Percent agreement flatters a judge when most outputs pass. If 90 percent of your outputs are fine, a judge that always says PASS agrees with humans 90 percent of the time and catches nothing. Cohen's kappa corrects for that. It compares observed agreement with the agreement you would expect by chance from each rater's pass rate: kappa equals observed agreement minus chance agreement, divided by one minus chance agreement. The always-PASS judge scores zero.

Recall on the FAIL class is the other number to watch, because catching failures is the job. Of the outputs humans marked as failures, what share did the judge also fail? A judge with good kappa and poor fail recall is lenient, which is the bias Thakur and colleagues warned about.

Expect the rubric to change during labeling. Shankar and colleagues call this criteria drift: you need criteria to grade outputs, but grading outputs is how you discover what your criteria are. Budget a second labeling round after the rubric settles, and recalibrate whenever the judge model, its prompt, or the generator changes.

What judging costs

LLM as a judge adds one model call per criterion per graded output, more if you judge both orders. That cost is acceptable offline and on a sample of live traffic, and rarely acceptable inline on every request. Decide where each criterion runs based on how fast you need the verdict.

Four practices keep the bill down:

  • Run code checks first. Schema validation and exact matches are free, and an output that fails them does not need a judge.
  • Sample live traffic. Grade a fixed share of requests asynchronously, plus every request a user flagged, and attach the verdict to the request's trace.
  • Cache verdicts by a hash of the output and the rubric version, so a rerun of an unchanged test suite costs nothing.
  • Try a smaller judge model after calibration. If a cheaper model reaches the same kappa and fail recall on your labeled sample, use it.

Inline judging, where a verdict blocks the response, belongs only where a bad answer is expensive. It adds a full model call to the user's wait. The guardrails article covers when a blocking check is worth that.

Frequently asked questions

What is LLM as a judge?

LLM as a judge is an evaluation method in which a language model grades another model's output. The judge receives the output, the grading criteria, and sometimes the input, a reference answer, or a competing answer. It returns a verdict or a score. Teams use it to evaluate qualities like relevance, policy compliance, and faithfulness at volumes people cannot review by hand.

Is LLM as a judge reliable?

It is reliable only after you measure it. The MT-Bench study found strong judges agreed with human preferences over 80 percent of the time, about the rate at which humans agree with each other. The same study documented position, verbosity, and self-preference biases. Calibrate against your own human labels, report Cohen's kappa, and recheck when anything in the setup changes.

Which model should I use as an LLM judge?

Use a capable model from a different family than the one that generated the outputs, to reduce self-preference. Start with a strong model, calibrate it against human labels, and then test whether a smaller, cheaper model reaches the same agreement on the same labeled sample. The right judge is the cheapest one that matches your human graders.

Is pairwise or pointwise evaluation better?

Pairwise comparison is better for choosing between two candidates, such as two prompt versions, because relative judgments are more stable than absolute scores. Pointwise grading is better for monitoring and release gates, because it scores one output on its own. Pairwise judges show strong position bias, so always run both orders and count only consistent verdicts.

How many human labels do you need to calibrate a judge?

Start with about 100 to 200 labeled examples, and make sure they include real failures. With 100 examples, a measured agreement of 0.8 has a 95 percent confidence interval of roughly plus or minus 0.08, which is enough to tell a good judge from a poor one. Use more labels when the failure rate is low, since recall on failures needs failures to measure.

Can an LLM judge its own output?

It can, but it should not be the only judge of its own output. Research by Panickssery and colleagues found that models recognize their own generations and rate them higher. The MT-Bench study saw a similar effect, though with limited data. Use a judge from a different model family, or at least confirm on a labeled sample that self-grading does not inflate scores.

Sources

  1. 01Judging LLM-as-a-Judge with MT-Bench and Chatbot ArenaarXiv:2306.05685
  2. 02G-Eval: NLG Evaluation using GPT-4 with Better Human AlignmentarXiv:2303.16634
  3. 03Large Language Models are not Fair EvaluatorsarXiv:2305.17926
  4. 04LLM Evaluators Recognize and Favor Their Own GenerationsarXiv:2404.13076
  5. 05Length-Controlled AlpacaEval: A Simple Way to Debias Automatic EvaluatorsarXiv:2404.04475
  6. 06Judging the Judges: Evaluating Alignment and Vulnerabilities in LLMs-as-JudgesarXiv:2406.12624
  7. 07Who Validates the Validators? Aligning LLM-Assisted Evaluation of LLM Outputs with Human PreferencesarXiv:2404.12272