How do you evaluate a RAG pipeline? Why evaluate components separately from the end-to-end system?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Evaluate at two levels, because end-to-end scores can't tell you which component to fix.
Full worked answer with diagram
Evaluate at two levels, because end-to-end scores can't tell you which component to fix.
Component-wise:
- Retrieval: build a labelled set of query → relevant-chunk(s) pairs (from human labelling, or LLM-assisted labelling with human audit; you can also generate questions from known chunks so relevance is by construction). Measure recall@k first - if the answer isn't in the retrieved set, generation cannot fix it; recall@k is the ceiling on end-to-end quality. Add MRR/nDCG when position in the context matters. Retrieval evals are cheap, deterministic, and run without touching the generator - you can sweep chunk sizes, embedders, hybrid weights, and rerankers offline in minutes.
- Generation (given fixed context): faithfulness/groundedness - are the answer's claims supported by the provided chunks? (judge-graded, claim-by-claim); answer relevance - does it address the question?; context utilisation - did it use the right chunk when several were retrieved, and does it correctly say "not found" when the context lacks the answer (measured with adversarial cases where you deliberately retrieve nothing useful)?
End-to-end: correctness of the final answer against reference answers on a golden set, plus citation accuracy (do cited chunk IDs actually support the cited claims). This is the number leadership sees, and the one that correlates with users.
Why both: an end-to-end failure is ambiguous between "retrieval missed the document" and "generator ignored/contradicted the document" - the fixes are completely different (re-chunk/re-embed/rerank vs prompt/model changes). Component metrics localise the fault instantly. In practice most RAG quality loss is in retrieval (and upstream parsing/chunking), so component evals also tell you where to spend effort. Frameworks like RAGAS package these metrics (faithfulness, answer relevance, context precision/recall), but the concepts matter more than the tooling.
Classic interview trap: quoting only faithfulness. A system that answers "I don't know" to everything is perfectly faithful - pair faithfulness with answer relevance/completeness or you'll optimise into uselessness.
Worth sketching. Hanging each metric off the component it grades is the fastest way to show you can localise a fault instead of just reporting one.
flowchart LR
Q["Query"] --> R["Retriever"]
R --> C["Top-k chunks"]
C --> G["Generator"]
G --> A["Answer"]
R -.-> M1["recall@k:<br/>ceiling on everything after it"]
G -.-> M2["faithfulness and answer relevance,<br/>context held fixed"]
A -.-> M3["end-to-end correctness<br/>and citation accuracy"]
What a good answer covers
- Evaluate at two levels, because end-to-end scores can't tell you which component to fix
- Retrieval: build a labelled set of query → relevant-chunk(s) pairs (from human labelling, or…
- Generation (given fixed context)
- End-to-end: correctness of the final answer against reference answers on a golden set, plus citation…
- This is the number leadership sees, and the one that correlates with users
Key terms: Component-wise · Retrieval · recall@k · Generation (given fixed context) · faithfulness/groundedness · answer relevance · context utilisation · End-to-end
In the glossary: Recall@k · MRR · nDCG · Faithfulness · Golden set · RAGAS
Interviewer follow-ups to expect
Recall@10 is 95% but end-to-end correctness is 70% - where do you look?
How do you keep retrieval labels valid when the corpus is re-chunked?
- Retrieval: build a labelled set of query → relevant-chunk(s) pairs (from human labelling, or LLM-assisted labelling with human audit; you can also generate questions from known chunks so relevance is by construction). Measure recall@k first - if the answer isn't in the retrieved set, generation cannot fix it; recall@k is the ceiling on end-to-end quality. Add MRR/nDCG when position in the context matters. Retrieval evals are cheap, deterministic, and run without touching the generator - you can sweep chunk sizes, embedders, hybrid weights, and rerankers offline in minutes.
- Generation (given fixed context): faithfulness/groundedness - are the answer's claims supported by the provided chunks? (judge-graded, claim-by-claim); answer relevance - does it address the question?; context utilisation - did it use the right chunk when several were retrieved, and does it correctly say "not found" when the context lacks the answer (measured with adversarial cases where you deliberately retrieve nothing useful)?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep