10 Evaluation
  1. In this chapter
  2. LLM Evaluation Methodology
  3. The Statistics of Evaluation
  4. LLM-as-a-Judge
  5. Building Evaluation Sets
  6. Benchmark Contamination
  7. Production evaluation for LLMs
All chapters →

Part 4 · Evaluate, secure, look ahead Chapter 10

Evaluation

How to show that a model got stronger: what benchmarks measure, the statistics of evaluation (pass@k, confidence intervals, sample size), LLM-as-a-Judge, building an evaluation set with reliable labels, and how benchmark contamination arises and is detected.

6 pages about 2.5 h Chapter labs on GitHub ↗ Intermediate Updated

After this chapter you will be able to

  • Say what each of the four classic benchmarks measures, and judge whether an evaluation result has been contaminated.
  • Report a confidence interval for a score, compute the unbiased estimator of pass@k, and work out how many questions are needed to tell two models apart.
  • Grade open-ended answers with an LLM judge, recognize and mitigate position and length bias, and turn pairwise comparisons into a leaderboard.
  • Check the quality of an evaluation set: estimate the ceiling that label errors put on scores, measure annotator agreement, find items that do not discriminate, and set version and secrecy rules for the set.
  • Detect benchmark contamination with n-gram overlap and model signals (loss gap, Min-K%), say where each is blind, and report scores on the clean subset.
  • Set up an evaluation workflow from task definition and evaluation set through scoring to online monitoring.

Evaluation is the most underrated step in LLM engineering. Without reliable evaluation, every “improvement” to training, alignment, RAG or an agent is only a feeling. This chapter starts with what the benchmarks measure and how they get contaminated, then covers how large the error of a score is and when a gap counts, then how a model can serve as the grader of open-ended answers, then the evaluation set itself: how label errors lower scores, and how to measure annotator agreement and item discrimination; finally contamination, shown with a real fine-tuning experiment: how many repeats it takes to memorize an item, why n-gram matching cannot see a paraphrase, and how much model signals can see.

It is also the prerequisite of the later Safety and Alignment Risks chapter: safety assessment has to ask the same questions, whether the sample is large enough, whether the adversary adapts, and whether the metric can be gamed. For putting evaluation into your application, the RAG and Agents pages both include the details of an evaluation loop. For evaluating long-context ability, see the explainer Lost in the Middle.

Production evaluation connects task grading to rollout decisions, from paired offline replay to shadow traffic, canaries, and rollback.

Chapter roadmap

  1. 10.1

    LLM Evaluation Methodology: Benchmarks, Contamination and a Workflow

    Evaluating an LLM means estimating its performance on a whole class of tasks from a finite set of questions. This page covers what MMLU, HumanEval, GSM8K and MT-Bench measure, how to detect contamination, why a mature evaluation has four layers, and a workflow you can adopt.

    Intermediate 18 min read

    Prerequisites1.1What Is a Large Language Model? From Next-Word Prediction to General Assistants

  2. 10.2

    The Statistics of Evaluation: pass@k, Confidence Intervals and Sample Size

    A benchmark score is an estimate from a finite set of questions and carries error. Learn the unbiased pass@k estimator, confidence intervals for accuracy, paired comparison of two models and how many questions detecting a gap takes, with runnable code and interactive widgets.

    Intermediate 13 min read

    Prerequisites10.1LLM Evaluation Methodology

  3. 10.3

    LLM-as-a-Judge: Using a Model as the Grader, Its Biases and Calibration

    LLM-as-a-Judge lets a strong model score answers or compare them in pairs: cheap and scalable, but prone to position bias, length bias and misjudged math. Covers the judging modes, bias mitigation, measuring agreement with humans, and Bradley–Terry ranking.

    Intermediate 21 min read

    Prerequisites10.1LLM Evaluation Methodology

  4. 10.4

    Building Evaluation Sets: Question Sources, Label Quality and Item Information

    An evaluation set is only as good as its coverage, labels, discrimination and freshness. This page designs one from the decision it supports, then simulates how label errors lower scores and inflate sample sizes, why Cohen's kappa tracks class balance, and which items separate models.

    Intermediate 42 min read

    Prerequisites10.1LLM Evaluation Methodology10.2The Statistics of Evaluation

  5. 10.5

    Benchmark Contamination: How It Happens, How to Detect It, How to Avoid It

    Benchmark contamination means evaluation questions, answers or paraphrases of them ended up in a model's training data, so scores measure memory instead of ability. A small experiment with known ground truth measures the dose-response and what n-gram and model-based detectors catch or miss.

    Intermediate 44 min read

    Prerequisites10.1LLM Evaluation Methodology10.2The Statistics of Evaluation2.2From Language Modeling to Next-Token Prediction

  6. 10.6

    Production evaluation for LLMs: replay, canaries, and rollback

    Production evaluation connects model quality, system reliability, and user outcomes. Compare versions on paired requests, set release gates for critical slices, and use shadow traffic, canaries, and randomized experiments to answer different release questions.

    Intermediate 8 min read

    Prerequisites10.1LLM Evaluation Methodology10.2The Statistics of Evaluation