learn-ai-evals-with-phoebe / Builder session 5 of 10
Learn Evals with Phoebe · Builder track · Session 5 of 10

LLM-as-judge: an automated grader you can trust, carefully

Most of the metrics in b4 were LLM judges under the hood. This session opens the hood. You will learn the three ways an LLM can grade an answer - pointwise, pairwise, and reference-guided - write real judge prompts for Recall, and then meet the three biases that make a naive judge lie to you: position, verbosity, and self-preference. Most importantly you will learn to calibrate: swap positions, use a different model, and validate against a small human-labeled set. A judge is a measurement instrument, and today you learn to trust it only as far as you have checked it.

🟠 Builder track Practitioners · some Python Hands-on · concept + code ~45 min
0-3 · Welcome 3-24 · Three judging modes 24-40 · Biases + calibration 40-45 · Q&A
Part 0

The grader is a model too

You cannot hand-grade every answer a production system gives, and string matching is too brittle for open-ended text. So you hire another LLM to grade - the LLM-as-judge pattern that powers RAGAS faithfulness, most rubric scores, and pairwise model comparisons. It scales beautifully. It also inherits every quirk of the model doing the judging. Today we make Recall's judge, then spend equal time learning why a judge you have not calibrated is a number you should not believe.

Live - presented in session Self-study - full depth after class ★ Try it now Sources covered at the end
★ What you build today Working pointwise and pairwise judge prompts for Recall, a clear map of the three judging modes and when each fits, and a calibration routine - swap positions, use a different model, validate against humans - that turns a judge from a hunch into an instrument.
Part 1 · covers the three judging modes

The three judging modes 9 min live

An LLM judge can grade in three shapes, and picking the right one is half the battle. Pointwise scores one answer on a rubric. Pairwise picks the better of two. Reference-guided scores one answer against a gold answer. Each answers a different question and each has a different failure mode.

POINTWISE one answer rubric 1-5 Judge Score e.g. 4 / 5 PAIRWISE answer A answer B Judge Win A or B REFERENCE-GUIDED the answer gold reference Judge Score vs gold grounded rubric Pointwise: absolute score. Pairwise: relative winner. Reference: anchored. Pairwise agrees with humans most; reference-guided is the most stable; pointwise is the easiest to run at scale.
🔍 Click to zoom - pointwise scores one, pairwise picks the better of two, reference-guided scores against a gold answer
LivePointwise: score one answer on a rubric3 min

Pointwise (also called single-answer grading) hands the judge one answer and a rubric and asks for a score, say 1 to 5 or 1 to 10. It is the simplest to run at scale - one call per answer - which is why it powers dashboards and CI gates.

  • When to use it. Continuous monitoring, per-answer scoring across thousands of live responses, any time you need an absolute number rather than a comparison.
  • The weakness. Absolute scores drift. Without an anchor, a judge's idea of "a 4" wobbles between runs and models, so pointwise is the mode most in need of a clear rubric and calibration.
  • Make the rubric concrete. Define what each score level means in plain language and give an example. A vague rubric produces a vague, unstable number.
LivePairwise + reference-guided3 min

The other two modes trade scale for reliability.

  • Pairwise. Show the judge two answers to the same question and ask which is better. Humans are far more consistent choosing between two options than assigning an absolute score, and so are LLM judges. This is the mode behind model-vs-model comparisons and A/B prompt tests. Its own weakness is position bias, which we defuse in Part 2.
  • Reference-guided. Give the judge a gold answer and ask it to score the candidate against that reference. Anchoring to a known-good answer stabilizes the score and reduces drift dramatically. The cost is that you need references, so it lives in offline golden-set evaluation.
Which mode for which job Comparing two models or two prompts? Pairwise. Monitoring one system's answers over time on a dashboard? Pointwise, with a tight rubric. Have gold answers and want the most stable score? Reference-guided. Most mature suites use pairwise to choose and pointwise to monitor.
Self-studyA pointwise and a pairwise judge prompt4 min read

The prompt is the judge. Here is a pointwise rubric grader for Recall's answers, then a pairwise comparator. Note the two habits baked in from the start: ask for reasoning before the score (chain-of-thought), and demand a structured output you can parse.

