NewProject Coding is here — build features and fix bugs in real codebases with an AI assistantSee what's new
Advanced
Evaluating RAG Systems
35 min readChapter 6Core

1. Evaluating RAG systems

Evaluating a RAG (retrieval-augmented generation) system means measuring two things separately and then together: how well it finds the right documents, and how faithfully it answers from them. Score the retriever against chunks you know are relevant, score the generator's answer claim by claim against the context it was given, and keep one end-to-end score. When an answer fails, check retrieval first, then faithfulness.

Use it whenever an assistant answers from a document store and a quality change must be traced to search, prompt, or content. Skip it when a model answers from its own knowledge, where Designing an Eval: Success Criteria and Graders applies, or when an agent chooses tools, which Evaluating Agents and Multi-Turn Conversations owns. Our running example is HelpDesk Assistant, a support assistant for a software company that answers customer questions from its help-center articles.

"How do you evaluate a RAG system?" is a standard opener in AI engineering rounds, and two follow-ups usually come next: "Is this bad answer a retrieval problem or a generation problem?" and "How do you measure hallucination?" A mid-level candidate separates retrieval metrics from generation metrics and can compute Recall@k. A senior candidate scores faithfulness claim by claim with a number, explains where relevance labels come from without annotators and how they bias the result, diagnoses failures in a fixed order, and knows when the metrics look healthy on a wrong answer.

premium content mask
Upgrade to premium and unlock full chapter
Spot an issue or have a suggestion?
Evaluating Agents and Multi-Turn Conversations  |

Discussion

Upgrade to premium to read and join the discussion.