Skip to content

Write your own eval before you trust a benchmark

A 30-example test set tells you more about your use case than any leaderboard. Here is how to build one in Python.

NZNarjis Zekhnini21 Oct 20263 min readDrafted with Inky · reviewed by Narjis

Public benchmarks measure general ability. Your product needs something narrower: does this model answer your users' questions, in your format, without the mistakes that matter to you? The only way to know is a small evaluation set of your own.

Step 1: collect real examples

Start with 30 to 100 inputs taken from real usage — support tickets, documents, user prompts. Include the hard cases: ambiguous questions, long inputs, edge cases where you have seen failures.

Step 2: decide what "good" means

For each example, write down what a correct answer must contain or must avoid. Prefer checks a program can run:

  • exact or normalised match for short answers,
  • "contains these facts" for summaries,
  • valid JSON with the right keys for structured output,
  • a rubric scored by a second model for open-ended text.

Step 3: a minimal harness

import json
 
cases = [
    {"input": "Refund policy for damaged items?", "must_include": ["30 days", "photo"]},
    {"input": "Do you ship to Monaco?", "must_include": ["yes"]},
]
 
def run_model(prompt: str) -> str:
    ...  # call your model or API here
 
def score(case, output: str) -> bool:
    text = output.lower()
    return all(term.lower() in text for term in case["must_include"])
 
results = []
for case in cases:
    out = run_model(case["input"])
    results.append({**case, "output": out, "pass": score(case, out)})
 
passed = sum(r["pass"] for r in results)
print(f"{passed}/{len(results)} passed")
json.dump(results, open("eval_results.json", "w"), indent=2)

Save every output. Reading the failures is where you learn the most.

Step 4: use it for every change

Run the same set whenever you change the prompt, the model, the temperature or the retrieval step. A change that fixes one complaint often breaks something else — the eval catches it before your users do.

Common mistakes

  • Testing only easy cases. Your eval should fail sometimes, or it isn't measuring anything.
  • Changing the test set and the system at the same time. Version both.
  • Trusting a model judge blindly. Spot-check its scores by hand, especially at the start.

Takeaways

  • A small, real, versioned test set beats a leaderboard for product decisions.
  • Prefer automatic checks; use model-graded rubrics where needed.
  • Re-run on every change and read the failures.

Keep reading

Get the next tutorial by email

One email a week. No spam.