LLM-as-Judge Done Right A tutorial on LLM-as-judge evaluation recommends splitting grading into narrow single-criterion judges with binary or low-cardinality rubrics rather than one broad 1–10 quality score, and calibrating each judge against human labels before trusting it. The lesson, part of an agentic AI course following a prerequisite on deterministic graders and assertions, argues that four separate judges for factual accuracy, groundedness, resolution clarity and tone are more reliable than one broad judge and identify what failed when one does. It also advises showing the judge only the evidence needed for its criterion and requiring reasoning before the verdict in structured output. · Agentic AI · 9 min read 📋 Prerequisites - Deterministic Graders and Assertions previous lesson 🎯 What You'll Learn - Decide when an LLM judge is the right grader and when it is not - Write analytic rubrics with binary or low-cardinality criteria that judges apply consistently - Choose between pointwise, pairwise, and reference-guided judging - Measure and mitigate position, verbosity, and self-preference bias - Calibrate a judge against human labels using agreement metrics What Judges Are For After Lesson 5, your deterministic graders handle outcomes, policies, schemas, and budgets. What’s left is the stuff code can’t check: - Is the response accurate relative to what the tools returned? - Is it grounded , or does it invent policy? - Is it clear and appropriate in tone for an upset customer? - Did the agent ask for clarification when the request was genuinely ambiguous? - Is the reasoning in a long trajectory sound , even when the outcome was right? These are judgment calls. An LLM judge can make them at scale, if you design the judge carefully and prove that it agrees with humans. An unvalidated judge is a random number generator with excellent grammar. Anatomy of a Good Judge A judge has four parts: 1. The criterion : one specific property, not “overall quality” 2. The evidence : exactly what the judge needs to see the user message, tool outputs, the response , and nothing more 3. The rubric : an explicit decision procedure with low-cardinality outputs 4. The output format : structured, with reasoning before the verdict One Criterion per Judge “Rate the response 1–10 for quality” is the most common judge prompt and the least useful. The judge silently weighs a dozen things differently on every call. Split it: | Criterion | Question | |---|---| | Factual accuracy | Does every factual claim match the tool outputs? | | Groundedness | Does it state any policy or promise not supported by the KB? | | Resolution clarity | Would the customer know exactly what happened and what happens next? | | Tone | Is it appropriate for the customer’s emotional state? | Four narrow judges are more reliable than one broad one, and when one fails you know what failed. Binary or Low-Cardinality Scales Judges are much more consistent on pass/fail or 3-point scales than on 1–10. The difference between a 6 and a 7 isn’t something a model or a human applies consistently. If you need gradation, use an analytic rubric : several binary checks that you sum. Criterion: Factual accuracy Answer each question YES or NO based only on the TOOL OUTPUTS and RESPONSE. Q1. Does every amount mentioned in the response appear in the tool outputs? Q2. Does every invoice or date mentioned match the tool outputs? Q3. If the response says an action was taken, does a tool output confirm it succeeded? Q4. Does the response avoid claiming facts about the account that no tool returned? PASS only if all four are YES. This is far more reproducible than “rate accuracy 1–5,” and the per-question answers double as a diagnostic. Show Only the Evidence Needed Give the judge the inputs it needs to decide the criterion, not the entire trace. More context means more distraction and more cost. For factual accuracy: the user message, the tool outputs, and the response. For tone: the user message and the response. The system prompt usually isn’t needed, and including it can bias the judge toward the agent’s own framing. Reasoning Before Verdict Ask for reasoning first, then the verdict, in structured output. Verdict-first outputs get rationalized after the fact. Implementing a Judge Grader python import json from dataclasses import dataclass JUDGE TEMPLATE = """You are grading a customer-support agent's reply for ONE criterion. Criterion {criterion} Rubric {rubric} Evidence