Chapter 01
What evals are
The parts every eval has, and why judging changes by feel stops working after the first week.
Eval
Also called evaluation, LLM eval
- What
- A repeatable test of an AI feature: a fixed set of inputs, a way to grade each output, and a score you can compare between versions.
- Why
- Every prompt, model or retrieval change becomes an experiment with a before and after, instead of an opinion.
Dataset, task, grader, score
- What
- The dataset holds cases; the task is your app or prompt producing an output; the grader decides pass, fail or a score; the score is aggregated across cases.
- Why
- Most tools use these four words in some form, so once you see them every framework looks familiar.
for case in dataset:
output = run_app(case["input"])
results.append(grade(case, output))
score = sum(r.passed for r in results) / len(results)Evals vs unit tests
- What
- Unit tests expect one exact result. Evals accept that outputs vary, so they report a pass rate across many cases and often several runs.
- Why
- Expecting 100% on an LLM eval makes the suite flaky; set a threshold and watch the trend.
Public benchmarks vs your evals
- What
- Benchmarks score models on shared tasks; your evals score your feature on your users' tasks.
- Why
- A model that leads a leaderboard can still fail your support questions in Urdu or your JSON format.
Eval-driven development
- What
- Write a handful of cases before changing the prompt, run them, make the change, run them again.
- Why
- It is test-driven development adapted for outputs that are not exact.