RAG Evaluation: Metrics for Retrieval and Generation Quality › Evaluation in Practice: Building an Evaluation Pipeline
Language AI HandbookAll chapters RAG Evaluation: Metrics for Retrieval and Generation Quality › Evaluation in Practice: Building an Evaluation PipelineOne section · Sections in this chapter8 / 11 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Understanding individual metrics is necessary but not sufficient for running effective evaluations in a production environment. Building an end-to-end evaluation pipeline requires decisions about query sampling, annotation workflows, metric selection, and result interpretation.
The most important practical decision is what query distribution to evaluate against. Evaluation queries should reflect real user queries, including their difficulty distribution, topic distribution, and linguistic variety. If your system will be queried by domain experts, your evaluation set should include expert-level queries. If users will ask both simple factoid questions and complex analytical questions, both should be represented. A benchmark that only tests easy queries will mask failures on hard ones.
Creating a good evaluation dataset for RAG requires collecting or constructing query-context-answer triples. For retrieval evaluation, you need queries and relevance judgments for documents in the corpus. These can come from several sources: human annotators who manually assess relevance, existing question-answering datasets that can be aligned with your corpus, or synthetic queries generated by LLMs from corpus documents. Each source has tradeoffs. Human annotation is most reliable but expensive and slow. Existing datasets may not match your corpus or use case. Synthetic queries can be generated at scale but may not reflect real user query patterns.
For generation evaluation, you have additional choices. Reference-based metrics (BLEU, ROUGE, BERTScore) require collecting gold standard answers, which is expensive but lets comparison against a known correct answer. Reference-free metrics (RAGAS faithfulness, answer relevancy) can be computed on any query without pre-collected answers, letting evaluation on live user queries. A practical pipeline typically combines both: reference-based evaluation on a curated benchmark for rigorous tracking, plus reference-free evaluation on production traffic for continuous monitoring.
Monitoring over time is as important as point-in-time evaluation. RAG system performance degrades for several reasons: knowledge base drift (the documents become outdated), query distribution shift (users start asking different kinds of questions), component model updates (embedding models or generators get replaced), and corpus growth (the knowledge base expands, increasing retrieval difficulty). A good evaluation pipeline runs automatically on a regular schedule, tracks metric trends over time, and alerts when metrics drop below acceptable thresholds.