Glossary · AI in testing
LLM evaluation
Also called: LLM evaluations, LLM evals, LLM eval
Definition
Systematically measuring the quality of an LLM-powered feature against a fixed set of inputs and criteria, since outputs vary and exact asserts rarely fit.
LLM evaluation (“evals”) is how you test a feature built on a large language model: run it over a fixed set of inputs, score each output against defined criteria, and track the scores over time. Traditional tests assert one exact expected value. LLM output is free text that varies between runs, so evaluation replaces exact equality with a mix of deterministic checks, graded scores and human review, and judges the feature on pass rates across many cases rather than on one example.
Example
A support-ticket classifier evaluated against a labelled dataset:
import { readFileSync } from 'node:fs';
import { classifyTicket } from '../src/classifier';
type Case = { input: string; expected: 'billing' | 'bug' | 'account' | 'other' };
const cases: Case[] = JSON.parse(readFileSync('evals/tickets.json', 'utf8'));
let correct = 0;
for (const c of cases) {
const result = await classifyTicket(c.input);
if (result.label === c.expected) correct++;
else console.log(`MISS expected=${c.expected} got=${result.label} :: ${c.input}`);
}
const accuracy = correct / cases.length;
console.log(`accuracy ${(accuracy * 100).toFixed(1)}% over ${cases.length} cases`);
if (accuracy < 0.9) process.exit(1); // regression gate
Kinds of checks, from most to least reliable
- Deterministic. Valid JSON, matches a schema, contains a required field, stays under a length limit, picks a label from an allowed set. Cheap and repeatable; use them wherever they fit.
- Reference-based. Compare with a known good answer: exact match for labels, or overlap and similarity scores for free text. Similarity scores are rough and need calibration.
- Model-graded. Another LLM scores the output against a rubric (LLM-as-judge). Scales to open-ended text, but brings its own errors.
- Human review. The most trustworthy for nuanced quality, and the reference you calibrate the automatic checks against.
What is established and what is still moving
Established: evaluating on a versioned dataset, running evals on every prompt or model change, tracking scores over time and including adversarial cases such as prompt injection. Still moving: metric choices for open-ended generation, how far to trust model-graded scores, and tooling, which changes quickly.
Common mistakes
Judging a change from a handful of manual chats; using too few cases to tell a real change from noise; running each case once when outputs vary (run several times and report the spread); and letting the eval set go stale while real user traffic shifts.