RAG Evaluation: Test Answers Against Source Documents

RAG evaluation scores retrieval and answers separately. Build a test set from real documents, check citations and set a release gate you can measure.

10 min read
Hands holding a stack of blank paper above a wooden desk beside a pale blue accordion file

RAG evaluation tests two things that fail separately: whether a retrieval-augmented generation system finds the right passage in your documents, and whether its answer sticks to what that passage says. This guide is for Australian product owners and development leads who need evidence that an assistant answers from source documents. It covers the test set, the scores, citation checks and the release gate.

It complements three live guides. Our architecture guide to RAG for private company data covers the build and its permission tests. The guide to a local LLM for business covers running a model on your own hardware, and the guide to an AI chatbot for a business website shows why a small site may need no retrieval at all. This one covers how to measure the answers.

Key Takeaways

  • Score retrieval and answers separately, because one blended score hides which stage failed.
  • Build the test set from real documents and real staff questions, with the reference passage recorded.
  • A faithful answer can still be wrong when the passage is outdated, so compare answers with a reference too.
  • Check every citation three ways: it opens, it supports the claim and it is current.
  • Write the release gate before the first run, and keep the test set fixed while you tune.

How Should RAG Evaluation Split Retrieval From Answers?

A retrieval-augmented system has two stages that fail in different ways, so evaluate them as two. The paper that introduced the Ragas evaluation framework names the dimensions: whether retrieval identifies relevant and focused passages, whether the model uses those passages faithfully, and the quality of the generated text.

When a blended score drops, nobody can tell whether the search missed or the model drifted. Scoring the stages apart shows where to work.

How Do You Build a Test Set From Real Documents?

Start from the documents, not from guesses about what staff might ask.

  • Sample across owners and ages. Include the older, messier files as well as the clean new ones.
  • Let each owner write the questions. For each sampled passage, the document owner writes the question a colleague would ask, then records the passage ID and a short reference answer.
  • Add questions the sources cannot answer. The correct result is a refusal, and the set must show it.
  • Add conflicts. Where two versions of a policy exist, the correct answer cites the current one.
  • Add questions that need two passages. They expose retrieval that returns only one.
  • Add exact-term questions. Product codes and acronyms test whether exact-text matching still works.

Record each document's version and owner beside its cases so you know when a case has gone stale. Treat the set as read-only once testing begins, and add new cases from failures afterwards.

How Do You Score Retrieval Separately From the Answer?

Check retrieval before reading any answer. The cheapest method needs no model as judge: compare the passage IDs the system retrieved with the reference IDs recorded in the test set. Ragas documents this as context recall, in its ID-based form the number of reference IDs found among the retrieved IDs divided by the total reference IDs. Its model-judged form estimates recall from the reference answer instead.

Precision is the other half. Ragas describes context precision as the retriever's ability to rank relevant passages above irrelevant ones, so irrelevant passages near the front lower the score. Report both by question type, not as one number, because a high average can hide failing conflict or exact-term questions.

What Does a Faithful Answer Prove, and What Does It Miss?

Faithfulness asks whether the claims in an answer can be supported by the retrieved passages. Ragas defines faithfulness as the claims supported by the retrieved context divided by the total claims in the response. A high score shows the model stayed inside the text it was given.

It does not show the text was right. If retrieval returns an outdated policy, a perfectly faithful answer repeats the outdated policy. That is why each question also carries a reference answer, and why a person compares final answers with it.

OWASP's guidance on misinformation describes output that looks credible but is false, and names overreliance, where users fail to verify, as a related risk. That is the reason to test claims one at a time instead of accepting a fluent paragraph.

How Do You Check Source Citations?

A citation is a claim about the source, so test it as one. Run three checks on a sample of answers for every release.

  • It opens. The cited link or document ID resolves to a real file the asker may read.
  • It supports the claim. The cited passage contains the statement, not only the topic. A reviewer reads the claim and the passage side by side.
  • It is current. The cited version is the latest one the owner has approved.

Count failures by check. A citation that opens but does not support the claim usually points to the generation stage. One that supports the claim but is out of date points to the index.

Reading the Scores: Where to Fix the Failure

