A retrieval-augmented generation system can sound convincing while retrieving the wrong documents. Changing chunk size, embeddings or prompts without a repeatable evaluation set often makes quality worse in ways that are difficult to notice. The solution is to test retrieval and generation separately.
Create a representative question set
Collect real questions from support tickets, internal search logs and domain experts. Include straightforward lookups, questions requiring several documents, ambiguous requests, questions with no answer in the corpus and queries containing unusual terminology. For each question, record the expected answer and the source passages that support it.
Measure retrieval independently
Evaluate whether the correct evidence appears in the top-k results. Recall@k measures how often relevant passages are retrieved; precision@k measures how much of the retrieved set is relevant. Mean reciprocal rank is useful when the first correct result matters. Review failures by query type: poor metadata filters, stale documents, bad chunk boundaries and embedding mismatch require different fixes.
Evaluate generated answers
Score factual correctness, completeness, relevance and whether claims are supported by retrieved passages. A grounded answer should not invent details absent from the evidence. Include an explicit abstention test: when the knowledge base does not contain the answer, the system should say so rather than fill the gap with a plausible guess.
Use human review and automated checks together
Automated graders can compare answers against reference criteria, but they can also miss subtle domain errors. Have subject-matter reviewers inspect a sample of outputs, especially high-impact questions. Keep the rubric stable and calibrate automated scoring against human judgments.
Run regression tests on every change
Store the dataset with versioned documents, retrieval settings, prompts and model versions. Run it after changing chunk size, embedding models, rerankers or generation parameters. Compare results by category, not only one aggregate score; a new model may improve common questions while damaging technical or multilingual queries.
Track production signals
Monitor unanswered queries, user corrections, citation clicks, retrieval latency and the age of source documents. Add failed production questions to the evaluation set after review. This creates a feedback loop based on real usage rather than prompt experimentation alone.
Practical rule: do not declare a RAG improvement because a few demos look better. Keep a fixed test set, measure retrieval and answer quality separately, and preserve regression results for every release.
Reference: RAG evaluation concepts and metrics are discussed in the research literature; see the RAGAS project documentation at https://docs.ragas.io/.
Build a dataset that reflects real usage
A useful RAG evaluation set is not a collection of easy questions written by the developer who built the system. Sample queries from support teams, internal search logs, documentation feedback and domain experts. Remove personal information before storing examples, and include different levels of difficulty: direct fact lookup, multi-hop questions, comparisons, time-sensitive information, ambiguous phrasing and questions that the corpus cannot answer. Keep a record of the relevant source documents and the exact passages that support each expected answer. This gives reviewers a defensible reference rather than asking them to judge whether an answer merely sounds plausible.
Version the knowledge base as well as the code
Evaluation results can change because source documents changed, not because the embedding model improved or regressed. Assign versions to document snapshots, chunking rules, metadata filters, embedding models, rerankers and prompts. Record when a document was published, updated or retired. If a test fails, the team should be able to reproduce the exact retrieval corpus used during that run. For fast-changing content, distinguish between correctness at the time of the question and correctness against today’s knowledge base. Without this context, a benchmark can reward answers that were once right but are now outdated.
Test retrieval and generation separately
First inspect the retrieved passages without asking a language model to answer. Measure whether the evidence needed for the answer appears in the top results, whether irrelevant passages dominate and whether metadata filters exclude valid material. Then evaluate the generated answer using the retrieved context. This separation prevents a strong language model from masking a weak search layer by guessing from prior knowledge. It also helps identify the right fix: poor recall may require better chunking or embeddings, while unsupported claims may require stricter grounding instructions, a reranker or an abstention policy.
Use metrics with clear interpretation
Recall at k is useful when missing a relevant passage is costly; precision at k helps when irrelevant context consumes the model’s attention. Mean reciprocal rank rewards placing the first useful result near the top. For answer quality, assess factual correctness, completeness, relevance and citation support. A groundedness score should check whether each material claim can be traced to retrieved evidence. No single metric describes the whole product. Report results by query category and include confidence intervals or sample counts so a small test set does not create false certainty.
Evaluate citations as a user-facing feature
If the interface displays citations, verify that each citation points to the source that actually supports the nearby statement. Check that links resolve, document titles are meaningful and page or section references are accurate. A response can be factually correct while showing a misleading citation, which damages trust and makes review harder. Include tests for multiple claims supported by different sources, conflicting source versions and answers where no citation should be presented because no evidence was retrieved. Review whether the interface makes it easy for users to open the source and inspect the surrounding context.
Test abstention and uncertainty deliberately
Include questions whose answers are absent, contradictory or too vague to resolve safely. The desired behavior may be to ask a clarifying question, state that the corpus does not contain the answer or explain which evidence conflicts. Do not reward a system for always producing a confident paragraph. Track unsupported-answer rate separately from answer coverage. In regulated or high-impact settings, define thresholds for when the system must route a question to a qualified person rather than generate a recommendation.
Turn production feedback into regression cases
Review user corrections, unanswered searches, low-rated responses and citation clicks. Convert recurring failures into test cases after checking the underlying source and expected answer. Avoid automatically treating every user correction as truth; have a subject-matter reviewer validate it. Run the evaluation suite whenever documents, retrieval settings, model versions or prompts change. Keep a small fast smoke test for every deployment and a larger benchmark for scheduled evaluation. This creates a measurable feedback loop and makes quality improvements less dependent on anecdotal demonstrations.
Set release gates that match risk
Define minimum retrieval recall, citation accuracy and groundedness for each use case. A public FAQ assistant may tolerate a different coverage target from an internal legal or security knowledge assistant. Require manual review of high-impact categories and block releases that introduce severe regressions even if the overall average improves. Preserve the previous configuration so rollback is possible. The purpose of evaluation is not to create a leaderboard; it is to make sure each release answers the intended questions more reliably without increasing unsupported claims or exposing data to the wrong users.





