AI Engineering
How to evaluate an LLM application before and after you ship it
Vibe checks do not scale. Build a golden test set, mix rule-based checks with model grading and human review, run it in CI, and keep measuring in production.
By Envexa Engineering7 min read
The first version of most LLM features is judged by trying a few prompts and deciding it feels good. That works for a demo and fails the moment you change a prompt, swap a model or meet real users. Without measurement, every change is a guess, and regressions are found by customers.
Start with a golden set
A golden set is a list of realistic inputs with a description of what a good result looks like. Start with 30 to 50 cases drawn from real or realistic usage, and deliberately include the awkward ones: ambiguous questions, missing information, adversarial inputs, and cases where the right answer is to refuse or hand over to a person.
- Store cases in version control next to the code, one file per case or one JSONL file.
- Record the expected behaviour, not only an expected string. For a support agent, that might be "calls
lookup_order, does not callcreate_refund, cites policy section 2". - Add every production failure you find as a new case. The set should grow from real mistakes.
Use the cheapest check that works
Not everything needs a model to judge it. Layer the checks, from cheapest and most reliable to most expensive:
- Deterministic checks. Does the output parse as the required schema? Are required fields present? Are citations valid identifiers from the retrieved set? Are forbidden phrases absent?
- Reference checks. For extraction and classification, compare to labelled values and compute precision and recall per field.
- Model-graded checks. For open-ended text, use a second model with a written rubric ("Is every claim supported by the passages? Answer yes or no and quote the unsupported claim.").
- Human review. Sample outputs regularly, especially where model grading and human opinion might differ.
Be careful with model graders
A model grading another model is useful but biased: it tends to prefer longer answers, its own style and confident wording. Keep rubrics narrow and binary, grade one property at a time, and calibrate against a sample of human judgements. If the grader and humans disagree often, fix the grader before trusting its numbers.
Measure the parts separately
For retrieval-based systems, measure retrieval (was a correct passage in the top results?) separately from generation (given good passages, was the answer faithful?). For agents, grade the trajectory: tools called, arguments, order and stopping behaviour, as well as the final text.
Run it like tests
on every change to prompts, models, retrieval or tools:
run golden set → compute scores per category
compare with the main branch baseline
fail the build if any category drops by more than the agreed thresholdBecause model output varies, run each case more than once where it matters and look at pass rates, not single results. Pin model versions where the provider allows it, and treat a provider-side model update like any other dependency upgrade.
Keep measuring in production
- Log inputs, outputs, tool calls, latency, token use and cost, with personal data handled according to your policy.
- Collect cheap feedback signals: thumbs up or down, edits to drafts, escalation rates.
- Review a regular random sample, plus every low-confidence or escalated case.
- Alert on drift: rising refusal rate, rising cost per task, falling schema-validity.
Common mistakes
- Tuning prompts until the golden set passes, then never refreshing it. Hold some cases back.
- Measuring only average quality, which hides a category that has quietly broken.
- Skipping the cases where the right behaviour is to say "I don't know".
An evaluation set is the most valuable asset in an LLM project: it makes changes safe, makes model upgrades a measured decision, and turns "it feels worse" into a number you can act on.
Related articles
RAG architecture: the decisions that matter before you pick a vector database
Retrieval-augmented generation succeeds or fails on chunking, retrieval quality and evaluation, not on your vector database choice. A practical guide.
Building reliable AI agents: tools, limits and a way out
How to design AI agents that behave in production: small typed toolsets, step and cost budgets, validated arguments, escalation and trajectory evaluation.