Building an LLM evaluation framework is conceptually similar to how a college professor designs a grading rubric for essay exams. Every student's answer will be different — just like every LLM output is non-deterministic — so the professor needs structured criteria that ensure evaluation stays objective and consistent, and scales beyond one person reviewing every paper. The same principle applies to LLMs: you need a layered evaluation system with clear criteria that can operate continuously without manual intervention for every output.
My evaluation framework operates across three layers. First, unit tests that catch deterministic failures fast and cheap — these are binary pass/fail assertions like "does the response stay within the defined scope?" or "is the output in valid JSON format?" Second, golden dataset evaluation that tests output quality against curated benchmarks with SME-validated expected answers. Third, automated evaluation pipelines that run both of the above continuously on every prompt or model change, catching regressions before they reach users. Together, these three layers form a system where cheap checks run first and expensive evaluations only trigger when the basics pass.
I implement this through a seven-stage process.
1. Defining the Scope and Guardrails
2. Creating the evaluation criteria in alignment with stakeholders
3. Operationalizing that rubric into a Golden dataset
4. Performing Manual Error Analysis and creating categories
5. Mapping each error category to an evaluation method
6. Building automated Evaluation pipelines
7. Deployment monitoring and the feedback loop
The first stage is defining the scope and guardrails of the LLM application. For instance, when I led the development of an AI agent at Arka Energy that automates solar proposal workflows using agentic architecture, the scope included understanding natural language queries, extracting design parameters, and generating proposals across three integrated modules. The guardrails were equally specific: the agent must not fabricate system specifications, must not proceed with design changes without explicit user confirmation, and must gracefully hand off to manual workflows when confidence is low. Clear scope definition prevents the common mistake of trying to evaluate an LLM against expectations it was never designed to meet.
The second stage is aligning with stakeholders on evaluation criteria — the actual rubric. This is a cross-functional alignment exercise involving product, engineering, data science, and customer-facing teams to agree on what "good" looks like. The rubric defines the dimensions being measured (accuracy, relevance, tone, safety, completeness) and the scoring methodology: binary questions for guardrail compliance ("Did the model refuse off-topic queries? Yes/No"), scaled ratings for subjective quality ("Rate the helpfulness of this response 1-5"), and adversarial test cases specifically designed to probe known failure modes ("What happens when the user provides contradictory inputs?").
The third stage is operationalizing that rubric into a golden dataset. This is where the rubric becomes concrete — a curated set of test inputs paired with expected outputs or scoring guidelines, built with domain experts. The golden dataset should cover the full distribution of expected usage: common queries, edge cases, multi-turn conversations, and adversarial inputs. At Arka, this meant building test cases spanning different solar design scenarios — simple residential rooftops, complex commercial installations, and deliberately ambiguous requests — with our engineering and sales teams validating what "correct" responses looked like for each. The dataset must be versioned so that when comparing two model versions, you're testing against the same benchmark.
The fourth stage is manual error analysis — reviewing an initial batch of 30-50 LLM outputs to identify and categorize failure modes before building any automated evaluation. Through this process, errors typically fall into four categories: infrastructure failures where the model doesn't respond at all (crashes, integration issues, load timeouts); latency failures where the model responds but too slowly for the user experience (oversized models, large RAG retrieval sets); relevance failures where the model responds quickly but hallucinates or gives irrelevant answers (training data gaps, poor embeddings, insufficient model capability); and coherence failures where the model handles single-turn queries well but loses conversational thread across multi-turn interactions (poor state management, context window limitations). Categorization matters because each error type demands a fundamentally different evaluation strategy.
The fifth stage is mapping each error category to the appropriate evaluation method. Infrastructure and latency failures are best caught by code-based unit tests — uptime monitors, p95/p99 latency alerts, response schema validation. These are deterministic, cheap to run, and should execute on every deployment. Hallucination and relevance failures require LLM-as-Judge evaluation, where a stronger model (such as GPT-4o or Claude) scores outputs against the golden dataset using the rubric defined in stage two. The key metric here is faithfulness — whether the response stays grounded in the source material rather than fabricating information. For RAG-based applications, the RAGAs framework provides more granular metrics: context precision (did retrieval find the right documents?), context recall (did it find all relevant documents?), and answer relevancy (does the final answer actually address the query?). For summarization tasks, ROUGE and BLEU scores measure overlap with reference outputs. Coherence failures require multi-turn test cases in the golden dataset where the evaluator scores across an entire conversation, not just individual responses. The critical step here is calibrating the LLM-as-Judge against human reviewers: you have SMEs independently score the same set of outputs, compare their ratings to the judge's ratings, and then iteratively refine the judge's system prompt and rubric until the two converge. Without this calibration step, you're trusting an automated system that may have systematic blind spots.
The sixth stage is building the automated evaluation pipeline that ties everything together. This pipeline runs the full test suite — unit tests first, then golden dataset evaluations — automatically whenever a prompt is updated, a model version changes, or on a scheduled cadence. The core components are: versioned golden datasets (so comparisons across model versions are fair), a batch inference service that can run hundreds of test cases in parallel, the evaluator suite (code-based checks, LLM-as-Judge, semantic similarity scoring), and a results dashboard that visualizes performance trends over time. At Arka, where the AI agent integrates with three product modules via APIs, the pipeline also included integration-level tests ensuring the agent's outputs were valid inputs for downstream systems — for example, verifying that extracted roof dimensions matched the schema expected by the design engine.
The seventh and final stage is deployment monitoring and the feedback loop. Offline evaluation — no matter how thorough — only predicts real-world performance. Once deployed, the system needs operational monitoring to detect model drift, where performance degrades as real-world data patterns diverge from the golden dataset. This includes tracking live metrics like task completion rates, user satisfaction signals (explicit feedback like thumbs up/down, implicit signals like session abandonment or manual override frequency), and flagging outputs where the model's confidence falls below a threshold for human review. At Arka, we tracked beta user task completion (target: reducing proposal time from 45+ minutes to under 10 minutes) and monitored how frequently users abandoned the AI workflow for manual processes — a strong proxy for output quality. These live signals feed back into the evaluation framework: newly discovered failure modes become new test cases in the golden dataset, the rubric gets refined based on real usage patterns, and the cycle continues. The evaluation framework is never "done" — it evolves with the product.

