English
LLM Evaluation as a Release Gate: From Good Demos to Regression Tests
Build an evaluation process that catches AI regressions before release: representative datasets, deterministic checks, calibrated reviewers, and explicit quality budgets.

Tran Kim Dat
Software Engineer

A prompt change can improve the example on your screen and quietly damage ten other tasks. A different model may sound more polished while returning the wrong category, overlooking a permission rule, or calling a tool unnecessarily. The release question is therefore concrete: which behaviors improved, which regressed, and what evidence justifies shipping?
Evaluation works best when it becomes an ordinary engineering artifact. Inputs, expected behavior, configuration, and results should be reviewable alongside a change. The examples here describe a proposed workflow for a support assistant; their thresholds and test cases are illustrative, not measured results from this portfolio.
Start with the product contract
Write down what a successful task means before choosing a scoring library. For a support assistant, that may include finding the relevant policy, answering only from accessible material, citing the right revision, and requesting clarification when the account or product is ambiguous. A single rating for helpfulness hides too many different failure modes.
Separate release-blocking constraints from preferences. Returning another tenant's document should fail the case even if the prose is excellent. A slightly awkward sentence might be acceptable. This distinction keeps an average score from compensating for a boundary violation.
Hard checks: valid structure, authorized identifiers, allowed tools, and no unintended writes.
Task checks: correct resolution, necessary evidence, and correct handling of missing information.
Experience checks: readable explanation, useful next step, and a reasonable response budget.
Build a dataset that can disagree with the demo
Collect representative requests and known failures, with sensitive fields removed or replaced. Preserve the shape of difficult cases: contradictory documents, empty retrieval results, unusual identifiers, multilingual input, and long conversations. Synthetic cases help test boundaries, but a dataset consisting only of tidy synthetic prompts can overstate readiness.
Each case needs an identifier, input, access context, expected constraints, and a short explanation of why it exists. Some tasks have one correct label; others have several acceptable answers. For open-ended work, specify required facts and prohibited behavior instead of matching an entire paragraph word for word.
Version the dataset and reserve a held-out portion. Repeatedly rewriting a prompt against the same visible cases can turn evaluation into another form of overfitting. Keep a history of why cases were added, and distinguish a product requirement change from a model regression.
Use deterministic checks wherever possible
Do not spend a model call deciding whether JSON parses or a citation identifier exists. Validate those properties in code. A model-based reviewer is more useful for questions such as whether an explanation is supported by a passage, where exact string matching is too brittle.
The following TypeScript example is intentionally a small application-owned contract. It does not call an evaluation provider. It checks that a proposed answer references only evidence the server actually supplied and that an insufficient-evidence outcome contains no citations. A real system still needs a separate factual-support check.
type Answer = {
status: "answered" | "insufficient_evidence";
citations: string[];
};
export function checkEvidence(answer: Answer, allowed: Set<string>) {
const citationsAllowed = answer.citations.every(id => allowed.has(id));
const outcomeConsistent = answer.status === "answered"
? answer.citations.length > 0
: answer.citations.length === 0;
return { citationsAllowed, outcomeConsistent };
}Calibrate model-based reviewers
Give reviewers a narrow rubric with examples of success and failure. If the criterion is factual support, supply the evidence and ask for a judgment about support, not writing style. A reviewer that never sees the source cannot reliably distinguish a correct answer from a plausible one.
Have a person label a sample and inspect disagreements. Pin the reviewer configuration and record its version. Treat its score as a measurement with uncertainty, particularly when the candidate and reviewer share similar biases. Run occasional blind comparisons with answer order swapped to look for position effects.
Compare the same cases under controlled conditions
Run the baseline and candidate against the same dataset revision, evidence snapshot, and tool fixtures. Keep unrelated settings fixed. When a case changes, inspect its trace before deciding whether the prompt, retrieval, tool response, or reviewer caused the difference. Repeating important cases helps reveal unstable behavior that one pass would miss.
Langfuse provides datasets and experiment runs that can organize this comparison. The release policy remains the team's responsibility: a tool can record scores, but it cannot decide which product mistakes are acceptable. Persist the candidate configuration and the baseline reference with the result so someone else can reproduce the decision.
Turn results into a practical CI policy
Keep the pull-request suite small enough to run routinely. Execute the full evaluation before a significant model, prompt, retrieval, or tool change. Use test doubles for writes and unstable external services; an evaluation must not send real customer emails or create real purchases.
Block on hard-check failures such as unauthorized evidence or forbidden tool calls.
Review task-quality regressions per category rather than relying only on the overall mean.
Track latency, token usage, and reviewer cost alongside quality.
Require a written exception when a release intentionally changes the product contract.
Offline evaluation should continue into production monitoring. Sample failures, review uncertain cases, and add confirmed issues to the dataset without leaking personal data. The most useful suite grows from real mistakes while retaining enough held-out cases to challenge the next candidate.
The goal is a release decision someone can defend: this change was tested against these cases, preserved these boundaries, improved these tasks, and accepted these known limitations. That is a stronger foundation than a screenshot of one convincing answer.
Continue reading
Trace the failures behind your evaluation scores


