What is LLM evaluation?

LLM evaluation is the practice of measuring how well a model-powered feature performs on a defined task, using a fixed set of test cases, automated checks and human review, repeated on every change.

Also called LLM evals, evals, LLM-as-a-judge, evaluation setUpdated

Traditional software has unit tests with exact expected outputs. LLM features rarely do: one question can have many good answers, and the output shifts when you edit a prompt, swap a model or re-index documents. LLM evaluation gives you a repeatable way to tell whether a change made the feature better or worse.

The term has two meanings. Model benchmarks compare general-purpose models on public test suites. Application evaluation measures your feature on your task, and it is the one that decides whether you can ship. This page is about the second.

The parts of an evaluation

An evaluation set. Usually 50 to 200 real or realistic inputs, each with the expected behaviour: a correct answer, the passage that should be retrieved, or "should refuse". Include easy cases, awkward ones, questions the sources can't answer and attack attempts.

Scorers, from the cheapest and most reliable to the least:

  • Deterministic checks in code: valid JSON, required fields present, a citation included, length under a limit, no banned phrases.
  • Reference comparison: an exact or fuzzy match against a known answer, such as an extracted invoice number or a classification label.
  • LLM-as-a-judge: a second model scores open-ended answers against a rubric, for example "is every claim supported by the sources?". It scales well but has biases, so check it against human ratings on a sample.
  • Human review by someone who knows the domain, on a regular sample.

A harness that runs the set on every change to prompts, models, retrieval or code, as a stage in CI/CD, and keeps the scores over time.

Metrics that usually matter

For a RAG feature, score retrieval and generation separately:

  • Recall@k: the share of questions where the correct passage appears in the top k results.
  • Faithfulness (groundedness): the share of answers whose claims are all supported by the retrieved text. This is where hallucinations show up.
  • Answer correctness against the reference answer.
  • Refusal accuracy: does it say "I don't know" when it should, and only then?
  • Latency and cost per request, because a better answer that takes three times as long may not be better for users.

Example: comparing two prompt versions

A compliance Q&A assistant has an evaluation set of 120 questions, 15 of which the sources can't answer. The team tests a new prompt (v7) against the current one (v6):

metric                       v6        v7
recall@5                     104/120   104/120   (retrieval unchanged)
faithful answers             109/120   114/120
correct refusals (of 15)     11        14
valid citation format        118/120   120/120
median latency               2.1 s     2.3 s

v7 improves faithfulness and refusals for a small latency cost. Before shipping, someone reads every case that changed from pass to fail. Two questions regressed because v7 refused even though the answer was in the sources. The team adds similar cases to the set and adjusts the prompt before release.

Common mistakes

  • Testing by eye. Trying five questions after each change misses regressions.
  • Looking only at averages. A model upgrade that lifts the average but breaks a few critical cases is still a regression.
  • Trusting the judge blindly. Measure how often the model grader agrees with people.
  • A frozen set. Add production failures every week, using what observability data and user feedback show.

See taking an LLM feature from demo to production for how evaluation fits with retrieval, guardrails and monitoring.

Any idea in mind? Let's make it real.

Tell us what you're building. You'll hear back from an engineer, not a sales team, usually within one working day.

Book a 30-min call