Python · pointwise judge prompt (rubric 1-5)POINTWISE = """You are grading a support assistant's answer. Question: {question} Retrieved context: {context} Answer: {answer} Score the answer 1-5 using this rubric: 5 - fully correct, grounded in the context, directly answers the question 4 - correct and grounded, minor omission 3 - mostly correct, one unsupported or vague claim 2 - partially correct, a clear unsupported claim 1 - wrong, off-topic, or contradicts the context First write one sentence of reasoning. Then output JSON only: {{"reasoning": "...", "score": <1-5>}}""" def judge_pointwise(client, question, context, answer): prompt = POINTWISE.format(question=question, context=context, answer=answer) resp = client.grade(prompt) # your LLM call, temperature 0 return json.loads(resp)["score"]
Python · pairwise judge prompt (pick the better answer)PAIRWISE = """Compare two answers to the same question. Question: {question} Answer A: {answer_a} Answer B: {answer_b} Decide which answer is more correct, grounded, and helpful. First give one sentence of reasoning. Then output JSON only: {{"reasoning": "...", "winner": "A" | "B" | "tie"}}""" def judge_pairwise(client, question, a, b): prompt = PAIRWISE.format(question=question, answer_a=a, answer_b=b) return json.loads(client.grade(prompt))["winner"]
Two defaults that pay off immediately Set the judge's temperature to 0 for repeatability, and always ask for reasoning before the score. Chain-of-thought judging is both more accurate and auditable - when a score looks wrong you can read why the judge decided it, instead of arguing with a bare number.
Part 2 · covers the biases + calibration

The biases + calibration 8 min live

A judge is a model, so it has systematic tilts. Three of them show up again and again in the literature: position bias, verbosity bias, and self-preference bias. Left unchecked they quietly corrupt your scores. The good news is each has a known fix.

Position bias favors the first / left answer, whatever it says Fix: swap A/B, keep win only if consistent Verbosity bias favors the longer answer even if not better Fix: length-aware rubric, reference-guided scoring Self-preference favors its own model family and style Fix: judge with a DIFFERENT model Over it all: chain-of-thought before scoring, and validate the judge against a small human-labeled set. Trust the judge only as far as it agrees with humans you have checked - the MT-Bench study found roughly 85% GPT-4-to-human agreement. Every bias has a fix. An uncalibrated judge is a broken instrument, not a shortcut.
🔍 Click to zoom - three judge biases (position, verbosity, self-preference) each with its fix, over a base of chain-of-thought and human validation
LiveThe three biases3 min

Named in the MT-Bench study (Zheng et al. 2023), these are the tilts a naive judge brings to the table.

  • Position bias. In pairwise judging the model tends to favor whichever answer it sees first (or on the left), independent of quality. Present the same two answers in the other order and the winner can flip.
  • Verbosity bias. Judges reward longer, more elaborate answers even when the extra length adds nothing - or actively pads with unsupported claims. Length reads as thoroughness to the judge.
  • Self-enhancement (self-preference) bias. A judge tends to score answers from its own model family or stylistic house higher. Grading a model's output with the same model quietly inflates the score.
Real world

The metric that got gamed by length. A team (anonymized) optimized a support assistant against a pointwise LLM judge and celebrated a steady climb in scores. When they finally read the transcripts, the model had simply learned to write longer, more padded answers - the judge's verbosity bias rewarded the extra words, users found them worse, and complaint volume had actually risen. The number went up because the model learned the judge, not the job.

LiveCalibrating the judge3 min

Each bias has a fix, and together they turn a judge into an instrument you can defend.

  • Swap positions and require consistency. Run every pairwise comparison twice, A-then-B and B-then-A, and only count a win if the judge picks the same answer both times. Disagreements become ties. This neutralizes position bias directly.
  • Reference-guided scoring. Anchoring to a gold answer curbs both verbosity and drift - the judge grades against a target, not against its own vague sense of quality.
  • Chain-of-thought before the score. Force reasoning first; it improves agreement with humans and makes the score auditable.
  • Use a DIFFERENT model to judge. Anthropic's guidance is blunt: use a different model to evaluate than the model used to generate. A cross-family judge removes self-preference bias.
  • Validate against a small human-labeled set. Hand-label 30 to 50 answers, then check how often the judge agrees. The MT-Bench study found strong LLM judges reach roughly 85% agreement with human preferences - on par with or above human-to-human agreement - but you only know your judge's number once you measure it on your own data.
