Lesson 5.3 · 8 min read · about 55 min to master at a very slow pace

LLM-as-a-Judge

Using one LLM to grade another's output against a rubric: when it works, the biases to control (position, length, self-preference), how to validate a judge against human labels, and how to write a judge prompt that gives reliable scores.

Not startedJump to quiz

Why a judge

Many outputs have no single correct string: summaries, explanations, emails. Exact-match scoring fails and human grading does not scale to every change. An LLM judge reads the input, the output and a rubric, and returns a verdict. It costs a fraction of human review and runs in minutes.

Write the judge like a test, not a vibe

  • One criterion per judge: "Is every claim supported by the sources?" is gradeable. "Is this a good answer?" is not.
  • Binary or small scales: pass/fail, or 1–3 with each level defined. A 1–10 scale gives noisy, uncalibrated numbers.
  • Ask for the reasoning first, then the verdict, in structured output. The reasoning helps the judge and helps you audit it.
  • Give the judge what it needs: the sources, the reference answer if you have one.
Criterion: FAITHFULNESS
Given the SOURCES and the ANSWER, check each factual claim.
A claim passes if a source states or directly implies it.
Return JSON: {"unsupported_claims": [...], "verdict": "pass" | "fail"}
verdict is "fail" if any claim is unsupported.

Known biases

BiasWhat happensControl
PositionIn A-versus-B comparisons, prefers the first (or second) answerJudge both orders; count only consistent wins
LengthPrefers longer, more detailed answersRubric that rewards correctness and concision explicitly
Self-preferenceRates outputs from its own model family higherUse a different model as judge where possible
LeniencyPasses answers that sound confidentBinary, evidence-based criteria; require quotes

Validate the judge against humans

A judge is a model too, so evaluate it. Have a person label 50–100 outputs, run the judge on the same ones, and compare.

Worked example

On 100 answers, a human marks 20 as fail. The judge flags 18 answers as fail, of which 15 are among the human's 20.

  • Agreement: (both fail) (both pass: ) .
  • Of the real failures, the judge catches (its recall on failures).
  • Of the judge's fail flags, are right (its precision).

92% agreement looks fine, but the judge misses a quarter of real failures. Improve the rubric on the 5 missed cases, then measure again.

Agreement can mislead

If 95% of answers pass, a judge that always says "pass" agrees 95% of the time and catches nothing. Always look at how many real failures it catches.

Stuck? Common doubts

Questions real learners asked while studying this lesson. They stay closed so they don't spoil your own thinking: open only the ones you need.

First passCan I use the same model as judge and generator?

You can, and it often works for clear, evidence-based checks. For subjective quality and A-versus-B comparisons, self-preference matters more, so a different model family is safer. Either way, validating against human labels tells you whether it works.

Going deeperIsn't a judge as unreliable as the thing it is judging?

Checking is easier than generating: verifying that a claim appears in a given source is a narrower task than writing a good answer. That's why a judge with a specific rubric can be more reliable than the generator. But you only know that after measuring agreement with humans.

Cheatsheet

Judge prompt rules

One criterion; pass/fail or a defined 1–3 scale; reasoning then verdict; structured output; give it the sources.

Judge biases

Position, length, self-preference, leniency. Swap orders, reward concision, use another model, require evidence.

Agreement is not enough

With mostly passing answers, "always pass" agrees highly. Check how many real failures the judge catches.

See every cheatsheet by category →

Check your understanding

Score 75% or more to master this lesson and earn XP. Answer first, then check.

Q1applyWhich judge prompt will give the most reliable scores?
Q2diagnoseIn A-versus-B tests your judge picks answer A 70% of the time, whichever system produced it. What bias is this, and the fix?
Q3calculateHumans mark 10 of 100 answers as failures. Your judge flags 12, of which 8 are among the human's 10. What share of real failures does it catch?
Q4interpret95% of answers pass. A judge that always says "pass" would agree with humans how often, and what does that show?
Q5conceptWhy should a judge give its reasoning before its verdict?