Zenaique

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.

Short answer·Hard·4.0 · 0·~3 min·Asked atDataikuReplicateSpotify·Relevant atAnthropicDatabricks
Attempt 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.

Free · 2 AI evals / day
TL;DR

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.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

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.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

A golden eval set is the single most important artifact in a production RAG system. It is the empirical answer to 'did this change make things better or worse?', and every other engineering decision (which retriever, which reranker, which generator, which prompt) defers to it. For a legal research product, the stakes are higher: a single hallucinated citation can end a customer relationship, and 'we did not measure that' is not a defense.

The senior interviewer is looking for whether you treat eval design as a system design problem. Three sourcing streams, careful sizing, a rich per-example schema, four metric axes, and a release gate discipline are the components. This deep dive walks each one, calls out the failure modes that get teams in trouble, and closes with how the eval set evolves over time.

Sourcing: three independent streams, no shortcuts

A single sourcing stream cannot give you the coverage needed to gate releases. Three streams, in combination, build the set you actually need.

Real production queries. Sample from the last 30-90 days of production logs, stratified by user persona, query length, and query category (case law, statute, regulatory, contract). Stratification matters: an unstratified sample oversamples the easy queries that dominate volume and undersamples the hard queries that dominate failures. The real traffic stream tells you what the system actually faces.

SME-written queries. A panel of 5-10 legal researchers writes questions targeting specific reasoning patterns: multi-jurisdiction comparisons, holdings vs dicta distinctions, statutory cross-references, time boxed case law. SMEs systematically probe weaknesses that real users do not formulate. They also write the gold answers, which is the load bearing labor.

Adversarial bank. Past production incidents (a hallucinated citation, a wrong jurisdiction, a refused query that should have answered) become permanent eval cases. Add deliberately hard cases: queries with no answer in the corpus (refusal must fire), multi-hop chains, queries about pre corpus cutoff case law, deliberately ambiguous queries. The adversarial slice is the smoke detector for regressions.

No single stream is sufficient. Real-only misses systematic blind spots. SME-only is unrepresentative of load. Adversarial-only is not the workload. The three together cover what you can measure.

Sizing: 200-500 examples, not 5,000
Per-example schema: five load bearing fields
Four metric axes, each with its own measurement story
Release gating and the held-out subset
How the eval set evolves over time
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.
MetricWhat it measuresScoring methodFailure mode it catches
Retrieval recall@kright chunks surfacedset membership vs gold chunk IDsembedding drift, indexing bugs
Faithfulnessclaims follow from chunksLLM-as-judge over (answer, chunks)hallucination, drift
Answer correctnessanswer matches gold contentLLM-as-judge against rubricwrong but faithful answers
Refusal correctnesssystem refuses no-answer casesbinary check on has_answer=falseover-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.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QHow do you measure and control LLM-as-judge variance?
A

Run the judge with multiple samples per example (self-consistency), compute the judge vs judge agreement on a small human labeled subset, and treat the judge score as a confidence interval rather than a point estimate. Switch to a stronger judge if agreement is low.

3 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

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.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • Why three sourcing streams beat one

  • Why 200-500 high-quality examples beat 5,000 noisy ones

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Which metric best measures whether a RAG answer is grounded in the retrieved context?
MCQ·Medium