Topic 4 of 6 · 4 min read
Your first twenty eval cases
Goal: Assemble a first eval of about twenty real cases with a pass or fail rule for each and run it against the current prompt.
Your first eval is about twenty real inputs, one pass or fail rule per input, and a table of results; you can build it in an afternoon with a spreadsheet and a short script. Do this before you evaluate any platform.
Check yourself · 1 of 3
What is a reasonable first eval for a new LLM feature?
Why it matters
Teams delay evals because they picture a large system: a dataset of thousands, a dashboard, a judge model. None of that is needed to get most of the value. Twenty well-chosen cases will already catch the failures you can currently see, and reading them teaches you what to measure next. Hamel Husain's guidance is similar: start with looking at real data and simple checks, and add tooling when the simple version hurts.
How to build it
- Collect 20 real inputs. Pull from logs, support tickets or user messages. If the feature is new, ask five colleagues to write messages as a user would. Include the odd ones: an empty message, a very long one, another language, a rude user, a request outside scope.
- Cover the failure types you know. If 6 of the 20 are the failure that worries you most, that is fine. This is a test set, not a sample of traffic.
- Write the pass rule for each case before you run anything. Prefer a code check: contains the order id, valid JSON, refuses the out-of-scope request. Use a written rubric for the rest.
- Run the current prompt on all cases, three times each if the output varies, and record the results in a table.
- Read every failure. Fix the prompt or fix a wrong case. Rerun and compare.
A starting file can be this small:
import json
cases = [json.loads(l) for l in open("cases.jsonl")]
for c in cases:
out = call_model(c["input"])
ok = all(s in out for s in c["must_contain"])
print(c["id"], "PASS" if ok else "FAIL")
Before and after
Before: "We should set up an eval platform."
After: "cases.jsonl with 22 lines, a 15-line script, and a table showing 14 of 22 passing. Failures: 5 are out-of-scope requests it answers, 3 miss the order id."
What goes wrong
- Waiting for a perfect set. Twenty now beats two hundred in a month.
- Inventing cases that look like your prompt's examples. The set then only tests what you already solved.
- Changing the pass rules after seeing the output until everything passes.
- Tuning on the same 20 forever. Keep a few cases aside and unseen until the end.
Examples
Twenty cases for a returns bot
8 ordinary return requests, 4 with missing order numbers, 3 asking for an exception to the policy, 3 off-topic ("what is the weather"), 2 in Spanish. Pass rules: order id repeated back, policy not contradicted, off-topic politely declined, Spanish answered in Spanish.
A spreadsheet is a fine runner
Columns: id, input, must, run1, run2, run3, pass_count. Paste outputs from a small script, and sort by pass_count to see the weakest cases first. Moving to a runner such as Promptfoo later is a copy of the same columns.
Key points
- About twenty real cases, each with a written pass or fail rule, is enough to start.
- Pull inputs from real logs, tickets or messages, and include odd and out-of-scope ones.
- Write each case's pass rule before running the prompt, so the output cannot shape the rule.
- A short script and a table are enough; adopt a platform when the simple version becomes painful.
- Read every failure, then fix either the prompt or a wrong case and rerun.
Common mistakes
- Delaying the first eval until a platform is chosen.
- Writing cases that mirror the prompt's own examples.
- Loosening a pass rule after seeing a failing output.
- Reusing the same twenty cases for every tuning round with no unseen cases left.
Check yourself · 2 of 3
When should you write the pass rule for a case?
Check yourself · 3 of 3
Where should the first twenty cases mainly come from?
Practice items, not counted towards your mastery.
Start here
- Your AI product needs evals (Hamel Husain) (opens in a new tab)ArticleFree
A practitioner's case for starting with real traces, simple checks and a data review habit before any tooling.
- Demystifying evals for AI agents (Anthropic) (opens in a new tab)ArticleFree
Defines tasks, graders and trials, and shows how evals guard changes across a product's life.
- Develop test cases (Claude docs) (opens in a new tab)DocsFree
How to turn a feature goal into specific, measurable criteria and test cases.
More for this topic
- Promptfoo introduction (opens in a new tab)ToolFree
An open-source runner that turns a list of test cases and assertions into a pass-rate table.