The idea
Many outputs cannot be checked with exact match: summaries, explanations, support replies. An LLM judge reads the input, the output (and the reference or sources if you have them) and a rubric, and returns a verdict with a short reason.
Make judges narrow: one judge per criterion with a binary or small-scale answer works better than one judge scoring "quality" 1–10. Ask for the reasoning before the verdict, use temperature 0, and require structured output.
A judge is itself a model that can be wrong. Validate it against human labels (aim for high agreement on a sample) before trusting its numbers.
Judges make evaluation scale from 30 hand-read cases to thousands of automated ones.
Picture it
Words to know
- RubricWritten criteria the judge applies.
- Agreement rateHow often the judge matches human labels.
Try it without code
Judge by hand
- Write a 3-line rubric for "answers the question asked".
- Paste a question, an answer and the rubric into a chat app.
- Ask for reasoning then PASS or FAIL.
Use it in code
A binary judge with structured output.
import json, anthropic
client = anthropic.Anthropic()
RUBRIC = """PASS if the answer directly addresses the user's question and gives a usable answer.
FAIL if it answers a different question, is evasive, or only partly answers."""
def judge(question, answer):
msg = client.messages.create(model="claude-sonnet-5-5", max_tokens=300, temperature=0,
messages=[{"role": "user", "content":
f"<rubric>{RUBRIC}</rubric>\n<question>{question}</question>\n<answer>{answer}</answer>\n"
'Return JSON only: {"reason": "...", "verdict": "PASS" or "FAIL"}'}])
return json.loads(msg.content[0].text)
print(judge("How long do refunds take?", "Refunds are processed within 5 business days."))Hand-label 30 outputs, run your judge on them, and compute agreement. Adjust the rubric until agreement is above 85%.
Common mistakes
- Using the same model to generate and judge without checking bias.
- 1–10 scales with no anchors.
- Never validating the judge.