What are LLM evals, and how do you build them?
LLM evals are repeatable tests that measure how well a language model application performs on the tasks it is meant to do. An eval runs a set of realistic inputs through the system, scores each output with code, a model-based judge or a human, and reports a result you can compare across changes to prompts, models and retrieval.
Without evals, every prompt change is a guess. You tweak an instruction, three outputs look better, and you ship, without knowing that twenty other cases quietly got worse.
Why are evals important for LLM applications?
LLM output varies from run to run, fails in subtle ways and changes whenever you edit a prompt or switch models. Traditional unit tests expect one exact output; LLM systems produce a range of acceptable outputs and a range of subtly wrong ones. Evals give you a number you can track, so you can tell improvement from luck, catch regressions before users do, and decide with evidence whether a cheaper model is good enough.
What types of evals are there?
| Type | How it scores | Best for | Limits |
|---|---|---|---|
| Code-based checks | Exact match, regex, JSON schema validation, running unit tests | Classification, extraction, code, format rules | Cannot judge tone, helpfulness or open-ended quality |
| LLM-as-a-judge | A model grades output against a rubric | Summaries, answers, tone, faithfulness to sources | Must be calibrated against human judgement; see LLM-as-a-judge |
| Human review | People rate or label outputs | Building the first labels, high-stakes quality, calibrating judges | Slow and expensive |
| Online metrics | Real user signals: thumbs up, edits, task completion | Measuring impact in production | Noisy and only available after release |
Most mature systems combine them: code checks for everything they can cover, a calibrated LLM judge for the rest, periodic human review, and production metrics.
How do you build an eval set?
- 1Collect real inputsPull 50 to 200 examples from logs, support tickets or realistic scenarios. Include hard cases, not just typical ones.
- 2Read outputs firstRun the current system and read the outputs by hand. Write down the ways they fail.
- 3Define pass criteriaTurn each failure type into a checkable criterion, such as "cites a source", "total matches the invoice" or "declines out-of-scope requests".
- 4Label expected resultsAdd correct answers where they exist, or rubric scores for open-ended cases.
- 5Automate scoringWrite code checks and judge prompts, then run the whole set with one command.
- 6Track over timeRecord the score for every prompt, model or retrieval change, and add every new bug as a test case.
Error analysis, reading outputs and grouping failures, is the step teams most often skip, and it is the most valuable. Metrics chosen before looking at real failures tend to measure the wrong things.
What makes a good eval?
- Do: Use real, messy inputs, including edge cases and requests the system should refuse
- Do: Score specific, observable criteria rather than a vague 1 to 10 "quality" rating
- Do: Run each case more than once when outputs vary, and look at the pass rate
- Do: Keep the eval set in version control next to the prompts
- Do: Check that the eval can fail: a test that always passes tells you nothing
- Avoid: Test only on examples you used while writing the prompt; you will overfit to them
- Avoid: Trust a single overall score without looking at which cases fail
- Avoid: Replace human judgement with an LLM judge you have never checked against humans
How do evals fit into development?
Treat the eval set like a test suite. Run it before merging any prompt, model or retrieval change, and block changes that reduce the score on important criteria. When switching to a new model, run the full set first: newer models are usually better on average but can regress on your specific cases. For agents, evaluate complete tasks end to end, such as "was the bug fixed and do the tests pass", as well as individual steps.
Frequently asked questions
What is an LLM eval?
An LLM eval is a repeatable test that runs a set of inputs through an AI system and scores the outputs automatically or with human review, giving a measurable result you can compare across changes.
How many test cases do I need?
Start with 20 to 50 carefully chosen cases, which is enough to catch obvious regressions. Grow to a few hundred as you find new failure types. Coverage of different cases matters more than raw count.
What is a golden dataset?
A golden dataset is a curated set of inputs with verified correct outputs or labels, used as the reference for evaluating a system. It should be kept separate from the examples used to write prompts.
What is the difference between evals and benchmarks?
Benchmarks are public, general tests used to compare models, such as maths or coding suites. Evals are your own tests of your own system on your own tasks, which matter far more for product decisions.
Can I use an LLM to evaluate another LLM?
Yes, this is called LLM-as-a-judge. It scales well for open-ended outputs, but you should check its scores against human ratings on a sample and watch for known biases.
Last checked for accuracy on . Written by the solidcoder team.