The one-line rule Trust an LLM judge exactly as far as you have validated it against humans, and no further. A judge with an unknown agreement rate is a thermometer with an unknown offset - it produces confident numbers that may all be wrong by the same amount.
Build-along · take it further

Write a judge, then test it for position bias ★ 12 min · your judge prompt

Writing the prompt is easy; the discipline is checking that the prompt is not lying to you. Do both.

Write a pointwise judge for Recall. Start from the 1-5 rubric prompt above and adapt it to one Recall question. Make each score level concrete - what does a 3 look like for a refund question versus a 5? Ask for reasoning before the score.

Turn it pairwise. Take two candidate answers to that question - one tight and correct, one longer and padded with an unsupported claim. Prompt the judge to pick the better one, order answer A then answer B, and record the winner.

Swap the order. Run the exact same pair again, this time B then A. Did the winner stay the same? If it flipped, you just watched position bias in action on your own judge. If the padded answer won either way, you have caught verbosity bias too.

Reflect. In one line: what is your judge's consistency rate on this pair, and what would you change - swap-and-require-consistency, a length-aware rubric, or a different judge model - to trust it in a CI gate?

★ Recall's judge after b5 Recall now has an automated grader you can actually defend - you know its three modes, you have watched its biases move real scores, and you have a calibration routine to keep it honest. In b6 we stop hand-rolling judges and run the full RAGAS suite over Recall end to end.
Homework

Before session b6 ◐ 40 min total

Source material

Official sources covered

Taught from the primary literature and vendor guidance. This page covers ~80% of their working content on LLM-as-judge - hosted judge runners and full leaderboards land in later sessions.

Zheng et al. 2023 · MT-Bench (Judging LLM-as-a-Judge)Part 1-2 · pointwise/pairwise/reference-guided modes, position/verbosity/self-preference biases, ~85% human agreement
Anthropic · grading and evaluation guidancePart 2 · use a different model to evaluate than the one used to generate
RAGAS · LLM-judge-based metricsJudges seen in b4; run as a full suite in b6
Check yourself

Three questions before you go 🎯 ◐ 90 seconds

1 · You want to compare two candidate prompts for Recall and pick the better one. The most reliable judging mode is...

Pairwise picks the better of two and agrees with humans most, which is why it drives model and prompt comparisons. Just guard it against position bias by swapping order and requiring a consistent winner.

2 · Position bias in a pairwise judge is best defused by...

Position bias means the judge favors whichever answer it sees first. Swapping A/B and requiring the same winner both times turns order-dependent picks into ties, neutralizing the bias.

3 · Anthropic's guidance on self-preference bias is to...

A judge tends to score its own family higher. Grading with a different model family removes that inflation - and validating against a small human-labeled set (roughly 85% agreement is the MT-Bench benchmark) tells you how far to trust it.

Builder session 5 cheat sheet · pin this

LLM-as-judgeUse another LLM to grade open-ended answers at scale. Powers RAGAS, rubric scores, and model comparisons.
PointwiseScore one answer on a rubric (e.g. 1-5 or 1-10). Easiest at scale; absolute scores drift, so anchor with a tight rubric.
PairwisePick the better of two answers. Most consistent with humans. Guard against position bias.
Reference-guidedScore against a gold answer. Most stable, least drift. Needs references, so it is offline.
Position biasFavors the first/left answer. Fix: swap order, count a win only if consistent both ways.
Verbosity biasFavors longer answers even when not better. Fix: length-aware rubric, reference-guided scoring.
Self-preference biasFavors the judge's own model family. Fix: judge with a DIFFERENT model family.
CalibrationChain-of-thought before scoring, temperature 0, validate against 30-50 human labels. MT-Bench: ~85% GPT-4-human agreement.