LLM-as-Judge: Scalable AI Evaluation with Language Models › How LLM Judges Work
Language AI HandbookAll chapters LLM-as-Judge: Scalable AI Evaluation with Language Models › How LLM Judges WorkOne section · Sections in this chapter2 / 10 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
An LLM judge is a prompted language model. You construct a prompt that presents the evaluation task, the content to evaluate, and optionally a scoring rubric or reference answer. The judge model reads this and returns a score or decision. The simplicity of this setup is deceptive. There are dozens of design choices embedded in that prompt, and each one shapes the reliability of the resulting scores. Getting good judge output requires treating prompt engineering as a first-class engineering discipline, not an afterthought.
To understand why design choices matter so much, consider what the judge is doing. It is mapping the textual representation of a response onto a compact scalar or categorical output. This is a form of machine-generated annotation, subject to all the same consistency challenges as human annotation. A human annotator who receives an ambiguous rubric will produce noisy, inconsistent ratings. A judge model given an ambiguous rubric will do the same thing, except the inconsistency may be harder to detect because the scores arrive quickly and in a machine-readable format that looks authoritative.
The inputs to an LLM judge typically include:
- The instruction or prompt: what the evaluated model was asked to do
- The model response: the output being judged
- A scoring rubric: criteria the judge should apply (optional but strongly recommended)
- A reference answer: a human-written gold response for comparison (optional)
The judge outputs a score, a judgment label (e.g., "A is better", "tie"), or a natural-language critique with a score embedded in it.
Evaluation Formats
Three formats dominate in practice, each suited to different evaluation goals.
Pointwise scoring presents a single response and asks the judge to rate it on an absolute scale. For example: "On a scale from 1 to 10, how helpful is this response?" This is easy to implement and lets you track individual model quality over time. The challenge is that absolute scales are poorly defined without careful rubric design. Judges tend to cluster scores in the middle of the range, and the same response may receive different absolute scores from different judge models. Absolute scores are also harder to interpret in isolation: a score of 7 out of 10 means very different things depending on the judge model and the task domain.
Despite these challenges, pointwise scoring is the right choice when you need to monitor a single model's quality over time or compare scores across a fixed evaluation dimension. Production monitoring systems almost always use pointwise scoring because you can track trends, set alert thresholds, and compare different product areas without running all pairwise combinations.
Pairwise comparison presents two responses side by side and asks the judge which is better. This produces a relative judgment: "A is better", "B is better", or "tie". Pairwise comparisons align well with how we build human preference datasets, and they sidestep the vagueness of absolute scales. Relative judgments are cognitively easier for humans, and the same holds for judge models: it is easier to say "this response is more helpful than that one" than to say "this response deserves a 7.3 out of 10." The tradeoff is that with models you need comparisons to rank them all, making large-scale evaluation expensive.
Pairwise comparison also enables tournament-style ranking. LMSYS Chatbot Arena uses pairwise human judgments to compute Elo ratings for dozens of models, creating a dynamic ranking that updates with each new comparison. The same approach works with LLM judges: run pairwise comparisons across all model pairs, compute Elo scores or Bradley-Terry rankings, and you have a reliable ordinal ranking even when individual comparisons are noisy.
Reference-guided scoring provides a gold reference answer alongside the model response and asks the judge to score how well the response matches or exceeds the reference. This is particularly useful for tasks with clear correct answers, like question answering or code generation, where deviation from the reference is a meaningful quality signal. The reference anchors the judge's assessment and reduces subjectivity: instead of asking the judge to decide what a "5 out of 5" answer looks like in the abstract, you show it concretely.
Reference-guided scoring is especially powerful for fact-heavy tasks. If you are evaluating a medical question-answering system, the reference answer written by a physician encodes the expected level of clinical detail and accuracy. The judge can compare against that standard rather than constructing its own internal notion of quality. The limitation is that reference answers are expensive to produce and may not capture all valid response styles, so an excellent response that takes a different but equally valid approach may be unfairly penalized.
Choosing between these formats requires thinking about what information you need. If you need to rank multiple models against each other, pairwise comparison is more reliable. If you need to track one model's quality over time or across product areas, pointwise scoring is more practical because you can compare absolute scores without running every pair. Reference-guided scoring is the right choice when you have high-quality human-written answers and want to measure the gap between model output and the ideal response.
Pointwise scoring rates each response independently on an absolute scale. Pairwise comparison evaluates two responses relative to each other. Pointwise is easier to aggregate; pairwise tends to be more reliable because relative judgments are easier to make than absolute ones.
Judge Prompt Design
The prompt is the most consequential engineering decision in an LLM-as-Judge system. A well-designed prompt produces scores that correlate with human judgment. A poorly designed prompt produces high-confidence nonsense. The danger is that poorly designed prompts are hard to detect in practice: the judge still returns numbers, and those numbers still vary across examples in ways that look plausible. You only discover the problem when you compare against human annotations and find low correlation.
A reliable judge prompt has four components:
Role framing sets the context for the model. Telling the judge "You are an expert evaluator assessing the quality of AI assistant responses" primes it to apply relevant evaluation standards, similar to how human annotators receive role descriptions before rating sessions. Role framing matters because it shifts the model's prior over what kinds of responses are expected in this context. A judge framed as an expert evaluator attends to quality signals differently than the same model in a default conversational mode.
Task description explains what is being evaluated and on what dimensions. Being specific here is necessary. "Rate the quality of this response" is underspecified: the judge must fill in what "quality" means, and different judge models will fill that gap differently, creating inconsistent results. "Rate this response on instruction-following, factual accuracy, and writing clarity" gives the judge concrete criteria to apply and makes the output reproducible across runs and across judge models.
Scoring rubric defines what each score level means. A rubric anchors the scale. Without it, score 7 out of 10 has no stable meaning. A good rubric describes the expected characteristics of a 1, 3, 5, 7, and 10 response so the judge can place the input on that scale consistently. Writing a good rubric takes time but pays off in dramatically reduced score variance. Think of it as writing the annotation guidelines you would give to a human annotator.
Output format specification tells the judge exactly what to return. Asking for a score inside <score> tags, followed by a <rationale> explanation, makes parsing reliable and encourages the judge to think through its reasoning before committing to a score. Structured output formats also make it easier to detect parse failures, where the judge returns something other than the expected format, which is itself a quality signal.
Here is a template illustrating these components:
You are an expert evaluator assessing AI assistant responses.
[Instruction]
{instruction}
[Response to Evaluate]
{response}
Rate the response on the following criteria using a scale from 1 to 5:
- Instruction following (1=ignored, 5=fully addressed all requirements)
- Factual accuracy (1=multiple clear errors, 5=no factual errors)
- Writing clarity (1=difficult to understand, 5=extremely clear and well-organized)
Return your evaluation in the following format:
<score_instruction_following>X</score_instruction_following>
<score_factual_accuracy>X</score_factual_accuracy>
<score_clarity>X</score_clarity>
<rationale>Brief explanation of your ratings.</rationale>
Asking the judge to produce a rationale before committing to a score ("chain-of-thought prompting") generally improves judgment quality. The explanation forces the model to reason through the evidence rather than pattern-matching to a number. Research on chain-of-thought prompting showed that requiring intermediate reasoning steps improves final answer accuracy, and the same mechanism operates here. A judge that writes "The response correctly identifies the three main causes of World War I but omits the role of the alliance system, so factual accuracy is 4 rather than 5" is making a more deliberate assessment than one that outputs <score_factual_accuracy>4</score_factual_accuracy> with no explanation.
One important design decision is whether to request a single composite score or separate per-dimension scores. Composite scores are simpler to collect and report, but they conflate distinct quality dimensions in ways that obscure the source of an error. A response that is perfectly clear but factually wrong gets a high composite score if the clarity weight dominates. Per-dimension scores reveal the tradeoff and give you actionable signal: low instruction following tells you the model is ignoring parts of the prompt, while low factual accuracy tells you it is confidently creating errors. For any serious evaluation, per-dimension scoring is worth the additional complexity.
Few-Shot Examples in Judge Prompts
Zero-shot judge prompts work but can be inconsistent. Adding a small number of worked examples dramatically stabilizes output. Each example should include an instruction, a response, and a judge evaluation showing the expected reasoning and score. Even two or three examples help the judge understand the intended scale and reasoning style.
Few-shot examples serve two distinct purposes. First, they demonstrate the output format you want, reducing parse errors and so the judge follows your structured tag schema. Second, and more importantly, they calibrate the scale. If you include an example of a "5 out of 5" response with a clear explanation of why it earns a 5, and an example of a "2 out of 5" response explaining why it falls short, the judge learns what the boundaries of your scale mean in practice. This anchoring effect is far more powerful than rubric text alone, because language models learn from examples better than from abstract descriptions.
When selecting few-shot examples, prioritize diversity: include responses that score across the full range, cover different failure modes (factual error, poor clarity, off-topic response), and represent the task difficulty distribution you expect in production. Avoid selecting only extreme cases (obviously great or obviously terrible responses), because most real-world responses fall in the middle of the quality distribution, and that is precisely where you need the judge to discriminate reliably.
The tradeoff is prompt length. Each few-shot example adds tokens, which increases cost and can compress the space available for the actual content being evaluated. Very long judge prompts can also cause attention dilution, where the judge's attention is spread across the many examples rather than focusing on the content to evaluate. In practice, three to five examples strike a good balance: enough to anchor the scale, not so many that the prompt becomes unwieldy. If your examples are long (because the task involves lengthy responses), consider using a separate calibration pass where you first establish rubric anchors, then run the actual evaluation with shorter context.
There is a subtler issue with few-shot calibration that practitioners often miss. The distribution of examples you include in your prompt shapes the judge's prior over the score distribution. If all your examples score between 3 and 5, the judge learns that scores below 3 are essentially unreachable, and it will be reluctant to assign them even when they are warranted. Including at least one example of each score level that you want the judge to use in practice prevents this distributional anchoring from narrowing the effective scale.