Glossary/L/LLM-as-a-judge
Testing Also called: LLM judge, judge model, model-graded eval, model grader, LLM-based grading, AI judge, autorater

What is LLM-as-a-judge?

LLM-as-a-judge is the practice of grading one model's output by prompting another model with the output, a rubric and sometimes a reference answer, then parsing the judge's reply into a score or label. It replaces a human rater on open-ended tasks where exact match fails. The judge is a model call like any other, so its scores carry known biases (answer position, length, its own style) and need checking against human labels before you trust them.

What does an LLM judge do?

A judge is a grader inside an eval. Your code builds a prompt that holds the rubric, the input the system under test received, its output, and a reference answer if you have one. It sends that prompt to a model and parses the reply into a number or a label such as correct or incorrect. The runner then aggregates those parsed scores the same way it would aggregate exact-match results.

Providers ship this as a grader type. OpenAI's score_model grader takes a list of chat messages, a judge model, a numeric range and a pass_threshold; the messages use templates such as {{ sample.output_text }} and {{ item.reference_answer }} to drop in the output and the ground truth, and any non-numeric reply scores 0. Anthropic's develop-tests guide lists LLM-based grading beside code-based and human grading, and describes it as fast, flexible and scalable, with the condition that you test it for reliability before you scale it.

The term is used two ways. Marketing copy says "AI-evaluated" or "judged by GPT-4" and stops there. In code, the phrase names a specific setup with choices you have to make: single-answer scoring or pairwise comparison between two outputs, with or without a reference answer, which model judges, and how the reply is parsed. Change any one of those and the scores stop being comparable.

Where do LLM judges get it wrong?

Zheng et al. named the main failure modes in their 2023 paper, Judging LLM-as-a-Judge. Position bias favours an answer because of where it sits in the prompt. Verbosity bias favours the longer answer. Self-enhancement bias favours output that resembles the judge's own. The same paper reports limited reasoning ability when the judge grades questions it has to work through.

Position bias is large enough to flip a result. Wang et al. showed that swapping the order of two candidate answers could make Vicuna-13B beat ChatGPT on 66 of 80 queries with ChatGPT as the evaluator. Their fix, Balanced Position Calibration, runs each comparison in both orders and aggregates the scores. Other mitigations from the same paper ask the judge to write its evidence before it gives a rating, and send hard cases to a human.

Judges also fail at the parsing step. A judge that answers "mostly correct, 4/5" when your parser expects a bare digit produces a 0 or an exception, and the eval reports a regression that is really a formatting change. Constrain the reply with structured outputs or a fixed label set, and log the raw judge text next to every parsed score.

How do you make a judge trustworthy?

  • Write a detailed rubric. Anthropic's guide gives the example: the answer must mention 'Acme Inc.' in the first sentence or it is graded incorrect.
  • Ask for a constrained output, such as correct or incorrect, or a score from 1 to 5, so the reply can be parsed and aggregated.
  • Let the judge reason before it scores. Anthropic recommends a grader model with thinking on for tasks that need complex judgement.
  • In pairwise mode, run both orders and count a win only when the judge agrees with itself.
  • Label a slice of outputs by hand and measure how often the judge agrees with you before you put its numbers in CI.

Zheng et al. found GPT-4 as a judge agreed with human preferences over 80 percent of the time, about the same rate at which humans agreed with each other. That result came from their benchmarks, their prompts and a strong judge, so run the same agreement check on your own data before you rely on yours.

Running a score_model grader against one output

curl https://api.openai.com/v1/fine_tuning/alpha/graders/run \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "grader": {
      "type": "score_model",
      "name": "refund_policy_judge",
      "model": "gpt-4.1-2025-04-14",
      "range": [0, 1],
      "pass_threshold": 0.5,
      "input": [
        {
          "role": "system",
          "content": "You are an expert grader. If the reference and model answer are exact matches, output a score of 1. If they are somewhat similar in meaning, output a score in 0.5. Otherwise, give a score of 0."
        },
        {
          "role": "user",
          "content": "Reference: {{ item.reference_answer }}. Model answer: {{ sample.output_text }}"
        }
      ],
      "sampling_params": { "top_p": 1 }
    },
    "item": { "reference_answer": "Refunds are issued within 14 days of the return arriving." },
    "model_sample": "You get your money back up to 14 days after we receive the item."
  }'

The system message is the rubric from OpenAI's graders guide. The judge model, the 0 to 1 range and the 0.5 pass threshold are explicit in the payload, so changing any of them is a reviewable diff. The model sample paraphrases the reference, which exact match would fail and this rubric can score as similar in meaning.

Common questions

LLM judges: frequently asked

Can the same model generate the answer and judge it?

It can, but the judge is then grading its own style. Zheng et al. measured self-enhancement bias, where a judge favours answers that look like its own output. If you can afford it, judge with a different model family than the one under test, and check agreement against human labels either way.

Should I score answers one at a time or compare them in pairs?

Single-answer scoring gives you an absolute number you can track across runs, which suits regression testing in CI. Pairwise comparison asks which of two outputs is better, which suits choosing between two prompts or two models. Pairwise mode is exposed to position bias, so run each pair in both orders and aggregate.

When should I avoid an LLM judge?

Avoid it whenever code can check the answer. Classification labels, extracted fields, JSON shape and tool arguments can all be graded with exact match, a schema or a test, which is cheaper and deterministic. Keep the judge for open-ended text such as summaries, support replies and explanations, where two different answers can both be right.

Sources

Where these facts come from