Verified against RAGAS · 2026-07-29
Build an automated eval harness for your RAG pipeline instead of eyeballing answers
A prompt for designing a repeatable retrieval and generation evaluation suite — precision/recall@k, faithfulness, answer relevance, latency — with numeric regression thresholds, so a chunking or prompt change gets blocked automatically instead of shipping on a good-looking spot check.
The prompt
Ready to copy — highlighted parts are example details you can swap.
You are designing an automated evaluation harness for a RAG pipeline, meant to run on every meaningful change to chunking, retrieval, or the prompt template — not a one-time manual review of a handful of answers that looked fine and then got shipped. PIPELINE UNDER TEST Internal support RAG bot: Qdrant dense retrieval top-8, no reranker, GPT-5.1 generation with a grounded-answer system prompt GOLDEN SET 40 hand-written questions from real support tickets, each labeled with the 1-3 chunk IDs that should be retrieved and a reference answer written by a subject-matter expert METRICS TO IMPLEMENT Implement all of these, don't substitute a single overall "looks good" score: - Retrieval precision@k and recall@k against the golden set's labeled relevant chunks — did the right source actually make it into the top-k candidates, separate from whether the final answer was good. - Faithfulness/groundedness — for each generated answer, can every claim be traced to something actually present in the retrieved context, or did the model add something not supported by the sources it was given. - Answer relevance — does the answer actually address the question asked, independent of faithfulness, since a perfectly grounded answer to the wrong question still fails the user. - Latency, measured separately for retrieval and generation, at p50 and p95, not just an average that hides tail latency. REGRESSION RULES - Define a numeric threshold for each metric below which a pipeline change is blocked, e.g. "recall@5 must not drop more than 5 percentage points versus the last approved baseline." A metric with no threshold is a chart nobody acts on, not a gate. - Run the full golden set on every candidate change, not a sample — a chunking change that regresses a handful of golden questions out of forty is real signal a five-question spot check would miss entirely. - When faithfulness drops, require the harness to surface the specific unsupported claim and the retrieved context it should have been grounded in, not just a pass/fail score — a raw score change with no example is not actionable. JUDGE MODEL DISCIPLINE Claude Sonnet 4.6 as the faithfulness/relevance judge, calibrated against 15 questions double-scored by a human reviewer before trusting it on the remaining 25 State explicitly how the LLM-judge's own accuracy was checked against a human-labeled subset before trusting its faithfulness and relevance scores at scale — an unvalidated judge model can systematically miss the same failure category the pipeline itself is prone to, silently agreeing with wrong answers it should be catching. OUTPUT FORMAT 1. The full metric list with formulas/definitions as they'll actually be computed, not just names. 2. The regression thresholds per metric, with a one-line justification for each number. 3. A worked example: one golden-set question scored end to end (retrieval hit/miss, faithfulness verdict with the specific claim checked, relevance verdict, latency). 4. How often this harness should run — on every PR, nightly, or only before a release — and why, tied to how expensive a full run is.
Customize
Optional — swap in your own details for the highlighted parts above.
Why this works
The reason to keep retrieval metrics separate from end-to-end answer quality is that a generation model with strong parametric knowledge can produce a correct-looking answer even when retrieval completely missed the right chunk — it's already answering from what it learned in training, not from what was actually retrieved. That looks like a pass in a manual spot check and is actually a silent retrieval failure waiting to surface the moment a question touches something genuinely internal and non-public that the model has no other way to know. Scoring retrieval and generation as two separate numbers is what catches that gap instead of averaging it away. Running the full golden set on every candidate change instead of sampling matters because chunking and retrieval changes tend to produce narrow, structural regressions — a new chunk-size setting that happens to split exactly the three golden questions whose answer sits near a table boundary — and a five-question spot check has a real chance of missing every one of those three while still 'looking fine.' A forty-question golden set that costs a few dollars and a couple of minutes to run in full removes the sampling risk entirely, for a cost that's negligible next to shipping a retrieval regression to production. The judge-calibration requirement addresses a specific and under-discussed risk: an LLM used as a faithfulness judge can share the exact same blind spot as the pipeline it's grading, especially when judge and generator are similar models — both might agree that a subtly unsupported inference is 'basically' grounded, because both models make the same kind of confident leap from adjacent-but-not-identical context. Checking the judge against a human-labeled subset before trusting it at scale is the only way to catch that correlated blind spot; without it, a faithfulness score of 96% might mean the pipeline is genuinely faithful, or it might mean the judge has the same weakness the generator does and is grading its own homework.
What you get back
Question: 'what's our conference travel approval threshold' — retrieval: hit (correct chunk ranked #1, recall@5 satisfied). Faithfulness: pass — the answer's '$500 pre-approval threshold' claim matches the retrieved Travel & Expense Policy chunk verbatim. Relevance: pass. Latency: retrieval 92ms, generation 1.4s (p50). Aggregate run: recall@5 91% (baseline 93%, within the 5-point tolerance, not blocked); faithfulness 97%.
Verified against
RAGAS 0.3 · 2026-07-29
Langfuse 3.2 · 2026-07-29
Changelog
- 2026-07-29 — Initial publish, verified against RAGAS 0.3 metric definitions and Langfuse 3.2 eval-dataset tooling.
Building this for real?
This is a free starting point. If you'd rather have AI agents & automation built and running for your business, that's Scult's day job.
EXPLORE AI AGENTS & AUTOMATION
