Skip to content
MarsLab

How to Build an Eval Set for LLMs, Step by Step

Where the test cases come from, how many you need, how to grade them, and how to keep the set honest after launch.

8 min readPublished Nov 2026

To build an eval set for an LLM application, collect real inputs from production or from the people who will use the system, add the cases that have already failed, write a clear pass condition for each, and grade with code wherever you can. Keep part of the set hidden from tuning, run it before every release, and add new failures as they appear.

What is an LLM eval set?

An eval set is a fixed collection of inputs, each paired with a way to decide whether the system’s output is acceptable. You run the whole set against every version of your prompt, model or pipeline and compare the scores.

It is the LLM equivalent of a test suite, with one difference: outputs vary, so a case usually passes or fails against criteria rather than an exact string. OpenAI’s guide puts the reason plainly: generative AI is variable, and evals are a way to test your system despite that variability. This article is the how-to. If you want the argument for why a stale set misleads you, read your eval set is lying to you.

Where should test cases come from?

From what users actually send, not from what you imagine they will send. Production logs, support tickets, call transcripts and past failures give you real phrasing, real mess and real edge cases.

Both major vendors say the same thing. Anthropic advises that you design evals that mirror your real-world task distribution. OpenAI lists, as an anti-pattern, creating eval datasets that don’t faithfully reproduce production traffic patterns. Rank your sources roughly in this order:

  • Real production inputs, sampled across the whole range of traffic and not just the clean ones.
  • Failures: every wrong answer a user or reviewer reports becomes a case, with the correct answer attached.
  • Edge cases you can name: empty or irrelevant input, very long input, abusive input, and requests that are ambiguous even to a human.
  • Historical records from the process the system replaces, such as old tickets or old call logs.
  • Synthetic cases, last, and only seeded from real ones.

If the system is not live yet, you have no production logs. Use the closest real thing: transcripts, emails or forms from the process you are automating. Then log everything from the first day so the next version of the set comes from real traffic.

How many test cases do you need to start?

Start with a few dozen well chosen cases, then grow. A small set that covers your real task types beats a large set of near duplicates. The number matters less than whether each kind of input and each known failure is represented.

The 20 to 50 range is a working rule of thumb, not a measured threshold. Below that, one flaky case swings the score. Above it, effort is better spent on coverage than on count. Anthropic’s guidance leans towards quantity once you can grade automatically: more questions with slightly lower signal automated grading is better than fewer questions with high-quality human hand-graded evals. The same page notes that you can ask Claude to help generate more cases from a baseline set of examples, which is a reasonable way to widen a seed set you wrote from real data.

How do you write the expected result for each case?

Write the pass condition, not a model answer. For some cases that is an exact value. For most it is a short list of things the answer must contain, must not contain, and must do.

  • Exact answer: a category, a number, a record ID or a tool call with specific arguments. Match it with code.
  • Must include: facts the answer cannot omit, such as a refund window or a policy name.
  • Must not include: invented details, internal notes, another customer’s data or a promise the business cannot keep.
  • Must do: refuse, ask a clarifying question or hand over to a person, when that is the right behaviour.

Have someone who knows the domain write or approve these conditions. If two reviewers disagree on whether an answer passes, the condition is unclear and the case needs rewriting before it is worth running. Anthropic’s list of edge cases includes ambiguous test cases where even humans would find it hard to reach an assessment consensus, so keep a few, but label them so they do not drag your score down unnoticed.

Should you grade with code, a model or a human?

Use code wherever the answer can be checked by a rule, a model grader for judgements that need language understanding, and humans for calibration and the hardest cases. Mixing the three is normal.

  • Code-based grading: exact match, string checks, schema validation, running generated code, checking a tool call. Anthropic calls it fastest and most reliable, extremely scalable, but it lacks nuance for judgements that need flexibility.
  • Model grading: a second model scores the output against your rubric. Fast, scalable and suited to tone, completeness and faithfulness, but it has to be tested for reliability first.
  • Human review: the highest quality and the slowest. Anthropic’s guide says to avoid it if possible, and OpenAI’s calls it the highest quality but slow and expensive. Use it on a sample, not on every run.

How do you make a model grader reliable?