Each pattern of results points to a different repair.

  • Reference passage not retrieved. The fault is retrieval. Change how documents are split, keep headings with their passages or adjust the search, then re-run.
  • Passage retrieved but answer unfaithful. The fault is generation. Tighten the instruction to answer only from the passages and cite them, or test another model.
  • Answer faithful but wrong against the reference. The fault is the source. The passage is outdated, wrong or in conflict with another, so the owner fixes the document and the index is refreshed.
  • Unanswerable question answered. The fault is refusal. Strengthen the instruction to say so when the sources are silent, and add more such cases.

Change one thing at a time and re-run the whole set, so each gain or loss has one cause.

A Worked Example: A Procurement Policy Assistant

This is a hypothetical illustration, not a client result. A services firm builds an assistant that answers staff questions about expenses and procurement from its policy documents.

  1. Sample. The finance lead picks documents from several owners, including an old travel policy and the current one.
  2. Write. Each owner writes questions, passage IDs and reference answers, plus questions the policies do not cover.
  3. Run. The team scores retrieval, faithfulness, correctness and citations, split by question type.
  4. Read. If conflict questions fail retrieval while the rest pass, the repair belongs in how versions are indexed, not in the prompt. If every answer is faithful but several are wrong, the old travel policy is outranking the new one. Then fix one thing and re-run the full set.

Set an Acceptance Gate Before the First Run

The gate turns scores into a release decision. Write each mark before testing and hold it fixed.

  • Retrieval mark. The share of answerable cases where the reference passage reaches the model, set per question type.
  • Faithfulness mark. No unsupported claims on high-consequence topics such as money, dates and obligations, and a team-set rate elsewhere.
  • Correctness mark. The share of answers a reviewer accepts against the reference answer.
  • Refusal mark. The share of unanswerable questions the assistant declines.
  • Citation mark. Every sampled citation opens, supports the claim and is current.

No standard supplies these figures. Owners set them from what a wrong answer costs. The Australian Government's Guidance for AI adoption asks for acceptance criteria and test methods that reflect the intended use and risks, and for documented authorisation from the accountable person based on test results.

Failure Modes to Watch After Release

  • Stale index. A new policy is published but the old passage still ranks first. Re-run the conflict cases after every refresh.
  • Extraction loss. Text extraction drops tables or headings from some files, so their questions can never be answered. Sample these files on purpose.
  • Judge drift. If a model grades faithfulness, compare its scores with a person's after any change to the grader. OpenAI's evaluation best practices list skipping that calibration as a common mistake.
  • New question types. Add each wrong answer reported by staff to the test set.

Related Resources

Common Questions About RAG Evaluation

1. What Is RAG Evaluation?

RAG evaluation is a structured test of a retrieval-augmented system. It scores whether the right passage was found, whether the answer stays within it and whether the citations hold up, using a test set built from your own documents.

2. How Is RAG Evaluation Different From Testing a Plain Chatbot?

A chatbot that holds all its content in the prompt has one stage to judge. A retrieval-augmented system adds a search stage, so a wrong answer can come from the search, the model or the source document.

3. How Many Questions Should a RAG Test Set Contain?

No standard sets a number. Include enough that every question type appears more than once and the owners can still label every case, then add cases from real failures.

4. Do You Need a Tool Such as Ragas?

Not to begin. ID-based retrieval checks and human-read citation checks need only a spreadsheet and a small script. Tools add automated scoring of faithfulness, and those scores should be compared with a person's judgement on a sample.

5. How Often Should RAG Evaluation Run?

After any change to the documents, splitting, search, prompt or model, and again whenever staff report a wrong answer. Each failure becomes a new case in the set.

Freeze the Test Set, Then Tune the Pipeline

RAG evaluation works when the test set comes from real documents and the stages are scored apart. Ask each document owner for their questions, passage IDs and reference answers, freeze the set, then change one part of the pipeline at a time. Teams weighing a build can see advanced RAG systems with source citations, grounded in a company's own knowledge base, on the AI-powered platform options page.

Ready to build what is next?

Talk to our Melbourne engineering team about modernising your systems or shipping your next product.