LLM evaluation: a test harness with pass criteria
By Abdul Asim ·
The short answer
LLM evaluation is a repeatable test harness: a fixed set of real inputs, a written pass rule for each one, and a score you rerun every time the prompt, model, data or code changes. If a change drops the score, it does not ship. Spot-checking a few answers in a chat window is not evaluation, because it cannot tell you what got worse.
In production the harness has three layers: automated checks before release, human review where the stakes are high, and monitoring after launch that feeds new failures back into the test set.
Why vibe checks miss regressions
Every change to an LLM system moves behavior somewhere you were not looking. A tighter prompt fixes the tone and breaks a JSON field. A new chunking rule helps long PDFs and hurts tables. A model upgrade is better on average and worse on your three most important customers. You only see those trade-offs if the same inputs are scored the same way before and after.
That is why I treat evaluation like a test suite in normal software. The questions are the test cases, the pass rules are the assertions, and the score is the build status. The difference is that some assertions are fuzzy, so you need to be explicit about how each one is judged.
How to build an LLM test set
Start small and real. Fifty well-chosen cases beat five hundred synthetic ones you never read. - Pull from real traffic or real documents. Logged user questions, past tickets, actual RFP requirements. - Cover the boring middle and the edges. Common requests, ambiguous ones, questions with no answer in your data, and inputs that try to misuse the system. - Write the expected outcome, not just the expected text. "Cites the 2025 refund policy and says 30 days" is testable. "A good answer" is not. - Tag each case. By topic, customer type or risk level, so a score drop points somewhere. - Include hostile inputs. A handful of prompt injection attempts and off-topic requests show whether the system holds its boundaries. - Version it. The test set changes over time; record which version produced which score.
Keep the cases where the right answer is "I don't know". Systems that never refuse look great in demos and produce the confident fabrications described in the AI hallucination guide.
Pass criteria for evaluating LLM outputs
Use the cheapest check that actually decides pass or fail, and only reach for a model-graded check when nothing stricter works.
| Check | Use it for | Example pass rule |
|---|---|---|
| Exact or rule-based | Labels, numbers, IDs, yes or no | Label equals expected label |
| Schema validation | Structured output, tool calls | Parses and every required field is present |
| Reference match | Facts that must appear | Answer contains the policy number and the 30-day limit |
| Model-graded rubric | Tone, completeness, grounding | Judge scores 4 or 5 on a written rubric |
| Human review | High-stakes or novel cases | Reviewer approves before release |
Model-graded checks are useful but need their own testing. The MT-Bench and Chatbot Arena study found strong judge models agreed with human preferences over 80% of the time, and also documented position, verbosity and self-enhancement biases. So I give the judge a narrow rubric, swap answer order when comparing two outputs, and check a sample of its verdicts by hand.
Schema checks have a trap of their own. On the Odva agentic security testing workflow, every finding is validated against a Pydantic schema before it reaches a report, with evidence stored alongside. A valid schema proves the finding is well formed. It does not prove the vulnerability is real. Keep format checks and correctness checks as separate lines on the scorecard.
RAG evaluation: score retrieval and generation separately
A RAG answer can fail in two places, and a single score hides which. Score them apart: - Retrieval: for each test question, did the right passage appear in the top results? Track hit rate and how often a key document is missing. - Grounding: does every claim in the answer appear in the retrieved passages? - Answer quality: does it address the question, in the required format, with citations that point to the passage used?
When retrieval passes and grounding fails, the problem is the prompt or the model. When retrieval fails, no prompt will save you; look at chunking, metadata and ranking, which the components of a RAG pipeline guide breaks down. The Ragas paper proposes reference-free metrics along the same three lines: context relevance, faithfulness and answer quality. Those are a good starting set, but I still keep a small labeled set where I know exactly which document should come back.
For the failure patterns these scores tend to reveal after launch, see production RAG pipelines.
Where human review fits
Automated checks cover volume. People cover judgment, and the job is to put them where a wrong output is expensive, not on every output.
On the Center for Creative Leadership reporting workflow, source data is validated before drafting, the generated analysis is validated after, and a team lead approves each report through Outlook before it reaches anyone. The model drafts; a person releases. On the Odva testing workflow, risky test proposals go to a human reviewer before execution, and a scope gate limits where any test can run at all.
The other pattern is confidence-based routing. In a security telemetry labeling pipeline I built, labels that passed validation and consensus checks went straight through, and only low-confidence cases reached a reviewer. That cut human review by about 70%. Every reviewer decision is also free evaluation data: a disagreement between model and reviewer is a test case waiting to be added.
Monitoring LLMs in production
A passing test set describes yesterday's traffic. Monitoring tells you when today's traffic is different. At minimum, log for every request: input, retrieved document IDs, prompt and model version, output, latency, token count, any validation failures, and user feedback or escalation.
For McKissock Learning's sales assistant, requests are logged to New Relic and unresolved conversations become HubSpot tickets. That ticket stream is a direct signal of where the assistant falls short, and a source of new test cases. Watch trends rather than single events: rising escalations, more refusals, longer answers, or latency creeping up after a model change.
Set alert thresholds before launch, while you still remember what normal looks like. I usually alert on validation failure rate, escalation or refusal rate, p95 latency and cost per request, each compared with the previous week. A spike in one of them rarely tells you the cause, but it tells you which traces to open first, and those traces are where the next test cases come from.
Close the loop on a schedule. Each week or sprint, sample failures from logs, tickets and reviewer overrides, write them up as test cases with pass rules, and add them to the set. That is how the harness keeps up with real use instead of describing the launch week.
Turn evaluation into a release gate
- Run the full test set on every change to prompts, models, retrieval settings or code that touches the pipeline.
- Compare against the last release by tag, not just in total.
- Block the release if any high-risk tag drops, even when the overall score rises.
- Record the test set version, model version and score with each release.
- Feed production failures back into the set.
The same harness tells you whether fine-tuning an LLM actually helped or just changed its tone. If you have an AI feature in production and no harness like this, my AI app review checks retrieval, chunking, evals, cost and model routing on the live system, and tells you what a minimal test set with pass criteria should look like for it.
