Building an LLM evaluation framework that works in production
How to catch hallucinations, drift, and quality failures before they reach users
LLM evaluation that runs only against a curated test set before launch will miss many of the failures that appear once a model is live, because real user input is messier than any benchmark can anticipate. A prompt that scores well on an internal quality benchmark can still fabricate a citation, leak part of a system prompt, or answer a different question than the one asked the moment it meets production traffic. Catching hallucinations, drift, and quality failures before they reach users takes an evaluation system that runs from the first prompt draft through every production request.
This gap matters most for enterprise AI teams shipping generative AI applications into regulated or high-stakes workflows, where a hallucinated clinical summary, a wrong risk score, or an ungrounded compliance answer costs real money and real trust. In those settings, an evaluation system that runs continuously catches the failures that static benchmarks do not find.
A continuous evaluation system has a measurement layer and an action layer. The measurement layer combines offline tests, which catch regressions before a change ships, online scoring, which detects degradation after release, and automated judging, which extends both to production volume. The action layer, made up of validation, guardrails, and human review, decides what happens when a measurement fails.

Why LLM evaluations that pass in development fail in production
Development evaluation and production evaluation test different things. Development evaluation checks whether a model completes a task under controlled conditions, meaning a fixed test set, known-good reference answers, and a prompt template that hasn't changed. Production evaluation checks whether it keeps completing that task once real users, real data, and real edge cases show up.
Gap | What the development suite tested | What production adds | What it looks like when it fails |
|---|---|---|---|
Input distribution shift | 200 hand-written test cases covering the scenarios the team thought to write down | Typos, code-switching, adversarial prompt injection, questions nobody anticipated | A model tuned to the narrow test distribution degrades as soon as real users start working with it |
Reference-answer drift | A fixed set of "golden" reference answers | A knowledge base update, a revised policy document, a re-indexed retrieval store | The source of truth moves while the model stays the same, so it drifts out of alignment while still passing its original suite |
Compounding failure in multi-step systems | Each step on its own, or one golden end-to-end path | Small errors in retrieval, tool use, reasoning, and generation that stack up | A marginally relevant retrieved document plus a generation step that doesn't flag low-confidence grounding produces a confident, wrong answer |
Reference-answer drift resembles concept drift in traditional ML, and it often arrives alongside data drift in the documents the system retrieves. Compounding failure is specific to agentic applications, which chain multiple LLM calls including retrieval, tool use, reasoning, and generation, so a single-step evaluation never sees the combined error.
Development evaluation remains necessary, but it is insufficient on its own, because it measures the system the team built under conditions the team chose, while users experience that system under conditions nobody chose.
The core components of an LLM evaluation framework
Evaluation, monitoring, validation, and guardrails get used interchangeably, but they're doing four different jobs.
Term | The job it does | Example |
|---|---|---|
Evaluation | Measures output quality against a standard | A faithfulness score on a response |
Monitoring | Tracks that measurement over time | Faithfulness pass rate by week, with an alert threshold |
Validation | Checks whether an output meets a defined structural or semantic requirement | Does the response parse as the expected JSON schema |
Guardrails | Act on a failure by blocking, routing, or escalating it | Route a low-faithfulness response to a human reviewer |
Offline testing, online scoring, and automated judging each answer a different question about the same system, so each relies on different evaluation metrics. Exact match and rubric scores are typical offline, while faithfulness and groundedness scores are typical online.
Offline evaluation with benchmarks and curated datasets
Offline evaluation runs before deployment, against a fixed dataset with known-correct or human-graded answers, and it is where benchmark performance gets measured. Typical metrics include exact match for short-answer tasks, task-specific accuracy for classification, rubric-based human scores, and overlap metrics such as ROUGE for summarization and BLEU for translation. ROUGE and BLEU score how many words and short phrases a generated output shares with a human-written reference, which makes them inexpensive to run but unable to credit an answer that is correct yet worded differently.
Offline evaluation is the right tool for prompt testing and regression testing. Before merging a prompt change, a new model version, or an updated retrieval configuration, run it against a curated dataset that includes known edge cases, adversarial inputs, and past production failures. If a change regresses performance on cases the model previously handled correctly, offline evaluation catches it before a single user sees it.
The limitation is coverage. Even a well-built curated dataset only represents inputs someone thought to include, and production traffic will always contain inputs that nobody did.
Online evaluation of live production traffic
Online evaluation scores real requests and responses as they happen, using automated metrics, sampled human review, or both. A live query has no pre-written reference answer, so online evaluation relies on reference-free metrics, which judge a response without comparing it against a gold answer. These metrics ask whether the response stays grounded in the retrieved context, follows the required format, avoids restricted content, and matches what the user actually asked.
Consequently, online evaluation is what makes production monitoring possible for generative systems. A model can pass every offline benchmark and still degrade weeks after launch through input shift, reference drift, or compounding error, and without online evaluation that degradation stays invisible until a user complains.
Offline evaluation | Online evaluation | |
|---|---|---|
When it runs | Pre-deployment, pre-merge | Continuously, on live traffic |
Data source | Curated, versioned test sets | Real user requests and responses |
Reference answers | Known, human-graded | Usually none; reference-free scoring |
What it catches | Regressions, prompt and model changes | Drift, edge cases, degradation over time |
Primary use | Regression testing, prompt testing | Production monitoring, alerting |
LLM-as-a-judge for evaluation beyond manual review
LLM-as-a-judge uses a separate model, typically a stronger or differently tuned one, to score a target model's outputs against a defined rubric. It replaces or supplements human review at a scale manual grading can't match. Instead of a human rating 10,000 production responses for helpfulness and correctness, a judge model scores each response against criteria like factual accuracy, relevance, and tone, and flags the ones that need human attention.
The approach, studied systematically in the MT-Bench work by Zheng et al. (2023) and in scoring methods such as G-Eval, works well for criteria that are more about judgment than exact match, including helpfulness, coherence, tone, and instruction-following. It works less well as the sole check for factual correctness in high-stakes domains, because a judge model can share the same blind spots as the model it's grading, and the MT-Bench authors document position, verbosity, and self-enhancement biases that let a confident, well-structured answer score higher than it deserves.
A common pattern uses LLM-as-a-judge to triage volume and routes the outputs it flags as uncertain, borderline, or high-risk to human review. Open-source tools like RAGAS, DeepEval, and TruLens implement judge-based scoring alongside deterministic checks.
LLM hallucination detection at scale
LLM hallucination detection at scale means running automated faithfulness and groundedness checks on every production response, or on a statistically meaningful sample when cost requires it, rather than relying on spot-checks or user reports. Manual review can't keep pace with production volume.
Faithfulness and groundedness metrics
Faithfulness and groundedness both ask whether a response is supported by its source material, such as the retrieved documents in a RAG pipeline or a context window supplied with the prompt. Tools define them slightly differently. RAGAS, for example, computes faithfulness by breaking a response into individual claims and measuring the share that can be inferred from the retrieved context. Groundedness checks in tools such as TruLens score statements against the source in a similar way. The claim-level view matters in practice, because a response can match the general theme of its source and still introduce a specific number, name, or date that the source never stated.
Both metrics require source material to compare against, whether the retrieved context, a knowledge base, or a document the model was given. That's why hallucination detection is tightly coupled to retrieval quality in RAG systems. Teams running retrieval-augmented pipelines need evaluation that spans the whole chain, not just the final generation step, since retrieval quality is often where hallucination starts.
Automated detection approaches that work in production
Automated detection trades coverage against cost and auditability, so a production pipeline usually runs more than one of these checks.
Approach | How it works | Catches | Cost and auditability |
|---|---|---|---|
Natural language inference (NLI) checks | An NLI model scores whether a claim is entailed by, contradicts, or is unrelated to the source context | Direct contradictions | Cheap enough to run on every response; deterministic and easy to audit |
LLM-as-a-judge faithfulness scoring | A judge model is prompted to identify claims not supported by the provided context | Subtler ungrounded claims NLI misses | Costs more per response and needs its own reliability check |
Retrieval-grounded citation checks | For systems that cite sources, an automated check confirms the cited passage contains the claim attributed to it | Misattributed or invented citations | Narrow but high precision; the easiest of the three to audit after the fact |

