Design a golden eval set for a production RAG system serving a legal research product. Explain how you build it, how big it should be, what each example contains, and what you measure with it.
You are responsible for the eval harness of a RAG product used by legal researchers. There is no existing golden set. Design it from scratch: how you source examples, how big to make it, what fields each example carries, what metrics you compute against it, and how you use it to gate releases. Be concrete about why each choice is what it is for a legal domain.
Source from three streams (real, SME-written, adversarial). Start at 200-500 well labeled examples. Score four axes: retrieval recall, faithfulness, answer correctness, refusal. Gate every release on it.
Think of the eval set as a small but very honest exam for your RAG system. You do not want a huge messy exam with sloppy answers. You want 300 to 500 questions where you, with help from a real lawyer, have written down the perfect answer and marked which pages in the law library actually support it. Then every time someone changes the system, you give it the exam and check four things. Did it find the right pages? Did its answer only use facts from those pages? Does its answer agree with the perfect answer? And when there is no good answer in the library, did it correctly say 'I do not know' instead of making one up? If any of those scores drop, the change does not ship.
Detailed answer & concept explanation~8 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
9 min: walk the three sourcing streams, justify the size, name the schema fields, score the four axes, and define the release gate. Touch the legal domain stakes throughout.
| Metric | What it measures | Scoring method | Failure mode it catches |
|---|---|---|---|
| Retrieval recall@k | right chunks surfaced | set membership vs gold chunk IDs | embedding drift, indexing bugs |
| Faithfulness | claims follow from chunks | LLM-as-judge over (answer, chunks) | hallucination, drift |
| Answer correctness | answer matches gold content | LLM-as-judge against rubric | wrong but faithful answers |
| Refusal correctness | system refuses no-answer cases | binary check on has_answer=false | over-confident fabrication |
Real products, models, and research that use this idea.
- RAGAS provides reference implementations for faithfulness, answer relevance, context recall, and context precision on a configurable LLM-as-judge.
- TruLens evaluates RAG triads (context relevance, groundedness, answer relevance) with judge models and feedback functions.
- Anthropic's Claude evals harness exposes pattern based and LLM-as-judge scoring for tuning RAG and tool use pipelines.
- LangSmith offers managed eval datasets, automatic regression detection, and judge model variance tracking for production RAG.
- Casetext CoCounsel (now Thomson Reuters) ships a domain specific golden set built with practicing attorneys, gating every release.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow do you measure and control LLM-as-judge variance?
QHow would you slice the eval set to surface regressions hidden by aggregate scores?
QWhat does a 'held-out' subset really protect against, and how often should you use it?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Starting with thousands of unlabeled queries scraped from logs. Eval quality is dominated by label quality; 500 carefully labeled examples beat 5,000 noisy ones for release decisions.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.