12.4 LLM Evaluation and Observability: From Sample Scoring to Release Decisions
In the prophecy hall, both model versions demonstrated smooth performance. Version A scored higher on average but occasionally missed JSON fields; Version B produced shorter responses, and human reviewers trusted it more, yet automated judges consistently favored Version A. The real question the team needs to answer isn’t “which model is smarter?”; it’s “under the target traffic and risk constraints, which version can safely be released?”
LLM evaluation is a decision protocol: it defines the task distribution, acceptable behaviors, scoring methods, statistical units, and release thresholds. Any change to the model, prompt, retriever, index, or tool can render prior conclusions obsolete.
Learning Objectives
- Build a layered evaluation framework progressing from deterministic checks to online experiments;
- Design gold standards, rubrics, and pairwise comparisons for open-ended responses;
- Identify the role, length, and self-preference patterns of LLM-as-judge;
- Evaluate RAG evidence chains and agent execution trajectories;
- Establish reproducible, privacy-controlled production observations and regression datasets.
1. Reverse-Engineering Evaluation from Release Concerns
Start by drafting a one-page evaluation contract that includes:
- Target users, tasks, and traffic distribution;
- Definitions of success, acceptable failure, and unacceptable failure;
- Primary metrics, guardrails, and slicing logic;
- Comparison baselines and the minimum meaningful difference;
- Sampling units, aggregation methods, and confidence intervals;
- Who can modify the rubric and who approves a release;
- Model, prompt, tool, index versions, and decoding configuration.
A statement like "accuracy reaches 90%" is meaningless without clear task distribution, scoring rules, and a defined denominator, making it impossible to support a release decision.
2. Establishing a Layered Evaluation Stack
Layer 0: Deterministic Validation
Use code-based checks instead of models whenever possible: JSON Schema validation, regular expressions, SQL query results, compiler or test output, mathematical provers, citation IDs, forbidden tool detection, latency and cost budgeting.
These checks are inexpensive, stable, and traceable. They don’t assess whether text is "helpful," but they effectively block a large number of structural and execution errors.
Layer 1: Component Evaluation
- retriever: Recall@K, MRR/nDCG, permission filtering;
- reranker/context packer: Evidence coverage and truncation;
- tool routing: Accuracy of tool selection and parameter passing;
- classifier/guard: Precision and recall across risk slices;
- structured generator: Semantic correctness of fields and verifier pass rate.
Component-level passing does not guarantee system success, but it enables rapid identification of regression sources.
Layer 2: Behavioral and End-to-End Evaluation
Evaluate task completion, factual support, formatting, safety, recovery behavior, and user utility across full conversations or workflows. Preserve complete inputs, retrieved evidence, tool invocation traces, and final outputs, rather than a single overall score alone.
Layer 3: Online Evaluation
Use shadow systems, canary deployments, or A/B testing to observe real-world performance: task success rates, user complaints, manual interventions, latency, cost, and safety guardrails. User thumbs-up/down signals are influenced by interface design and user choice and cannot be directly equated to unbiased quality labels.
3. Gold and Rubric Must Be Reviewable
Closed tasks can provide standard answers and verifiers; open tasks require a clearly defined rubric. For example, a customer service response can be broken down into:
- Whether the system correctly identifies the user's query;
- Whether it only uses the current policy;
- Whether it provides actionable next steps;
- Whether it makes unsupported promises;
- Whether the tone and length fall within acceptable bounds.
For each criterion, define positive and negative anchors along with edge cases, specifying weights and hard-fail conditions. Have two reviewers independently annotate a small batch of samples, discuss discrepancies, refine the rubric, and then expand the dataset. If experts consistently fail to agree over time, the issue likely lies in the definition, not in the judge’s ability to produce false precision.
4. The Trade-off Between Pointwise and Pairwise Rating
Pointwise ratings are suitable for assessing absolute thresholds, but they suffer from inconsistent interpretations of the 1–5 scale across different reviewers. Pairwise comparison, on the other hand, more naturally answers the question "Is A better than B?" and is better suited for regression analysis. It still requires labels for ties, "not acceptable," and justification.
When conducting comparisons:
- For the same prompt, use paired analysis;
- Randomly swap the A/B positions;
- Hide model identity and version information;
- Control or stratify response length;
- Report tie and invalid rates;
- When clustering by user, session, or source, compute uncertainty using the correct statistical units.
Do not treat multiple nearly identical questions generated from the same document as independent samples, as this would lead to unrealistically narrow confidence intervals.
5. LLM-as-Judge Is a Biased Measurement Tool
LLM judges can reduce the cost of open-ended evaluation, but they also exhibit several biases:
- Position bias: favoring answers that appear earlier or later in the sequence;
- Verbosity bias: treating longer, more report-like responses as superior;
- Self-enhancement bias: preferring outputs that align with its own style or the style of similar models;
- Rubric drift: omitting constraints or introducing new evaluation criteria without justification;
- Knowledge error: failing to reliably verify factual accuracy in domain-specific content;
- Prompt injection: being manipulated by the content being evaluated.
Before deployment, judges must be calibrated on a manually curated gold standard dataset. The evaluation rubric should be separated from the response text, and the order of presentation should be randomized. The output must include structured reason codes. For samples with uncertain or high-risk judgments, manual review is required. Multiple judge votes can mitigate some random noise, but models from the same source may share systemic biases and lack true independence.
High judge agreement does not guarantee correct conclusions; it only indicates that the measurement tool is stable on the given sample.
6. Break Down "Hallucination Rate" into Detectable Errors
"Hallucination" tends to blur distinct failure modes into a single, vague category. A more actionable classification is:
- unsupported claim: the claim lacks supporting evidence;
- contradicted claim: the claim directly conflicts with the evidence;
- citation mismatch: a citation exists but does not support the assertion;
- fabricated entity/source: an entity or source is invented;
- stale claim: the claim references a version of the data that is no longer valid;
- omission: a limiting condition that would change the conclusion is missing;
- overclaim: a possibility, correlation, or partial fact is presented as certain, causal, or universally true.
In RAG systems, atomic claims are tagged with support status, and individual metrics such as citation precision/completeness, groundedness, and answer correctness are reported separately. The correct answer may originate from model memory and thus not be supported by current evidence. Conversely, a claim supported by evidence might reference outdated sources.
7. Evaluating RAG and Agent Trajectories
A RAG trace must include at least the following components: query rewrite, candidate retrieval, filtering, reranking, packed context, citations, and index version. An Agent trace must include at least: model version at each step, proposed tool calls, validation or authorization decisions, tool results, approvals, retries, state transitions, and side effects.
With this breakdown, we can pinpoint the root cause of errors:
Final answer is incorrect
├─ Evidence not retrieved: retrieval failure
├─ Evidence truncated: context failure
├─ Evidence present but misinterpreted: generation/grounding failure
├─ Wrong tool selected: routing failure
├─ Incorrect parameters provided: argument failure
└─ Tool executed successfully but redundantly: orchestration failureOnly the final-answer score aggregates all these distinct failure paths into a single numerical value.
8. Statistical Conclusions Must Align with Sampling Design
Prioritize paired comparisons; for non-normal or complex metrics, use paired bootstrap with appropriate units. If samples are clustered by user, document, or session, resampling must respect those clusters, never resample at the individual message level.
Additionally, verify the following:
- Overall results versus key slices;
- Effect size and confidence intervals;
- Multiple testing risks across multiple metrics and slices;
- Sample selection bias and benchmark contamination;
- Whether the evaluation set has been exposed to training, prompt tuning, or manual debugging.
Repeatedly optimizing against a public benchmark risks turning that benchmark into a training signal. Maintain a private or blind evaluation set, and derive unseen regression cases from real production incidents.
9. Production Observability Must Enable Reproducibility of a Single Response
Each run must be associated with:
- model/checkpoint/API version;
- system/developer prompt hash and template version;
- sampling parameters;
- retriever/embedding/reranker/index versions;
- tool schemas, tool versions, and policy version;
- token usage, latency, cost, retries, and errors;
- citations, tool traces, and final status;
- user feedback, human intervention, and subsequent corrections.
Logs are not better with more volume. Data classification, redaction, retention, access control, and deletion should be applied to prompts, documents, tool outputs, and memory. Sensitive payloads may be stored only as hashes or controlled references, along with essential structured metrics.
The dashboard should present quality, risk, cost, and performance together. For example, reducing latency while increasing empty retrieval rates, or improving accuracy at the cost of more human intervention, may still fail to meet release criteria.
10. Flowing from Incident to Regression Set
After fixing a production error, retain a minimal, de-identified reproduction sample and document:
- failure taxonomy and root cause;
- which layer should capture the failure;
- the version that includes the fix;
- expected behavior and deterministic checks;
- applicable slices;
- whether to include it in a release-blocking suite.
The regression set must be regularly deduplicated, re-labeled, and updated with authoritative answers. Outdated data can force the model back into outdated policies.
Common Misconceptions
- A single benchmark score represents production quality: Real-world tasks, risks, and data distributions can differ significantly.
- LLM judges are equivalent to cheap human evaluation: They are biased measurement tools that require calibration and ongoing monitoring.
- Running the same test multiple times and taking the average makes it reliable: System-level biases are not averaged out.
- If the final answer is correct, the agent has succeeded: Overreaching attempts and repeated side effects are still failures.
- The more logs you collect, the more observable your system becomes: Logs without version context, privacy boundaries, or a defined failure taxonomy are difficult to diagnose and retrospectively analyze.
Exercise
- Write an evaluation contract for the JSON Q&A task in the Model Workshop.
- Break down "hallucination rate" into at least four distinct, labelable categories.
- Design a random position swapping experiment to measure a judge's position bias.
- Build a three-layer diagnostic table for RAG errors, covering retrieval, context, and generation.
- Specify a release threshold for an Agent, including guardrails for quality, permissions, repeated side effects, and cost.
Summary
The output of LLM evaluation is not a leaderboard, but verifiable release evidence. Deterministic checks enforce hard constraints, component-level evaluations identify issues, and human or calibrated judges assess open-ended behaviors. Online experiments validate real-world traffic impact, while versioned tracing enables full traceability for every regression.
The Developer Workshop already includes post-training, external knowledge, tool calling, and evaluation pipelines. The next chapter will address more complex boundaries: bias, privacy, misuse, supply chain integrity, and governance responsibilities.