Chapter 7. Evaluating Retrieval-Augmented Generation
The previous chapters covered evaluation techniques that apply broadly across LLM applications. Now we turn to a specific architecture that introduces its own evaluation challenges: RAG.
In this chapter, you will learn:
-
How to build evaluation datasets for retrieval using synthetic query generation
-
How to measure retrieval quality with Precision@k, Recall@k, MRR, and NDCG@k
-
How to tune chunking strategies with grid search
-
How to evaluate generation quality using faithfulness and relevance
RAG architectures are pervasive across customer support, enterprise search, scientific QA, and coding assistance. Evaluating RAG requires more than measuring final answer correctness. Each stage of the pipeline (query construction, retrieval, reranking, and generation) can independently introduce failure modes.1 For example, failures across these stages are interdependent. If retrieval returns the wrong documents, the generator has no way to produce a correct answer. If the user’s query is ambiguous, retrieval ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access