Why evals, and how to build a test set
Evals & Guardrails · 10 questions
Short notes
Key idea
LLM output varies and prompts change constantly. An eval is a repeatable test: a fixed set of inputs, a way to score each output, and a score you track over time. Without one, you're guessing whether a change helped.
Syntax
A test set:
- Real inputs from logs or users, not only made-up ones.
- Expected output or criteria per case ("category: refund", "mentions the 7-day window").
- Cover the spread: common cases, edge cases, known failures, attacks.
- Start with 20–50 cases; grow it with every bug you find.
- Score: exact checks, code checks, or a judge (a person or a model).
Example
A ticket classifier: 100 labelled tickets from last month. The current prompt scores 88%. A new prompt scores 93% overall, but drops 3 refund tickets the old one got right; you see exactly which, before shipping.
Traps
- "It looked good on three examples" isn't an eval.
- A test set the prompt was tuned on overstates quality; keep some cases aside.
- Only an overall score hides regressions; look at failures.
- Never updating the set lets it drift from real traffic.
Want the full lesson with step-by-step examples, a project and a certificate? Evals & Guardrails course, ₹180 →
- Question 1easy
What are the three parts of an eval?
- Question 2easy
You changed the system prompt and tried 5 questions; they look fine. What's the risk?
- Question 3medium
Your test set is a random 50 tickets. Only 1 is a payment ticket and none are injection attempts. What's the problem?
- Question 4medium
Why keep a separate test set when iterating on prompts?
- Question 5medium
With 20 cases, how many percentage points does one case flipping move the pass rate?
print(100 / 20)
Why evals, and how to build a test set
Why evals, and how to build a test set
Why evals, and how to build a test set
Why evals, and how to build a test set
Why evals, and how to build a test set
5 more questions on this topic, with hints, and tests
Sign up free for 21 days of every question and test.