Give it a narrow rubric, a fixed output format, and check it against human judgement before you trust it. A grader that nobody has compared with a person is another unmeasured component.

  • Write a specific rubric. Anthropic’s example is a rule that the answer must mention a named company in its first sentence, and is graded incorrect if it does not.
  • Constrain the output. Ask for correct or incorrect, or a score from 1 to 5, not free text.
  • Let the grader reason before it scores. Both vendors recommend it for complex judgements.
  • Prefer pass or fail, or pairwise comparison, to fine scales. OpenAI recommends this for reliability.
  • Watch for known biases. OpenAI names position bias and verbosity bias, where the judge favours the first answer shown or the longer one.

Then calibrate. Have a person grade a sample of the same outputs and compare. OpenAI’s advice is to scale up only once the judge is faster, cheaper and consistently agrees with human annotations.

Why keep a held-out set?

Because anything you tune against stops being a fair test. A held-out set is a slice of cases that nobody looks at while changing prompts, so its score tells you how the system behaves on inputs it was not shaped for.

Split your cases into a working set and a held-out set before you start tuning. Use the working set to debug and iterate. Run the held-out set rarely, for example before a release, and treat a gap between the two scores as a warning that you have tuned to the working set. When a held-out case fails and you fix it, move that case into the working set and replace it with a fresh one drawn from production.

How do you run evals before each release?

Run the full set on every change that can alter behaviour, and compare the result with the last released version. Block the release on a regression, not on an absolute number alone.

OpenAI describes the habit as continuous evaluation: run evals on every change, monitor your app to identify new cases of nondeterminism, and grow the eval set over time. A workable release check looks like this:

  • Trigger the run on any change to the prompt, model version, retrieval setup, tools or grader.
  • Report the score per tag, not only overall, so a drop in one area is not hidden by a gain in another.
  • Diff the outputs of cases that flipped from pass to fail and read them. The numbers say that something changed, the outputs say what.
  • Set explicit rules, such as no new failures on safety cases, and write them down before the run.
  • Store every run with the version it tested, so a later question has an answer.

Because outputs vary, run a case more than once if it matters, or at least check that a failure repeats before you act on it. This is the same discipline we apply when we treat week eight as a production date: the check has to happen before anyone depends on the system.

How does an eval set go stale?

Users change what they ask, the product changes what it can do, and the model underneath changes how it answers. The set stays frozen, so its score keeps describing a system and a user base that no longer exist.

  • New phrasing and new topics appear in production that no case covers.
  • A feature launch shifts what people come to ask about.
  • Fixed failures stop being a useful test once the system is tuned against them.
  • Policies, prices and product facts change, so some expected results become wrong.
  • The model or prompt changes, and failure modes move to places the set never probed.

A stale set rarely fails loudly. The score holds steady while a business metric such as resolution rate or escalations drifts. Keep that metric next to the offline score and look at both. Production behaviour, recorded with something like an audit trail of every answer, is also the raw material for the next refresh.

How do you refresh the set?

On a schedule, and after any incident. Sample new production inputs, add every reported failure, retire cases that no longer reflect the product, and check the expected results still match current policy.

  • Every month or quarter, depending on traffic, pull a fresh random sample from production logs and add the cases the current set would not have predicted.
  • After every incident or user complaint, add the failing input with its correct result the same week.
  • Review the pass conditions against current policies, product facts and prices, and fix the ones that are out of date.
  • Remove or archive cases for features that no longer exist.
  • Refill the held-out set so it stays unseen, and note the date of each change.

Treat the set as a versioned asset with an owner, kept in the same repository or store as the system it tests. If nobody can say who last changed it or where its cases came from, you cannot tell what its score means.

How does MarsLab approach evaluation?

We build the evaluation harness into the system and test against questions with known answers before launch, so wrong answers are caught by evaluation and not by users. Our published pages describe this for two client systems.

For the voice agent at Bhajanlal, the agent is built against real call transcripts rather than an imagined script, and it is evaluated before launch on questions with known answers. For the Utkarsh doubt engine, evaluation catches wrong answers instead of students. The details are in the Bhajanlal case study and the Utkarsh case study.

When should you talk to MarsLab about evals?

Talk to us if you have an LLM system in production, or close to it, and cannot say whether its quality is holding. We embed forward deployed engineers who build the system and its evaluation harness together.

Read the common questions first if you want to see how an engagement runs. If your eval numbers and your production numbers disagree, or you have no eval set yet, tell us what is breaking.

We want your hardest problems.

We collaborate with ambitious organisations ready to move beyond AI experimentation. If you’re looking to transform how your business operates, we’d love to build with you.

Book an intro call (opens in a new tab)

Thirty minutes with an engineer, not a sales sequence. Pick a slot that suits you.