Sub topic 1
What an LLM judge is and why teams use one
Prerequisites
Assume you can write basic prompts, read Python, and understand that an evaluation set contains inputs and expected behavior.
What an LLM judge measures
An LLM judge is a language model that scores another model's output against a rubric. A rubric is a list of rules for deciding whether an output is good.
The judge measures compliance with those rules. It does not directly measure human satisfaction or truth. Its score is a proxy, meaning an indirect measurement. Teams use judges because they can review many outputs faster and more consistently than manual review.
Deciding what to measure and where ground truth comes from
First choose one target. Examples include factual support, instruction following, safety, or tone. Mixing several targets into one score makes errors hard to diagnose.
Ground truth is the trusted label or behavior used for comparison. It can come from:
- Human labels from trained reviewers.
- A verified reference answer or database.
- A deterministic rule, such as a valid JSON check.
- Pairwise human preferences between two answers.
Human labels are often the best validation source, but they cost time. A judge should be compared with a representative sample of those labels before its scores guide product decisions.
Choosing a judging format
| Format | Best use | Main limitation |
|---|---|---|
| Pointwise | Score one answer against a rubric | Absolute scores can drift |
| Pairwise | Choose between two answers | Answer order can bias the result |
| Reference-based | Check an answer against trusted content | The reference may be incomplete |
A pointwise judge might score faithfulness from 1 to 5. A pairwise judge chooses answer A, answer B, or a tie. A reference-based judge checks claims against supplied evidence.
Writing a narrow, testable rubric
State one criterion, its scale, and what the judge must ignore. For example: “Score only whether every factual claim is supported by the context. Ignore style and length.” Include examples for borderline cases when reviewers disagree.
Ask for structured output rather than free text. Validate the result and reject malformed scores.
import json
text = '{"reasoning":"The answer matches the context.","score":5}'
verdict = json.loads(text)
score = verdict.get("score")
if not isinstance(score, int) or not 1 <= score <= 5:
raise ValueError("score must be an integer from 1 to 5")
print(verdict)Keep reasoning short, such as one or two sentences. Treat it as an audit clue, not proof that the score is correct. Compare scores with human labels and report uncertainty before relying on the metric.
Exercise
When is a deterministic check preferable to an LLM judge?
Show answer
Use it when the requirement has an exact rule, such as valid JSON, an exact field, or a numeric range.