News / Learn / Evaluation & safety
How do you build an eval set?
You'll be able to build a small eval set that tests your AI app on the cases that matter.
In plain English
An eval set is a fixed list of test inputs with expected results or grading rules. You run your AI feature against it each time you change a prompt, model, or setting. The score tells you whether the change helped, hurt, or did nothing. Without one, you are guessing.
Why it matters
Language model output is not deterministic and small prompt edits can break cases you never looked at. A shared eval set gives you a repeatable check before you ship. It also turns vague complaints like "it feels worse" into specific failing cases you can fix.
How it works
Start with real inputs. Pull examples from logs, support tickets, or your own use. Include ordinary cases, edge cases, and cases where the app failed before. Aim for a set you can actually review by hand, often 30 to 100 items at first.
For each input, write what a good answer looks like. Some checks are exact: a required field, a valid JSON shape, a fact that must appear. Others need judgment, such as whether a summary is faithful. Use code checks where you can, because they are cheap and consistent. Save the rest for a judge step or a human reviewer.
Tag each item with a category, such as billing, refusal, or long input. Tags let you see which area got worse, not just that the total dropped. Keep the set under version control so you know which version produced each score.
Run the set on every change to prompts, model, retrieval, or parameters. Compare against the previous run, not against an ideal score. Look at the failures themselves. A score only tells you where to look.
Grow the set over time. Every bug a user reports should become a new item. Remove items that are ambiguous or that no longer reflect real use. Keep a held-out portion you do not tune against, so you do not overfit your prompts to the test.
A concrete example
A small eval runner in Python. Each case has an input and a rule. The rule is a function that returns True or False.
import json
cases = [
{"id": "refund-01", "input": "I want my money back for order 123",
"check": lambda out: "refund" in out.lower()},
{"id": "json-01", "input": "Return the city in JSON: I live in Lisbon.",
"check": lambda out: json.loads(out).get("city") == "Lisbon"},
{"id": "no-pii-01", "input": "My card is 4111 1111 1111 1111.",
"check": lambda out: "4111" not in out},
]
def run_app(text):
# Replace with a call to your model or app.
raise NotImplementedError
def run_eval(cases):
passed = 0
failures = []
for case in cases:
try:
ok = case["check"](run_app(case["input"]))
except Exception:
ok = False
if ok:
passed += 1
else:
failures.append(case["id"])
print(f"{passed}/{len(cases)} passed")
print("failed:", failures)
# run_eval(cases)A short sketch to show the idea. Check the official docs of the tool you use.
What goes wrong
- Testing only the happy path Add messy, rude, ambiguous, and empty inputs. Pull failures from real logs so the set reflects actual use.
- Tuning prompts against the whole set Hold back a portion of items you never look at while tuning. Check that gains hold on the held-out part.
- Trusting one total score Break results down by category and read the failing outputs. A stable average can hide a broken area.
- Writing vague expected answers Define what counts as correct before you run anything. If two reviewers would disagree, the rule is too loose.
- Never updating the set Add every new bug as a case and retire outdated items. A stale set stops catching the problems users have now.
Going deeper
Learn how to write grading rules for open-ended output, how to measure agreement between human reviewers, and how to set up eval runs in your CI pipeline so regressions block a release.
FAQ
How many cases do I need?
Start with about 30 to 50 that you can review by hand. Grow it as you find new failure types. Size matters less than coverage of real cases.
Where do the inputs come from?
Use real user inputs from logs or support tickets when you have them. Early on, write realistic ones yourself and include known failures.
Can I use the same model to grade the outputs?
You can, but check its grades against human labels first. Judge models can share the biases of the model they grade, so spot-check regularly.
Should evals run on every commit?
Run a fast subset on each change and the full set before a release. Keep the full run affordable enough that people will actually run it.
Written with AI by CapyLaunch. Spotted a mistake? Email hello@capylaunch.com.