Chapter 6. Evaluating Your RAG Application
Whether you build your RAG on your own (DIY) or use a RAG platform, you need to be able to measure the quality of responses that users see when they use your RAG application. This is known as RAG evaluation, which measures how accurately the system finds the right documents or chunks (retrieval accuracy) and how coherently and correctly it crafts its response from those documents or chunks (generation accuracy).
Before we jump into the details, it is helpful to distinguish between the two types of RAG evaluation:
- Offline evaluation
-
Performed during the development cycle. These are deep, often resource-heavy evaluations used to optimize your pipeline settings before deployment.
- Online evaluation
-
Performed on live traffic. This identifies how real users interact with the system but requires a lightweight approach to maintain a low-latency user experience.
In this chapter, we focus primarily on offline RAG evaluation, discussing why it’s important, which metrics you should consider, and how to interpret each metric. Then, in “Online RAG Evaluation”, we briefly discuss online evaluation and provide some best practices.
How Does RAG Fail?
Not having a systematic approach to measuring the quality of your RAG application is not just a technical oversight; it’s a business risk that can undermine your entire AI strategy. Without a structured, rigorous evaluation framework for RAG, you risk deploying applications that produce hallucinations ...
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