Lesson 3 of 6 Evaluating Generative AI

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.

BiasMitigation
Verbosity (prefers longer answers)Rubric that rewards concision; length-controlled comparisons
Position bias in pairwise testsEvaluate both orders
Self-preferenceJudge from a different model family
Inconsistent scoresDetailed rubric, examples, temperature 0
Unknown reliabilityMeasure agreement with human ratings

The following diagram shows the weekly faithfulness scores of a RAG assistant, including the drop caused by a prompt change.

Weekly faithfulness of the RAG assistant. Each week a judge from a different model family scores 1,000 sampled interactions; a human review of 100 items agreed with the judge 92% of the time. When a prompt change dropped faithfulness from 0.94 to 0.88, the change was rolled back and the score recovered.
The weekly values other than 0.94 and 0.88 are illustrative.
Select all that apply

A judge you can trust

Exam skills 2.3.9

Identify the practices that make an LLM judge reliable.

Log in to try this activity Interactive activities are free with an account.

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.

True or false

When to use a judge

Exam skills 2.3.9

Check where LLM-as-a-judge evaluation fits.

Log in to try this activity Interactive activities are free with an account.
Worked example

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.

Check yourself

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.