Evals: testing what an LLM says
Datasets, graders and regression gates for output that's never exactly the same twice.
☰
You can't assert one exact answer when the same input can give different outputs. So you build a set of real cases, grade every run with code, a model or a person — and let the scores decide what ships.
+ The whole system in one paragraph− Hide
A unit test checks that the same input gives the same output. An LLM gives different outputs for the same input, so you test it differently: a dataset of real tasks, a runner that uses the code you ship, graders that score each answer, and a gate that compares the scores with the last version. After shipping, you keep grading samples of real traffic, and every failure you find becomes a new test case.
In this lesson
7 chapters · ~9 min · a quick check in eachEverything is on this page — just scroll down ↓
New to this? Warm up first+ optional
Words you'll meet
You'll meet these words on every diagram of this topic. Skim them now and come back whenever one shows up.
ⓘ Details & sources− Hide details
The terms, in plain words.
The whole system
Why unit tests aren't enough
Models can give different outputs for the same input (OpenAI), so an exact assert fails good answers or passes on luck. You grade over many cases instead.
ⓘ Details & sources− Hide details
Keep your unit tests. Add evals for what the model says.[1]
Evals, on one page
A developer opens a pull request that edits the prompt. CI starts the eval runner.
Build it up, one piece at a time
You don't need the whole picture on day one. Start with a small set of real failures, grade what code can grade, add a judge only after checking it, then put it in CI and feed it from production.
5 steps. Follow the flow one step at a time — what happens first, and what comes next.
Why can't a plain unit test (assert equals) check what an LLM says?
Pick one — or just keep scrolling, it's not graded.
Keep going — it's free
Create your free account to unlock the rest of this lesson, keep your progress and pick up right where you left off.
- 2The dataset
- 3Graders
- 4LLM as judge
- 5Agents
- 6Production
- 7Benchmarks vs your evals