Evaluation-Driven Development (EDD) for Enterprise LLM Systems
Evaluation-driven development for enterprise LLM systems replaces subjective prompt tweaking with automated eval suites that run in CI, score outputs with LLM-as-a-judge, and block merges when faithfulness or hallucination bounds regress. This guide covers eval dataset design, golden versus synthetic cases, metric rubrics with numeric thresholds, a GitHub Actions YAML gate, and a prompt-version promotion workflow.
Evaluation-Driven Development for LLM Systems: From Prompt Tweaks to Eval Gates
Evaluation-driven development (EDD) treats an eval dataset like a test suite: every prompt, retriever, or model change must pass metric thresholds before production. LLMOps evaluation pipelines differ from unit tests because the oracle is probabilistic â you measure distribution quality, not boolean correctness.
What changes when you adopt EDD
- Prompts become versioned artifacts with a diff and a reviewer, not chat-window edits.
- Every pull request touching a prompt, chunking rule, or model id runs a fixed case suite.
- Faithfulness, answer relevance, context precision, and context recall become merge gates with numeric floors, not dashboard decorations.
- Regressions fail the build like broken unit tests, with a case-level diff showing which inputs got worse.
The shift is cultural: teams argue about thresholds and case design instead of which response "feels better".
| Old workflow | Evaluation-driven workflow |
|---|---|
| Engineer edits prompt, eyeballs 5 examples | Engineer edits prompt, CI runs 500 cases |
| Quality debate in Slack threads | Quality debate on metric deltas in the PR |
| Regression discovered by a customer | Regression blocked at merge by an eval gate |
| Model upgrade is a leap of faith | Model upgrade scored against the same golden set |
Key Takeaways
đĄ
- Evaluation-driven development treats the eval set like a test suite: no prompt, model, or retriever change merges without passing metric floors.
- Golden sets catch known regressions; synthetic edge cases catch the long tail â pair 200 to 500 hand-checked goldens with 1,000 plus generated cases.
- LLM-as-a-judge scoring works when calibrated: spot-check 10 percent of judgments against human labels and require at least 0.85 agreement before trusting it in CI.
- Standard merge gates: faithfulness at or above 0.92, answer relevance at or above 0.88, context precision at or above 0.85, p95 latency under 2.5 seconds.
- Eval runs belong in pull-request CI, not a nightly notebook â a prompt change should produce a scorecard before review, not after deploy.
- Promote prompts through explicit stages (draft, shadow, canary, prod) with the previous version one rollback away.
Designing the Eval Dataset: Golden Sets vs Synthetic Cases
The eval dataset is the product. Two layers give precision on known risks plus coverage of rare failures.
Golden set â hand-verified inputs, expected traits, and reference answers drawn from redacted traffic, support tickets, and past incidents, each carrying a trusted human label.
Synthetic cases â generated variants of goldens: adversarial phrasing, multi-hop splits, empty context, contradictory documents, wrong-language queries, injection payloads. Cheap to scale, but each batch needs a sampling audit before earning merge-gate authority.
| Property | Golden set | Synthetic cases |
|---|---|---|
| Source | Real traffic, incidents, expert authoring | Templates plus LLM mutation of goldens |
| Typical size | 200 to 500 cases | 1,000 to 10,000 cases |
| Label trust | High â human verified | Medium â audit 10 percent per batch |
| Best at | Regression detection on known risks | Long-tail and edge-case coverage |
| Refresh cadence | Monthly, plus incident-driven adds | Regenerated each major suite version |
| CI cost | Low (fast, small) | Higher â shard across runners or run nightly |
| Gate authority | Always blocking | Blocking once audited; otherwise advisory |
Dataset design rules
- Freeze a held-out split prompt authors never see, used only for promotion decisions.
- Tag every case with a risk class: faithfulness, refusal, injection, tool use, latency.
- Add one golden case per production incident within 5 business days.
- Balance difficulty: 60 percent routine, 30 percent hard, 10 percent adversarial.
For retrieval-heavy products, seed cases that stress chunking and freshness â the same concern drives streaming RAG pipelines where documents change under the index.
LLM-as-a-Judge Scoring and Metric Rubrics
LLM-as-a-judge means a separate model grades each output against a rubric, returning a score and rationale. It scales where human labeling cannot, but it drifts â calibrate it and keep a human slice in every run.
| Metric | What it measures | Score 1 (fail) | Score 3 (acceptable) | Score 5 (strong) | Merge gate floor |
|---|---|---|---|---|---|
| Faithfulness | Claims supported by retrieved context | Half the claims unsupported | Minor leaps, core claims cited | Every claim traceable to a chunk | 0.92 |
| Answer Relevance | Response addresses the actual query | Off-topic or evasive | On-topic, partially complete | Fully on-topic and complete | 0.88 |
| Context Precision | Retrieved chunks that matter | Noise dominates the window | Useful chunks present with filler | Top chunks all decision-relevant | 0.85 |
| Context Recall | Needed facts actually retrieved | Key facts missing | Most facts present | All needed facts retrieved | 0.80 |
| Instruction Follow | Constraints honored | Critical constraint broken | One minor miss | All constraints met | 0.95 |
Scores normalize to 0 to 1 in CI (raw divided by 5) so gates read as single numbers.
Judge calibration protocol
- Sample 100 recent judgments stratified by metric; have two humans label them with the rubric.
- Require at least 0.85 agreement between judge and human median before the judge may block merges.
- Re-calibrate on any change to judge model, rubric wording, or temperature â rubric edits shift distributions more than teams expect.
- Log every judge rationale; when a gate fires, that rationale is your first debugging artifact.
Regression Thresholds as Merge Gates
A regression threshold converts a score into a decision. Set two numbers per metric: an absolute floor, and a delta guard limiting any drop to 0.02 versus the baseline prompt.
| Gate type | Rule | Typical value | On violation |
|---|---|---|---|
| Absolute floor | Suite mean must clear the floor | Faithfulness 0.92 | Fail CI, block merge |
| Delta guard | Change versus baseline prompt | Drop greater than 0.02 | Fail CI, require explicit override |
| Case-level catastrophic | Any single golden case drops 2 or more points | 1 case | Fail CI with case diff |
| Hallucination bound | Rate of unsupported-claim cases | Under 2 percent | Fail CI, page owning team |
| Latency budget | p95 end-to-end latency | Under 2,500 ms | Fail CI (advisory in dev) |
| Cost budget | Dollars per 1,000 queries | Under 0.40 USD | Fail CI on prod profile |
Overrides should be rare and loud: a gate break needs a named approver and follow-up ticket, or the gate stops meaning anything.
The gate itself is a pure function over the scorecard, which is what makes it testable and reusable across pipelines:
from dataclasses import dataclass
@dataclass(frozen=True)
class MetricGate:
name: str
floor: float
max_drop: float = 0.02
higher_is_better: bool = True
GATES = [
MetricGate("faithfulness", floor=0.92),
MetricGate("answer_relevance", floor=0.88),
MetricGate("context_precision", floor=0.85),
MetricGate("hallucination_rate", floor=0.0, max_drop=0.02, higher_is_better=False),
]
def evaluate_gates(scores: dict, baseline: dict) -> list:
violations = []
for gate in GATES:
current, base = scores.get(gate.name), baseline.get(gate.name)
if current is None:
violations.append(f"{gate.name}: missing from scorecard")
continue
if gate.higher_is_better:
if current < gate.floor:
violations.append(f"{gate.name}: {current:.3f} below floor {gate.floor}")
if current < base - gate.max_drop:
violations.append(f"{gate.name}: dropped {base - current:.3f} vs baseline")
else:
if current > gate.floor:
violations.append(f"{gate.name}: {current:.3f} above ceiling {gate.floor}")
if current > base + gate.max_drop:
violations.append(f"{gate.name}: rose {current - base:.3f} vs baseline")
return violations
In CI, exit non-zero on any violation string and print the list verbatim in the job log â reviewers should see the failing metric, the value, and the threshold without opening an artifact.
CI Pipeline Example: Eval Gates in GitHub Actions
Drop this workflow next to your prompts: it runs the golden suite on every pull request, enforces metric floors, and uploads a scorecard reviewers open from the checks tab.
name: llm-eval-gates
on:
pull_request:
paths:
- "prompts/**"
- "retriever/**"
- "evals/**"
jobs:
eval:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install eval harness
run: pip install eval-harness==0.9.2
- name: Run golden set
run: evalharness run --suite golden --cases 240 --seed 42
- name: Run synthetic edge cases
run: evalharness run --suite synthetic --cases 1200 --shard 1/4
- name: Compare against baseline prompt version
run: evalharness diff --baseline prompts/baseline.json
- name: Enforce regression thresholds
run: |
evalharness gate --metric faithfulness --min 0.92 --max-drop 0.02
evalharness gate --metric answer_relevance --min 0.88 --max-drop 0.02
evalharness gate --metric context_precision --min 0.85 --max-drop 0.02
evalharness gate --metric context_recall --min 0.80 --max-drop 0.03
evalharness gate --hallucination-rate --max 0.02
evalharness gate --p95-latency-ms --max 2500
evalharness gate --cost-usd-per-1k --max 0.40
- name: Upload scorecard
if: always()
uses: actions/upload-artifact@v4
with:
name: eval-scorecard
path: evals/out/scorecard.html
Mirror the same gates nightly on a larger synthetic shard; keep the pull-request job under 30 minutes so engineers never learn to bypass it.
Prompt-Version Promotion Workflow
Promotion is a ladder, not a flip. Each rung adds traffic and evidence:
- Draft â full suite runs locally; failures are free.
- Pull request â CI runs goldens plus a gated synthetic shard; a teammate reviews scorecard metrics, not vibes.
- Shadow â the prompt handles 100 percent of live traffic in parallel; compare shadow versus prod on faithfulness and latency.
- Canary â route 5 percent of traffic for 24 to 48 hours; alert on judge-score drop over 0.03 or p95 latency up over 20 percent.
- Prod â full traffic; previous version kept for rollback for 14 days.
- Retire â archive the old prompt and its scorecards after the rollback window.
| Promotion stage | Evidence required | Rollback trigger |
|---|---|---|
| Draft to PR | Local suite green on goldens | Not applicable |
| PR to Shadow | CI gates green, reviewer approval | Any gate breach on re-run |
| Shadow to Canary | 10k-plus shadow comparisons, no metric drop | Judge score drop over 0.03 |
| Canary to Prod | 24h canary stable, error budget intact | p95 latency up over 20 percent |
The same workflow governs model upgrades: a model id swap is a prompt change with a scorecard, never a Friday config edit.
Latency and Cost Budgets in Every Eval Run
Quality metrics without budgets produce demos that cannot ship. Attach operational dimensions:
- Latency â record p50 and p95 per case class; RAG answers with 8 chunk retrievals should stay under 2.5 seconds p95.
- Cost â dollars per 1,000 queries from token counts and pricing; gate the production profile at a finance-approved number such as 0.40 USD per 1k.
- Tokens per answer â catches bloat when a model doubles verbosity; a 30 percent token increase without a relevance gain fails.
Put all three on the scorecard beside quality metrics so reviewers see the tradeoff in one screen.
Rolling Out EDD Across an Enterprise
Adoption fails when teams try to boil the ocean. Sequence it instead:
- Week 1 â pick one surface, export and hand-label 100 real cases, wire a faithfulness gate into CI.
- Week 2 â add answer relevance and context precision; generate 500 synthetic mutations, audit a 50-case slice.
- Week 3 â introduce LLM-as-a-judge with the calibration protocol; publish the scorecard format to reviewers.
- Week 4 â enable blocking gates on the pilot; require overrides with named approval.
- Quarter close â expand to the next surface, share the golden-set repo, review gates against incident data.
Teams on this cadence typically report fewer sev-2 quality incidents within a quarter: failures that used to reach customers now fail a pull request first. Pair EDD scorecards with data lineage and metadata observability so every promoted prompt version maps to the data and metrics that justified it.
Common Mistakes When Adopting EDD
Common Mistakes
Letting the same team author the prompt, the eval cases, and the threshold that approves both
Fix: Freeze a held-out split nobody editing prompts can see, and set floors from incident data so a rewrite cannot quietly lower its own bar.
Trusting an uncalibrated LLM-as-a-judge because it agrees with you on spot checks
Fix: Label 100 stratified judgments with two humans and require 0.85 agreement before the judge is allowed to block a merge, then re-run the check after any rubric edit.
Running the golden suite nightly instead of on the pull request
Fix: Put the suite in PR CI under 30 minutes with a sharded synthetic shard moved to nightly, so regressions surface before review rather than after deploy.
Frequently Asked Questions
What is evaluation-driven development for LLM systems?
Evaluation-driven development for LLM systems treats eval datasets like automated test suites: every prompt, model, or retriever change must pass numeric metric thresholds in CI before merge or deploy. It replaces subjective prompt tweaking with scored, reproducible regressions.
What is LLM-as-a-judge?
LLM-as-a-judge is a scoring method where a separate language model grades outputs against a written rubric, typically returning a 1 to 5 score plus a rationale. Calibrate it against human labels and require at least 0.85 agreement before it may block merges.
What is the difference between golden sets and synthetic eval cases?
Golden sets are hand-verified real or expert-authored examples with trusted labels; synthetic cases are generated variants covering rare and adversarial scenarios. Use goldens for blocking gates and audited synthetics for long-tail coverage.
Which metrics should block a prompt merge?
At minimum: faithfulness at or above 0.92, answer relevance at or above 0.88, context precision at or above 0.85, a hallucination rate under 2 percent, and a per-metric delta guard of no more than 0.02 drop versus baseline.
How often should LLM eval suites run?
Run the golden suite on every pull request touching prompts, retrievers, or model ids; run larger synthetic shards nightly; re-baseline whenever the model version or corpus changes.
Last updated: September 23, 2026