None of these approaches catches every hallucination. Faithfulness and groundedness scores are proxies for accuracy, so teams in regulated environments should treat an automated flag as a signal that starts a review rather than a verdict.
When to use human review
Human-in-the-loop review pays for itself when the downside of an undetected hallucination is asymmetric, as it is for a clinical decision tool, a financial risk assessment, or a legal summary. Route flagged outputs, plus a random sample of unflagged output to catch false negatives, to a human reviewer before they reach a user or downstream system. Lower-stakes, high-volume use cases can shift to sampling and audit instead, with a periodic, statistically meaningful review to confirm the pipeline itself hasn't drifted.
Output validation patterns for enterprise LLM deployments
Output validation checks whether a response meets defined requirements before it's returned to a user or passed to a downstream system, independent of whether the content is factually correct. A response can be perfectly grounded and still fail validation if it returns malformed JSON, exceeds a length constraint, or omits a required field.
Structural and semantic validation
Structural validation checks format, such as whether the response parses as valid JSON, matches the expected schema, stays within length limits, or includes every required field. These checks are deterministic and inexpensive, so they can run on every response before any semantic check. Semantic validation then checks meaning within that structure, asking whether the response answers the question asked, stays within the model's defined scope, and holds the required tone. It typically combines rule-based keyword checks with model-based classifiers or judge-model scoring for intent and topic adherence.
Building guardrails for high-stakes use cases
Guardrails are the enforcement layer that acts on a validation failure, by blocking a response before it reaches the user, routing it to a fallback response, or escalating it to human review. Effective guardrails operate at every stage of an agent's execution loop, and Domino's defense-in-depth model names five control points:
- Input guardrails screen everything entering the model's context, including prompts, retrieved documents, and prior tool results, for injection attempts, restricted topics, or out-of-scope requests.
- Retrieval guardrails sit on the vector store and search layer, enforcing access permissions, approved sources, and abstention rules.
- Orchestration guardrails cap the loop itself on iterations, tokens, spend, and wall-clock time.
- Output guardrails screen generated responses for policy violations, PII exposure, or format failures before they're returned.
- Action guardrails constrain what an agentic system can do, such as requiring human approval before a tool call that modifies data or spends money.
Regulated teams need guardrails that produce an audit trail recording what was blocked, why, and what happened next. The EU AI Act sets record-keeping and human-oversight obligations for high-risk systems (Articles 12 and 14), and GxP expectations under 21 CFR Part 11 require that systems touching regulated records remain documented and auditable. Domino's field guide to agentic AI guardrails covers how those obligations map onto each control point by industry.
In banking, SR 26-2, the interagency model risk management guidance the Federal Reserve, OCC, and FDIC issued on April 17, 2026, places generative and agentic AI outside its formal scope. It does, however, direct institutions to apply their own risk management and governance practices to those systems, so model risk teams are likely to expect comparable evidence. A guardrail that drops a response without logging the reason leaves a gap that an auditor will find, and that audit trail has to extend into the evaluation layer as well.
Integrating LLM evaluation into your MLOps pipeline
LLM evaluation only prevents production failures if it's wired into the same pipeline that ships model and prompt changes. Evaluation then becomes infrastructure that runs on every change and continuously in production.
Pre-merge evaluation in CI/CD
Every prompt change, retrieval configuration change, or model version upgrade should run against the offline evaluation suite before merge, the same way a code change runs against a unit test suite. A prompt edit that improves one use case but silently breaks another gets caught here, before it reaches production. Teams building this into existing MLOps pipelines typically treat the evaluation dataset as a versioned artifact, growing it every time a new production failure gets logged as a regression case.
Continuous evaluation in production
Online evaluation should run as a standing evaluation pipeline that scores a sample or the full volume of production requests, tracks faithfulness, groundedness, and validation pass rates over time, and alerts when a metric moves outside its expected range. This is the LLM-specific extension of model monitoring, adapted for outputs with no single correct answer to compare against.
Because input shift and reference drift can lower model quality without anyone touching the model, continuous evaluation pays for itself even in weeks when nothing was deliberately changed, and model drift belongs on the LLM risk register as much as on the traditional ML one. LLMOps practices formalize this discipline by running evaluation, monitoring, and governance as one connected system.

