Evaluating a retrieval-augmented generation (RAG) application requires more than checking whether the final answer sounds useful. This guide provides a reusable RAG evaluation workflow that separates retrieval quality from answer quality, explains the core metrics, and gives you a practical checklist for testing changes to chunking, embeddings, reranking, prompts, models, and knowledge sources.
Overview
A RAG system typically performs two connected jobs: it retrieves relevant passages from a knowledge source, then uses those passages to generate an answer. A weak result can therefore have several causes. The retriever may return the wrong documents, the correct evidence may be buried in an excessive context, or the language model may fail to use the available evidence accurately.
Effective RAG evaluation measures these stages separately before judging the complete response. This prevents a fluent answer from hiding poor retrieval and prevents a retrieval change from being blamed for a generation problem.
Start with a representative evaluation set. Each test case should include a realistic user question and, where possible, a trusted answer, supporting document or passage identifiers, and notes about acceptable variations. Include straightforward questions, ambiguous requests, multi-step questions, questions with no answer in the knowledge base, and examples that are sensitive to dates, permissions, or terminology.
Run the same cases against a baseline and a proposed version of the pipeline. Record the retriever configuration, embedding model, chunking rules, reranker settings, prompt version, generation model, token limits, and knowledge-base snapshot. Without this information, a score change is difficult to interpret or reproduce.
Core RAG metrics
| Metric | What it measures | Useful question |
|---|---|---|
| Context precision | How much of the retrieved context is relevant to the question | Did the system place useful evidence near the top? |
| Context recall | How much of the needed evidence was retrieved | Did the system find the information required to answer? |
| Faithfulness | Whether the answer is supported by the supplied context | Did the model avoid unsupported claims? |
| Answer relevance | Whether the answer addresses the user’s question directly | Was the response useful and on topic? |
These measures describe different failure modes and should not be collapsed into one score too early. A system can have high context recall but low context precision if it retrieves the needed passage along with a large amount of irrelevant text. It can also retrieve excellent evidence yet produce an unfaithful answer. For a broader treatment of metric selection, see LLM Evaluation Metrics: How to Choose the Right Measures for AI Quality.
Checklist by scenario
Before building a benchmark
- Define the user tasks the RAG application must support.
- Separate answerable questions from questions that should produce a clear “not found” or clarification response.
- Sample cases from real usage when permitted, then remove sensitive information and duplicates.
- Label the expected supporting documents or passages where feasible.
- Write reference answers as evaluation guidance, not as the only wording that can be accepted.
- Mark questions requiring exact details, calculations, citations, multiple sources, or temporal awareness.
- Keep a held-out set that is not used while tuning prompts or retrieval parameters.
When testing retrieval changes
- Record the baseline top-k value and compare it with the proposed value.
- Measure context precision and context recall independently.
- Inspect whether relevant passages appear in the top results or only deeper in the list.
- Compare chunk sizes, overlap, metadata filters, and document parsing behavior.
- Test exact terminology, synonyms, abbreviations, misspellings, and natural-language questions.
- Check whether duplicate or near-duplicate chunks crowd out distinct evidence.
- Review failed cases manually instead of relying only on an aggregate retrieval score.
When testing generation, prompts, or models
- Hold the retrieved context constant so the generation comparison is fair.
- Measure faithfulness and answer relevance separately.
- Check whether the response distinguishes evidence from inference.
- Test citations or source references for correctness, not just presence.
- Include cases where the context is incomplete and the correct behavior is to acknowledge uncertainty.
- Record latency, token use, and failure rates alongside quality measures.
- Use a small manually reviewed sample to validate automated scores.
If a model or provider is changing, treat the evaluation as a compatibility and regression exercise rather than a single quality comparison. The AI Model Migration Checklist can complement this process by covering quality, compatibility, and rollback considerations.
When testing the complete RAG application
- Run end-to-end cases with production-like retrieval, prompts, context limits, and output formatting.
- Test multi-turn conversations for stale, missing, or incorrectly carried-over context.
- Test access controls to ensure retrieval does not expose documents a user cannot view.
- Include adversarial documents and instructions that attempt to redirect the model.
- Check behavior when the vector store, parser, model, or external dependency fails.
- Set release thresholds for critical cases, not only for the average score.
Security testing belongs in the same release workflow. Retrieval can surface untrusted text, so include prompt-injection cases and review how the application separates retrieved content from system instructions. See the Prompt Injection Testing Guide for a focused checklist.
What to double-check
Check the evaluation set first. A benchmark that contains only easy, well-formed questions can make a fragile system look reliable. Review the distribution of question types, document sources, answer lengths, and failure severity. A small set of high-impact cases may deserve more attention than a large number of routine examples.
Check the meaning of each score. Automated metrics are signals, not a complete definition of quality. A faithfulness score may indicate that claims resemble the retrieved text while missing a critical contradiction. Answer relevance may reward a concise response that omits an important qualification. Define what acceptable behavior means for your application and validate that the metric reflects it.
Check references and citations. If the application displays sources, verify that each citation supports the associated claim and that the cited passage is accessible to the intended user. A source label without supporting evidence should not count as a successful citation.
Check context-window behavior. More retrieved text is not automatically better. Long contexts can increase cost, exceed limits, bury important passages, or introduce conflicting information. Test truncation, ordering, and the position of relevant evidence. The LLM Context Window Testing guide provides a useful companion checklist.
Check judge consistency. If an LLM judge is used, define a rubric, provide clear scoring criteria, and calibrate it against human-reviewed examples. Track disagreement and investigate cases where the judge gives a high score to an answer that reviewers consider unsafe or unsupported. Automated grading should accelerate review, not eliminate it.
Common mistakes
- Using only the final answer score. This hides whether the problem is retrieval, generation, or both. Always retain the retrieved passages for inspection.
- Changing multiple variables at once. Switching embeddings, chunking, reranking, and the generation model together prevents useful attribution. Change one layer at a time where practical, then test the integrated configuration.
- Optimizing for average performance. A high mean score can hide catastrophic failures on permissions, financial details, safety-sensitive requests, or frequently used workflows. Report slices and critical-case results.
- Treating reference answers as exact strings. Correct answers can use different wording. Evaluate factual coverage, support, and relevance rather than surface similarity alone.
- Ignoring unanswerable questions. A RAG system should know when its sources do not support an answer. Add cases where abstention or a clarifying question is the desired outcome.
- Evaluating on data used for tuning. Repeatedly optimizing against the same examples can overfit the benchmark. Keep a held-out set and refresh cases from observed failure patterns.
- Skipping regression testing after content updates. Changes to parsing, metadata, document versions, or access rules can alter retrieval even when the application code is unchanged.
When to revisit
Re-run your RAG evaluation whenever a change could affect what the system retrieves or how it uses retrieved evidence. This includes new documents, removed documents, parser updates, chunking changes, embedding or reranking changes, vector-index migrations, prompt edits, model upgrades, context-limit changes, and access-control updates.
Also revisit the benchmark before major planning or release cycles. Review whether the test set still represents current user questions, terminology, knowledge sources, and risk areas. Add cases from production failures after removing private information, and retire only those cases that no longer reflect a supported workflow.
Use this short release checklist:
- Run the fixed benchmark against the current baseline and candidate version.
- Compare context precision, context recall, faithfulness, and answer relevance.
- Review critical failures and representative improvements manually.
- Check latency, token consumption, citation behavior, access controls, and abstention handling.
- Record configuration details, dataset version, scores, and known limitations.
- Approve, revise, or roll back based on predefined thresholds and failure severity.
A dependable RAG evaluation process is not a one-time benchmark. It is a repeatable comparison method that makes pipeline changes observable. Keep the dataset versioned, preserve failed examples, separate retrieval from generation, and require evidence before declaring an improvement.