Introduction
Large language models have moved from experimental chat interfaces into production systems that power customer support, code generation, document analysis, and autonomous agents. But unlike traditional software, where correctness is binary and measurable, LLM outputs are stochastic, open-ended, and context-dependent. A response that is helpful for one user may be irrelevant, inaccurate, or unsafe for another. This makes evaluation one of the most critical and most underestimated disciplines in production AI.
Evaluation is not a one-time checkpoint before launch. It is a continuous practice that spans model selection, prompt development, retrieval quality, and post-deployment monitoring. This process is closely tied to AI Observability for LLM Applications, which provides the real-time visibility necessary to trigger these evaluations. Teams that skip rigorous evaluation ship applications that degrade silently, hallucinate under load, or fail to meet user expectations without anyone noticing until it is too late.
This guide provides a practical framework for evaluating LLM applications in production. It covers evaluation taxonomy, offline and online methods, LLM-as-a-judge, human evaluation, dataset construction, and how to close the loop between evaluation results and system improvements. Every technique is illustrated with concrete, hypothetical examples so teams can adapt them to their own domains.
Why Evaluation Is Different for LLMs
Traditional software testing relies on deterministic inputs and expected outputs. Given the same input, a well-tested function always produces the same result. LLMs break this assumption. The same prompt can yield different responses across runs, across model versions, and across providers. A response that passes today may fail tomorrow because the underlying model has been updated, the retrieval index has changed, or the user base has shifted.
This non-determinism creates three core challenges:
- No ground truth for open-ended tasks. For summarization, creative writing, or code generation, there is often no single correct answer. Multiple responses can all be valid.
- Subjective quality dimensions. Helpfulness, tone, brevity, and safety are difficult to encode as pass/fail assertions.
- Delayed feedback. Users may not immediately signal that a response was wrong. A confident but incorrect medical or legal answer can cause harm before anyone detects it.
Because of these challenges, LLM evaluation requires a blend of automated metrics, model-based judgments, and human review, all driven by carefully constructed datasets.
Evaluation Taxonomy: Offline vs. Online
Production evaluation splits into two complementary modes: offline evaluation before deployment and online evaluation after deployment.
Offline Evaluation
Offline evaluation happens in a controlled environment, typically during development or before a release. You run a fixed set of inputs through your application and compare the outputs against reference answers or quality criteria.
Use cases:
- Comparing candidate models or prompt versions
- Validating a new retrieval pipeline
- Regression testing after a prompt change
- Pre-release quality gates
Limitations: Offline evaluation cannot capture real-world user behavior, edge cases that only appear in production, or long-term quality drift.
Online Evaluation
Online evaluation runs continuously in production, sampling live traffic and collecting signals from actual user interactions.
Use cases:
- Detecting regressions after model updates
- Measuring user satisfaction with generated responses
- Identifying failure modes that never appeared in offline tests
- Tracking quality over time across user segments
Limitations: Online signals are often noisy, delayed, or indirect. A user may not rate a response even when it is wrong, and positive engagement does not always mean the answer was accurate.
A mature evaluation practice uses both. Offline evaluation guards against known failure modes before they reach users; online evaluation catches the unknowns.
Core Evaluation Metrics
No single metric captures LLM quality. Teams should track a combination of automated metrics, model-based scores, and human judgments.
Exact Match and F1
For tasks with deterministic answers—such as entity extraction, classification, or structured data generation—exact match and token-level F1 score are straightforward and interpretable. Exact match measures whether the output equals the reference. F1 balances precision and recall over token overlap.
These metrics work well for short, factual answers but fail for open-ended generation where many valid responses exist.
Semantic Similarity
Semantic similarity uses embeddings to measure how close a generated response is to a reference in meaning rather than in word choice. Cosine similarity between sentence embeddings is a common approach. This is more forgiving than exact match for paraphrased answers.
Limitation: Semantic similarity can reward fluent but incorrect responses. A response that sounds right but states a false fact may still score highly if it uses similar vocabulary to the reference.
ROUGE and BLEU
ROUGE (Recall-Oriented Understudy for Gisting Evaluation) and BLEU (Bilingual Evaluation Understudy) originated in summarization and machine translation. They measure n-gram overlap between generated and reference text.
These metrics are inexpensive to compute and correlate reasonably with human judgment for summarization. However, they penalize valid rephrasings and do not capture factual correctness.
LLM-as-a-Judge
LLM-as-a-judge uses a capable model to score responses against a rubric. Instead of rigid string matching, the judge model evaluates dimensions such as correctness, helpfulness, tone, safety, and instruction following.
Example rubric:
- Correctness: Does the response answer the user's question factually?
- Helpfulness: Is the response actionable and clear?
- Conciseness: Does it avoid unnecessary verbosity?
- Safety: Does it avoid harmful, biased, or policy-violating content?
The judge can output a numerical score (1–5), a categorical label (pass/fail), or structured reasoning. This method is flexible and aligns well with human judgment, but it introduces its own biases and costs. Teams should calibrate the judge model against human ratings regularly.
Human Evaluation
Human evaluation remains the gold standard for subjective dimensions. Reviewers read responses and rate them on criteria defined by the product team.
Human evaluation is expensive and slow, so it is best used for:
- Calibrating automated judges
- Auditing high-stakes domains (medical, legal, financial)
- Validating new features before rollout
- Periodic quality spot-checks
Building Evaluation Datasets
Evaluation is only as good as the data it runs against. A strong evaluation dataset has three properties: coverage, balance, and currency.
Coverage
The dataset should represent the full range of user queries the application encounters. This includes common queries, edge cases, adversarial inputs, and domain-specific terminology. For a customer support bot, coverage means including billing questions, technical troubleshooting, account access issues, and escalation requests.
Balance
Balance means the dataset is not dominated by easy examples. A dataset of 90% simple FAQ questions will not reveal whether the system handles complex multi-step reasoning. Include hard cases, ambiguous queries, and out-of-scope requests.
Currency
Evaluation datasets decay over time. Product changes, policy updates, and new product features make old references obsolete. Teams should refresh datasets quarterly or whenever the application behavior changes significantly.
Hypothetical example: A coding assistant evaluation dataset includes 200 prompts across Python, JavaScript, and SQL. Each prompt has a reference solution, expected complexity level, and a list of security constraints. The dataset is refreshed every six weeks to include new library versions and security patterns.
The Evaluation Loop
Evaluation should drive improvement, not just measurement. The loop works as follows:
- Define quality criteria. Decide what good looks like for your application. Write rubrics for correctness, tone, safety, and format.
- Build a dataset. Curate inputs and references that cover real usage patterns.
- Run evaluation. Execute the application against the dataset using automated metrics, LLM-as-judge, and human review.
- Analyze failures. Group errors by type: retrieval failures, hallucination, format violations, safety issues, or tone mismatches.
- Intervene. Adjust prompts, update retrieval, fine-tune models, or add guardrails based on failure patterns.
- Re-evaluate. Confirm the intervention improved quality without regressing other dimensions.
This loop should run continuously, with automated evaluation triggering alerts on regression.
Worked Example: Evaluating a Customer Support Bot
Consider a hypothetical e-commerce support bot that answers questions about orders, returns, and product details. The team wants to evaluate a new retrieval-augmented generation pipeline.
Step 1: Define criteria. The team rates responses on accuracy (does it reflect the actual order policy?), helpfulness (does it resolve the user's issue?), and safety (does it avoid promising refunds outside policy?).
Step 2: Build the dataset. They create 150 queries drawn from real support tickets, each with a reference answer and a policy document reference.
Step 3: Run offline evaluation. They run the pipeline against the dataset and use an LLM judge to score each response. Results show 82% accuracy but only 61% helpfulness, with failures concentrated in return-policy queries.
Step 4: Analyze failures. Investigation reveals the retrieval system is returning outdated return policy documents. The re-ranking step is not prioritizing the most recent policy version.
Step 5: Intervene. The team updates the retrieval index, adds a date filter to prioritize current policies, and adjusts the prompt to instruct the model to cite policy version dates.
Step 6: Re-evaluate. After the change, accuracy rises to 94% and helpfulness to 88%, with no regression in safety scores.
Online Evaluation in Production
Once deployed, online evaluation monitors live traffic. Common approaches include:
- Implicit feedback: User actions such as copying a response, asking a follow-up, or escalating to a human agent.
- Explicit feedback: Thumbs up/down ratings or optional comment fields.
- Sampling for review: A random sample of responses is sent to human reviewers weekly.
- Production guardrails: Automated classifiers flag potentially harmful or low-confidence responses for review.
Online evaluation should feed back into the offline dataset. When a production failure is identified, the query and expected correction are added to the evaluation suite to prevent recurrence.
Limitations and Pitfalls
Evaluation has real limitations that teams must acknowledge:
- Metric gaming: Optimizing for one metric (such as semantic similarity) can degrade other qualities (such as factual accuracy).
- Judge bias: LLM-as-a-judge can prefer longer responses, certain writing styles, or responses that agree with the judge's priors.
- Dataset staleness: An evaluation dataset that does not evolve gives false confidence.
- Cost: Human evaluation and judge model calls add expense, especially at scale.
Teams should treat evaluation as a directional signal, not an absolute score, and combine multiple methods to triangulate quality.
Conclusion
LLM evaluation is not optional for production systems. It is the mechanism by which teams know whether their application actually works, where it fails, and how to improve it. By combining offline and online evaluation, automated metrics and human judgment, and a disciplined improvement loop, teams can ship LLM applications with confidence and maintain quality as models and user needs evolve.
The most important principle is to start small and iterate. A simple dataset of 50 queries with human ratings is more valuable than no evaluation at all. From there, expand coverage, add automated judges, and integrate evaluation into every release cycle.