Running LLM evaluations reproducibly on Domino
An evaluation result is only useful if it's reproducible. The same prompt, model version, and dataset should produce a traceable, comparable result every time, which requires capturing the evaluation code, dataset version, model version, and environment together in one record.
Domino captures code, data, environment, and compute together for every run, so a pre-merge check and a production scoring job can be compared on equal footing. An auditor can trace exactly which configuration produced a given score. For GenAI systems, Domino's tracing and evaluation capabilities extend that record to every step of the system. A single @add_tracing decorator records each LLM call, tool invocation, and retrieval step as a structured trace, with token usage, latency, and cost attached, and evaluation scores attach directly to those traces.
Teams run an evaluation script as a Domino Job, which logs each configuration as a versioned run in the Experiment Manager for side-by-side comparison, and they schedule evaluation Jobs that score production traces continuously and surface quality drops. Domino does not prescribe an evaluation method, so harnesses built on RAGAS, DeepEval, promptfoo, or a custom LLM-as-a-judge evaluator run in the same governed environments as the rest of the model lifecycle, under the same access controls.
For teams working under GxP, the EU AI Act, or their own model risk policies, evaluation evidence then sits inside the audit trail that Domino maintains from design to runtime, where validators can review it alongside every other lifecycle record.
To see the whole loop end to end, from instrumenting an agent to comparing evaluation runs, watch the demo How to evaluate agentic AI systems with Domino.
Frequently asked questions
What is an LLM evaluation framework?
An LLM evaluation framework is a system for measuring whether a large language model's outputs meet defined quality, safety, and accuracy standards, combining offline testing against curated datasets, online scoring of live production traffic, and automated methods like LLM-as-a-judge to scale beyond manual review. Unlike a single benchmark or test suite, a framework covers the full lifecycle, including pre-deployment regression testing, continuous production monitoring, and a defined process for routing uncertain or high-risk outputs to human reviewers. The goal is to catch two kinds of failure, the ones a static benchmark can anticipate, such as a wrong answer to a known test case, and the ones that appear only in production, such as gradual drift in output quality or a hallucination triggered by an unusual input. A framework is what lets a team keep shipping model and prompt changes without re-litigating quality from scratch every time.
Why do LLM evaluations pass in development but fail in production?
Development evaluation tests a model against a fixed, curated dataset under controlled conditions, while production involves real user inputs, live data sources, and multi-step systems. Most of the difference comes from input distribution shift, where production traffic includes edge cases and adversarial inputs the development set never covered; from reference-answer drift, where the underlying data or source-of-truth documents change after the evaluation dataset was built, so the model drifts out of alignment with current information while still passing its original tests; and from compounding failure in agentic or multi-step systems, where small errors in retrieval or reasoning steps combine into a wrong final answer that no single-step test caught. The fix is running evaluation continuously in production, not only before launch.
What is LLM-as-a-judge and when should you use it?
LLM-as-a-judge uses a separate model to score a target model's outputs against a defined rubric, such as helpfulness, factual accuracy, or instruction-following, at a scale manual human review can't match. It works well for judgment-based criteria like tone, coherence, and relevance, and for triaging high volumes of production output to flag the responses that most need human attention. It's less reliable as the sole check for factual correctness in high-stakes domains, because a judge model can share blind spots with the model it's evaluating and can be swayed by confident, well-structured output. A dependable pattern pairs LLM-as-a-judge for scale with human review of the outputs it flags as uncertain or high-risk, so the judge model's score directs attention and a person makes the final call.
How do you detect hallucinations in LLM outputs at scale?
Hallucination detection at scale runs automated faithfulness and groundedness checks on every production response. Natural language inference (NLI) models catch direct contradictions between a claim and its source context, LLM-as-a-judge scoring catches subtler ungrounded claims, and citation checking confirms that systems which cite sources attributed each claim to a passage that contains it. These methods compare the output against source material, such as retrieved documents or a provided context window, rather than against a gold answer, which is why hallucination detection is closely tied to retrieval quality in RAG systems. None of these approaches is perfect on its own. Faithfulness and groundedness scores are proxies for accuracy, not ground truth, so flagged outputs should route to human review rather than being treated as a final determination, especially in regulated or high-stakes use cases.
What guardrails should enterprise teams implement for high-stakes LLM use cases?
Enterprise teams should implement guardrails at each stage of the system's execution loop. Input guardrails screen prompts and retrieved content for injection attempts or out-of-scope requests before the model processes them, retrieval guardrails enforce which sources the system may draw on, orchestration guardrails cap iterations and spend, output guardrails screen generated responses for policy violations, exposed sensitive data, or format failures before they reach a user, and action guardrails constrain what an agentic system can do, such as requiring human approval before a tool call that modifies data or executes a transaction. For teams working under the EU AI Act, GxP requirements, or internal model risk policies, guardrails need to log what was blocked and why, producing an auditable record of every intervention. In banking, SR 26-2 places generative and agentic AI outside its formal scope but directs institutions to govern those systems under their own risk management practices, so the same logging discipline applies. Guardrails sit on top of evaluation and validation as the enforcement layer, and they depend on faithfulness checks and output validation to know what to block.
