What they’re really asking
If you only remember one thing, say this in the first minute: “The pipeline is the easy part; the eval is the deliverable. I’ll write the 20 questions before tuning anything and mix them on purpose: simple lookups, questions that need two documents, keyword-heavy ones, paraphrases, and three the docs can’t answer. I’ll report recall@5 next to hit@5, with an honest error bar, which at 20 questions is about ±17.5 points. For faithfulness I’ll run free citation checks first, then a judge that I check against my own labels before I trust it. And since 50 docs may fit in one prompt, pasting everything is the baseline to beat.”
The rest of this page explains each part of that answer.
The brief is a take-home: “Here are 50 markdown docs. Build a Q&A system, an eval set of 20 questions, and report recall@5 and faithfulness.” What stands out is not the pipeline. It is a defensible eval: how the 20 questions were chosen, what the numbers mean, and how sure you are.
What makes this different from testing a normal backend feature is that you can’t write a unit test for “answers well”. A retrieval system always returns its closest matches, even when they are the wrong ones, and a language model writes a fluent answer from them either way. So quality is a measured rate on a sample of questions, with an error bar, more like an A/B test than a test suite. With only 20 questions, that error bar is wide, and saying so is part of a good answer.
(This is a prep guide’s own example of a take-home, not a candidate’s report. The guide says the format tests “whether you can build and measure an LLM system end to end”, and that without a number “the interviewer assumes you tuned yours by feel” techinterview.org.)
Words you need first
- Q&A system with retrieval (RAG): split the docs into pieces (chunks), find the chunks closest to a question, paste them into a large language model’s (LLM) prompt, and have it answer from them with citations. LLMs read text in tokens, pieces of words; prompt sizes and prices are counted in them.
- recall@5: the share of all the relevant documents for a question that appear in the top 5 results, averaged over questions. hit@5: the share of questions with at least one relevant document in the top 5.
- Faithfulness: whether every claim in the answer is supported by the chunks the model was given. An answer can be faithful and still incomplete, but an unfaithful one is making things up.
- Judge: a second LLM call that grades each answer. Using an LLM this way is called LLM-as-judge.
Clarify first
- How long are the 50 documents? “I’ll assume 1,000–3,000 words each, so 50,000–150,000 words, or roughly 65K–200K tokens at an assumed 1.3 tokens per word.” That may fit in one long prompt. Say so, and treat “whole corpus in the prompt” as a baseline to beat.
- Who decides what a correct answer is? “I’ll label it myself and say so.”
- Recall@5 of what: chunks or documents? “Documents, so the labels survive re-chunking.”
- Faithfulness judged how? “An LLM judge, checked against my own labels.”
Answer
Choosing the 20 questions
Write them before tuning anything, and choose the mix on purpose. Then report the mix in the README:
| Kind | How many | Example (illustrative) | What it tests |
|---|---|---|---|
| Single-fact lookup | 6 | ”What is the refund window?” | The basics work |
| Needs two sections or documents | 4 | ”Can I get a refund on an annual plan after 30 days?“ | recall@5 below 1.0 is possible here |
| Keyword-heavy | 3 | ”What does error E1042 mean?” | Names, codes, versions that vector search blurs |
| Paraphrase | 4 | ”Can I get my money back?” | Meaning, with few shared words |
| Unanswerable | 3 | ”Do you ship to Antarctica?” | Whether the system says “I don’t know” |
Label the relevant document IDs for each. Don’t have an LLM generate the questions from the chunks and then score retrieval on them. Those questions share the chunk’s words, so every score comes out inflated.
Reporting recall@5
Report recall@5 and hit@5 side by side, because they differ on the four two-document questions. Take the refund question: if the top 5 contains the refund page but not the annual-plan page, it scores hit@5 = 1 but recall@5 = 0.5.
Add the error bar. At a rate of 0.8 with n = 20 questions, the 95% interval is about ±17.5 points. Say: “Twenty questions show the system works. They can’t rank two configurations that are a few points apart.”
Show BM25-only (keyword search), dense-only (vector search) and hybrid (both merged) on the same 20, and say honestly that differences of a few points are noise at this size.
The arithmetic behind the numbers (for a Staff-level follow-up)
± 1.96 × √( p (1 − p) ÷ n ) p- measured rate
n- number of questions
p = 0.8, n = 20: ±17.5 points, so 20 questions show the system works but cannot rank two close configurations
Reporting faithfulness
Define it first: the share of answers whose every claim is supported by the retrieved context. Then measure it in two layers.
- Deterministic checks, in code, for free. Every sentence cites a source, and every citation points at a chunk that was in the prompt.
- A yes/no judge per claim. Split each answer into claims and ask the judge whether the cited chunk supports each one.
Before reporting the judge’s number, label the 20 answers yourself and report how often the judge agrees with you, as Cohen’s kappa (agreement corrected for what two raters would reach by chance). The same guide asks whether you’d trust a judge before testing it against humans, and answers “The right answer is no”.
Report faithfulness separately for the 17 answerable and the 3 unanswerable questions. For the unanswerable three, the faithful answer is “I don’t know”.
The README
Lead with one table: recall@5, hit@5, faithfulness, and abstention on the unanswerable three. Then show two failures with their traces (the question, the retrieved chunks, the answer). End with what you’d do next: more questions, a paired comparison, and the long-context baseline.
Senior vs Staff
50 docs, 20 questions
Senior
- Stratified question set, recall@5 and hit@5 with an interval, faithfulness with a calibrated judge, honest about noise.
Staff
- Also argues whether retrieval beats putting the whole corpus in context on cost and accuracy, and proposes how the set grows from real usage.
Small-team version
This is exactly the artifact a small team needs before launch, and it takes a day, not a quarter.
- The judge is cheap. A judge run over 20 answers costs about $0.10 of input on Claude Sonnet 5, plus a few cents of output.
- The scarce input is people. Budget an hour of a domain expert to check your labels.
- Measure the long-context baseline first. Anthropic’s contextual-retrieval post suggests a knowledge base under 200,000 tokens can go straight into the prompt (2024-09-19). Build retrieval only if the corpus is too big for the prompt, or the paste-everything version loses on your 20 questions.
The arithmetic behind the numbers (for a Staff-level follow-up)
- Judge input: 20 answers × about 2,500 input tokens each (assumed) = 50,000 tokens.
- Cost: 50,000 × $2 per million (Claude Sonnet 5 list input price, fetched 2026-10-11) = $0.10.
Pitfalls
- Twenty easy single-fact lookups. They can’t show whether multi-document questions or abstention work.
- Questions generated from the chunks, then scored against those chunks. Shared words inflate every score.
- A faithfulness number from an uncalibrated judge. Until it is checked against your labels, it is the judge’s opinion, not a measurement.
- No unanswerable questions. Abstention is never tested, so the system’s confident wrong answers go unseen.
Go deeper
- Family walkthrough: Build a small RAG in code.
- Metrics and judges in depth: Measure retrieval and debug confident wrong answers.
- Labs: Build Your Own RAG System, Build Your Own LLM Evaluation Harness.