Evaluating Generated Text with LLM-as-a-Judge
This lesson explains how LLM-as-a-judge uses a capable model with a scoring rubric to evaluate qualities such as helpfulness, faithfulness and tone that word overlap cannot measure.
Learning outcomes
After completing this lesson, you will be able to:
- Describe how a judge scores responses against a rubric.
- Make judges reliable by mitigating their biases.
- Identify where judges fit in evaluation and monitoring.
How it works
An evaluator (judge) model receives the prompt, the response, optional reference answers or retrieved context, and a rubric that defines each score level. It returns a score and an explanation. Common judged metrics are correctness, completeness, faithfulness (supported by the provided context, the key metric for hallucination in RAG), relevance, helpfulness, coherence, harmfulness and refusal appropriateness. Pairwise comparison asks the judge which of two responses is better, which is often more reliable than absolute scores.
Making judges reliable
Judges have biases: they may prefer longer answers, the first answer in a pair (position bias) or answers written in their own style (self-preference). Mitigations include a clear rubric with examples, using a strong judge from a different model family than the model being judged, swapping answer order in pairwise tests, asking for reasoning before the score, low temperature, and calibrating against a human-labelled sample to measure agreement. Bedrock evaluations offer built-in judge metrics and custom metrics with your own prompts and rating scales.
The following table summarises judge biases and mitigations.
| Bias | Mitigation |
|---|---|
| Verbosity (prefers longer answers) | Rubric that rewards concision; length-controlled comparisons |
| Position bias in pairwise tests | Evaluate both orders |
| Self-preference | Judge from a different model family |
| Inconsistent scores | Detailed rubric, examples, temperature 0 |
| Unknown reliability | Measure agreement with human ratings |
The following diagram shows the weekly faithfulness scores of a RAG assistant, including the drop caused by a prompt change.

A judge you can trust
Where judges fit
LLM judges suit tasks that need many evaluations of qualities that are hard to measure with rules: regression tests in CI/CD pipelines, comparisons of prompts and models, scoring the faithfulness of RAG answers, monitoring sampled production traffic, and pre-filtering items so that human reviewers focus on the uncertain ones.
They complement other methods rather than replacing them. Programmatic checks remain better for objective properties, such as schema validity and exact facts, and periodic human evaluation calibrates the judge, confirming that its scores agree with expert opinion.
When to use a judge
Hallucination monitoring for RAG
A RAG assistant sometimes adds details that are not in the retrieved documents. The team wants to measure how often this happens each week.
Judge prompt (abridged):
You are grading whether an ANSWER is fully supported by the CONTEXT.
Score 1: every claim is supported. Score 0.5: minor unsupported detail. Score 0: key claim unsupported.
Explain which claims are unsupported, then give the score.
<context>{retrieved_chunks}</context><question>{q}</question><answer>{a}</answer>A weekly job samples 1,000 logged interactions and scores faithfulness with a judge from a different model family. A human review of 100 items shows 92% agreement with the judge, which the team accepts. Faithfulness falls from 0.94 to 0.88 after a prompt change, so the change is rolled back.
How is position bias removed in pairwise comparisons by a judge?
Show answer
By swapping the order of the two answers and judging again.
Exam Tips
Remember for the exam
- Faithfulness measures whether answers are supported by context (hallucination).
- Use a judge from a different model family to avoid self-preference.
- Swap answer order in pairwise comparisons to remove position bias.
- Calibrate judges against human ratings.
- Bedrock evaluations support built-in and custom judge metrics.