Skip to content
mentoor

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?

Choose one answer

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

  1. 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.
  2. 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.
  3. 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.
  4. Run the current prompt on all cases, three times each if the output varies, and record the results in a table.
  5. 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?

Choose one answer

Check yourself · 3 of 3

Where should the first twenty cases mainly come from?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic