Skip to content

Guide · LLM engineering

A RAG Evaluation Checklist Before You Promise Accuracy

Key takeaways

  • A RAG demo over five PDFs proves nothing about the real corpus — evaluate on that, at full size.
  • Build a question set with known answers before tuning anything; it's the yardstick for every change.
  • Check what was retrieved before blaming the generator; measure both stages separately.
  • Report where retrieval fails, not just an average score. Honest limits are the deliverable.

By · published · updated

A reference question set feeds separate retrieval and answer evaluations; failures are tagged before changing one variable and rerunning.
Retrieval quality, answer quality and correct refusal are separate checks. No benchmark results are implied.
01

Why demos lie

A RAG pipeline over a handful of clean PDFs works impressively. The same pipeline over the real corpus — thousands of scanned pages, duplicated documents, tables, ten-year-old policies that contradict last month's — fails in ways the demo never showed. The gap between the two is where RAG projects die, and it's measurable before anyone signs a contract.

This is a reference evaluation workflow, not a published benchmark. The sample question and helper below are illustrative; no corpus, model version or measured accuracy is supplied here. Record those details with your own results, along with the dataset version and grading rubric, so another run can be compared fairly.

02

The checklist

  • Question set first. 50–100 real questions with known-correct answers, written from the corpus, including questions the corpus can't answer. Every tuning decision gets judged against this.
  • Retrieval before generation. For each question, check the retrieved chunks. If the right chunk isn't in the top-k, no prompt will save you — fix chunking, embeddings or search before touching the model.
  • Chunking matched to the documents. Fixed-size chunks shred tables and cross-references. Section-aware splitting usually beats cleverness.
  • Refusals tested explicitly. The questions with no answer must produce "not in the documents", not a confident hallucination.
  • Freshness checked. When two documents contradict (old policy vs new), decide the rule and test it.
03

Building the question set

Write the questions from the documents, not from imagination. Pull them from three places: what real users ask (support tickets, chat logs, search queries), what the documents clearly answer, and what they clearly do not. Each row needs the question, the correct answer in one or two sentences, the document and section the answer lives in, and a category tag such as table, policy-versus-policy, multi-document or no answer. The source location is what lets you test retrieval separately from generation.

{
  "id": "q-017",
  "question": "How many days of notice does the supplier contract require for cancellation?",
  "answer": "60 days written notice.",
  "source": {"doc": "supplier-terms-2024.pdf", "section": "9.2"},
  "category": "contract-clause",
  "answerable": true
}
One row of an evaluation set (illustrative).

Include unanswerable questions deliberately; one in five is a starting design choice, not an expected production distribution. Also keep a held-out set that you do not use for tuning. Otherwise an improved score can mean the pipeline has been adjusted to the test rather than improved on unfamiliar questions.

04

Measure retrieval and generation separately

A wrong final answer has two possible causes, and they need different fixes. Score them apart.

  • Retrieval: hit rate at k. For each answerable question, was the source chunk among the top k results? This one number tells you whether the model ever had a chance. Track k = 3, 5 and 10.
  • Retrieval: rank of the first right chunk. Mean reciprocal rank shows whether the right chunk comes first or is buried at position nine behind near-duplicates.
  • Generation: answer correctness. Given the right chunk, does the answer match the reference? Judge with a person on the first pass. Use a model as judge only after you have checked its verdicts against yours on a sample.
  • Refusal accuracy. On unanswerable questions, how often does the system say the documents do not cover it?
def hit_rate_at_k(eval_rows, retrieve, k=5):
    answerable = [r for r in eval_rows if r["answerable"]]
    if not answerable:
        raise ValueError("Need at least one answerable question to measure hit rate")
    hits = 0
    for row in answerable:
        results = retrieve(row["question"], top_k=k)       # your retriever
        if any(chunk.doc == row["source"]["doc"] and
               chunk.section == row["source"]["section"]
               for chunk in results):
            hits += 1
    return hits / len(answerable)
Retrieval hit rate at k: a few lines, no framework needed (illustrative).

If hit rate at 5 is low, stop. Changing the prompt or the model cannot fix a retriever that never surfaces the evidence.

05

A failure taxonomy to tag every miss

An average score hides the useful part. Tag each failed question with one cause, then count the causes.

  • Not retrieved: the right chunk was never in the top k. Look at chunking and embeddings.
  • Split across chunks: the answer needs text that chunking separated, often a table row from its header.
  • Retrieved but ignored: the chunk was present and the model still answered wrongly. Look at the prompt and context length.
  • Outdated source won: an old document outranked the current one.
  • Should have refused: the corpus had no answer and the system invented one.
  • Extraction error: the text was wrong before retrieval ever ran, as with a scanned page or a mangled table.

The counts tell you what to fix first, and they give the client an honest picture of where the system is weak.

06

Chunking, embeddings and hybrid search: change one thing at a time

Re-run the same question set after each change, and change only one variable per run. Otherwise you cannot tell which edit helped. Typical levers, in the order they usually pay off:

  • Split on document structure (headings, clauses, table boundaries) before falling back to fixed sizes.
  • Keep a short title or heading path with each chunk so an isolated paragraph still says what it belongs to.
  • Add keyword search (BM25) next to vector search. Exact identifiers, part numbers and clause numbers are where pure embeddings tend to miss.
  • Add a re-ranking step over the top results once hit rate at 10 is good but at 3 is not.
  • Store dates and document versions as metadata and filter on them, so superseded documents cannot outrank current ones.
07

What I report

Report correct answers over answerable questions, correct refusals over unanswerable questions, and the categories where retrieval fails (document types, topics, formats). Include counts as well as percentages: four correct answers out of five is far less evidence than four hundred out of five hundred. List the corpus snapshot, model and embedding identifiers, retrieval settings, grader and prompt version. This is the report format I recommend for a scoping conversation; the blank workflow is not evidence of a particular client result.

08

Limitations of this guide

It covers single-corpus, English-language retrieval QA. Agentic RAG, multi-corpus routing, multilingual retrieval and fine-tuning trade-offs each need their own treatment.

09

Frequently asked questions

What accuracy is "good enough"?

Depends entirely on the cost of a wrong answer. Internal search tolerates misses a compliance answer can't. I report measured performance plus failure categories, and the business decides whether the number is acceptable — that decision shouldn't be made by the team building it.

Do I need a fine-tuned model?

Diagnose the failure first. If relevant evidence is not retrieved, tuning the generator is the wrong first change. Compare extraction, chunking, retrieval and answer generation separately; consider fine-tuning only when the evaluation shows a problem it can address.

How big should the evaluation set be?

Start with a small, manually checked set covering document types and known failure modes. Fifty questions can be a useful starting point, not a statistically reliable universal threshold. Expand it, keep a held-out set and report the sample size with each result.

Can I use an LLM to judge the answers?

Yes, after you validate it. Grade a sample by hand, let the model grade the same sample, and compare. If they disagree often, the automated score is not trustworthy yet. Always keep a human pass on the failures.

Should I add a re-ranker?

Add one when the right chunk is usually in the top ten but not the top three. If it is not in the top ten, a re-ranker has nothing to promote, and chunking or search needs the work.

How often should the evaluation be re-run?

On every change to chunking, embeddings, the retriever or the prompt, and whenever the corpus changes meaningfully. A fixed question set makes each run a quick comparison instead of a new investigation.

Primary documentation

Use the documentation for the versions you deploy; the examples above are explanatory sketches, not a version-pinned application.

RAG demo that won't survive the real corpus?

Tell me about the documents and the questions users actually ask.