7. AI Evaluation#
You cannot operate an AI system responsibly without knowing how well it works. This chapter shows how to build test sets, choose metrics for predictive and generative output, and run evaluations as regression tests whenever a prompt, model, or data source changes.
Test Sets: Golden data with good coverage and careful labels is the foundation of every evaluation.
Evaluation Metrics: Accuracy, rubrics, and model-graded judgments measure different kinds of output.
Regression Testing: Baselines and automated checks catch quality drops before users do.
Chapter Video
This explainer covers the fundamentals of AI evaluations: what to test, how to score output, and why evals belong in the development process.
Why Everyone Should Know About AI Evals: The Fundamentals Explained (9:00) by ByteByteAI
Hosted on YouTube; property of its original creator, embedded here for educational reference only.
Learning Objectives
By the end of this chapter, you will be able to:
Build a labeled test set that covers common and edge cases.
Choose metrics for classification, extraction, and free-text output.
Score generative output with rubrics and LLM judges, and check the judges.
Compare system versions against a baseline before release.
Build an evaluation harness for a prompt in Python.
Chapter Flow
Glossary
# |
Term |
Explanation |
|---|---|---|
1 |
Evaluation |
Systematically measuring how well an AI system performs a task. |
2 |
Test set |
A fixed collection of inputs with expected outputs used for evaluation. |
3 |
Golden data |
Carefully verified examples treated as the reference answers. |
4 |
Edge case |
An unusual input that tests the limits of a system. |
5 |
Inter-rater agreement |
How consistently different people label the same examples. |
6 |
Exact match |
A metric that counts outputs identical to the expected answer. |
7 |
Rubric |
A scoring guide that defines criteria and levels of quality. |
8 |
LLM judge |
A language model used to score another model’s output against a rubric. |
9 |
Baseline |
The current system’s scores, used as the reference for comparisons. |
10 |
Regression test |
A test that checks whether a change made performance worse. |
11 |
A/B comparison |
Comparing two versions on the same inputs to see which performs better. |
12 |
Evaluation harness |
Code that runs a test set through a system and reports scores. |
13 |
Coverage slice |
A meaningful group of evaluation cases. |
14 |
Adjudication |
A reviewed resolution of label disagreement. |
15 |
Complete-record accuracy |
The share of records with all required fields correct. |
16 |
Evaluation rubric |
Observable criteria and scoring anchors. |
17 |
False acceptance |
Accepting an outcome that reviewed evidence rejects. |
18 |
Paired comparison |
Evaluating versions on the same cases. |
19 |
Frozen comparison |
Versioned inputs, labels, and scorer for release evidence. |
20 |
Sampling uncertainty |
Uncertainty caused by the evaluation sample. |
21 |
Reference label |
An expected outcome used as evaluation evidence. |
22 |
Evaluation leakage |
Using held-out evaluation information to influence the system being evaluated. |
23 |
Failure slice |
A subset of cases sharing a relevant condition or category. |
24 |
Release gate |
Acceptance conditions checked before a candidate is released. |