Back to guides

GUIDE / ai evals

How to Measure RAG Accuracy

Learn how to measure RAG accuracy with retrieval metrics, faithfulness, answer correctness, datasets, diagnostic grids, and a practical evaluation checklist.

By The Testing AcademyPublished July 9, 2026Updated July 9, 202615 min read

Private knowledge bots fail in layers: the right file never indexes, chunking splits the fact, the retriever ranks noise first, or the model ignores good context and invents a confident wrong answer. How to measure RAG accuracy means exposing which layer broke with retrieval and generation metrics, not a single chat transcript score.

This guide gives you a practical measurement system: define accuracy for your product, build evaluation data, score retrieval and generation, use diagnostic grids, set gates, monitor production, and avoid vanity metrics. For toolkit specifics, see RAGAS: evaluating RAG pipelines. For metric theory, see LLM evaluation metrics.

What "RAG Accuracy" Should Mean

Accuracy is not one number. For RAG products, define accuracy as a bundle:

  1. Retrieval adequacy: needed evidence is present in the context window.
  2. Grounded generation: claims are supported by that evidence (or clearly marked as general knowledge if allowed).
  3. Answer correctness: the user-facing answer solves the question.
  4. Citation integrity (if shown): citations point to real supporting passages.
  5. Abstention quality: the system refuses or asks for clarification when evidence is insufficient.

A single average score without these facets hides dangerous failures.

The RAG Error Budget

Map failures to layers:

LayerExample defectMeasurement signal
IngestionPDF table not parsedDoc-level spot checks
ChunkingFact split across chunksRetrieval of partial evidence
IndexingStale embeddings after doc updateFreshness tests
Query transformBad rewrite loses entityRetrieval miss on multi-hop
RetrievalWrong neighborsLow recall / MRR
RerankGood doc buriedLow precision@k
PromptingIgnores contextLow faithfulness
GenerationMixes factsLow correctness
CitationWrong footnoteCitation precision fail

Your measurement plan should attribute errors, not only tally them.

Core Metrics to Measure RAG Accuracy

Retrieval metrics

Context recall
Did the retrieved set contain the information needed for the gold answer?

Context precision
Are retrieved chunks mostly relevant, or full of noise?

Recall@k / Precision@k
Classic IR metrics when you have labeled relevant doc ids.

MRR / nDCG
Ranking quality when order matters for the model context window.

Generation metrics

Faithfulness / groundedness
Are statements supported by retrieved context? See also hallucination detection.

Answer correctness
Semantic or factual match to a reference answer or checklist of required facts.

Answer relevancy
Does the answer address the question asked?

Citation accuracy
Do cited spans actually support the claims?

System metrics that affect perceived accuracy

  • Refusal rate on out-of-scope questions
  • Latency to first useful token
  • % answers with no retrieval hits that still assert facts
  • Cost per query

Diagnostic Grid (Use This Every Week)

FaithfulnessContext recallInterpretationFirst fix
HighHighHealthy baselineOptimize hard slices
HighLowAnswer may be lucky or from model memoryImprove retrieval/index
LowHighModel ignores or mangles good contextPrompt / model / constraints
LowLowCompound failureFix retrieval first, then generation

Add answer correctness as a third axis when you have gold answers.

Step-by-Step: How to Measure RAG Accuracy

Step 1: Freeze the product definition of a correct answer

Write rules:

  • Must cite internal policy docs for HR questions
  • Prices must come from catalog tables, never model memory
  • If confidence low, say "I do not have that in the knowledge base"
  • Numeric answers must match source exactly

Without rules, raters disagree forever.

Step 2: Build a measurement dataset

Each row ideally includes:

{
  "id": "hr-leave-021",
  "question": "How many paid parental leave days do full-time employees get?",
  "gold_answer": "90 calendar days for primary caregivers per Policy HR-12.",
  "relevant_doc_ids": ["hr-12-v3"],
  "required_facts": ["90 calendar days", "primary caregivers", "HR-12"],
  "topic": "hr_leave",
  "difficulty": "easy",
  "should_abstain": false
}

Sources of questions:

  • Real user logs (anonymized)
  • Support tickets
  • Doc titles turned into questions
  • Adversarial lookalikes ("unpaid leave" vs "paid leave")
  • Multi-hop questions needing two sections

Dataset design guidance: building LLM eval datasets.

Step 3: Capture full traces, not only final text

Log for each eval run:

  • Rewritten query
  • Retrieved chunk ids and scores
  • Order after rerank
  • Final prompt context
  • Model answer
  • Citations
  • Latency

You cannot measure retrieval accuracy from the answer string alone.

Step 4: Score retrieval

If you have relevant doc labels:

recall@5 = |relevant ∩ top5| / |relevant|

If you only have gold answers, use context recall style judgments (human or LLM-as-judge with passages provided) to estimate whether evidence was present.

Measure at the k you actually feed the model (for example k=5 chunks).

Step 5: Score faithfulness

Split answer into claims where possible. For each claim, check support in retrieved context.

Outcomes:

  • Supported
  • Contradicted
  • Not found in context (hallucination relative to context)

Aggregate to a faithfulness score per answer and corpus average.

Step 6: Score answer correctness

Options:

  • Required-fact checklist (highly recommended for enterprise)
  • Semantic similarity to gold answer
  • LLM judge with gold reference
  • Exact match for short factual answers

Checklist example:

Required facts present?
[ ] 90 calendar days
[ ] primary caregivers
[ ] references HR-12 or equivalent
Incorrect extras?
[ ] claims 120 days
[ ] applies to contractors incorrectly

Step 7: Score abstention and out-of-scope

Include questions the KB cannot answer. Correct behavior may be refusal. Answering fluently from world knowledge can be a failure for enterprise RAG.

Metrics:

  • Correct abstention rate
  • False abstention rate (refused though docs contain answer)
  • Hallucinated answer rate on OOS

Step 8: Slice results

Overall 87% correctness can hide:

  • 60% on finance policies
  • 40% on scanned PDFs
  • 95% on short FAQs

Slice by topic, doc type, difficulty, language, and recency.

Example release gates:

context_recall >= 0.85 on smoke set
faithfulness >= 0.90
answer_correctness >= 0.88
oos_hallucination <= 0.02
p95_latency <= budget

Never ship a retrieval rewrite based only on a demo question.

Step 10: Monitor production accuracy proxies

  • User thumbs down rate
  • Citation click-through then correction
  • Human agent edits after bot draft
  • Freshness lag between doc publish and answer correctness
  • Sampled weekly audits

Offline and online measurement both matter.

Worked Example: Policy Assistant

Dataset: 120 questions across HR, security, and expense policies.

Baseline pipeline scores:

MetricBaselineAfter chunk fixAfter prompt fix
Context recall@50.710.860.86
Context precision@50.640.780.78
Faithfulness0.810.830.93
Answer correctness0.740.840.90
OOS hallucination rate0.080.070.02

Story: chunking improved retrieval and correctness. Prompt/grounding rules improved faithfulness and reduced OOS hallucinations. Measuring only final correctness would have missed which change did what.

Comparison: Metric Choices by Product Risk

ProductMinimum accuracy bundle
Internal FAQCorrectness + abstention
Customer support assistantCorrectness + faithfulness + handoff
Regulated policy botFaithfulness + citations + abstention + audit trail
Commerce catalog botNumeric exactness + freshness
Developer docs botCode snippet correctness + version pinning

Implementing Measurement in CI

docs change -> reindex staging -> run RAG eval suite -> publish report
prompt change -> run suite without full reindex when possible
embedding model change -> full retrieval + generation suite

Pseudo-test:

def test_rag_smoke_thresholds(eval_client, smoke_set):
    report = eval_client.run(smoke_set)
    assert report.context_recall >= 0.85
    assert report.faithfulness >= 0.90
    assert report.answer_correctness >= 0.88
    assert report.oos_hallucination_rate <= 0.02

Use frameworks such as Ragas where they fit, but keep ownership of labels and thresholds. Toolkit guide: ragas-rag-evaluation.

Human vs Automatic Measurement

ApproachStrengthWeakness
Human claim checkingHighest trustExpensive
LLM judge faithfulnessScalesNeeds calibration
Exact fact checklistPrecise for known fieldsBrittle if facts reformulated without normalization
Embedding similarityCheap semantic signalCan miss critical numeric errors

Combine: checklists for critical facts, automatic faithfulness for breadth, humans for calibration and incidents.

Data Freshness: The Hidden Accuracy Killer

RAG accuracy collapses when indexes lag documents.

Add freshness tests:

  1. Publish a unique canary sentence to a doc in staging.
  2. Wait for indexing SLA.
  3. Ask a question only that sentence answers.
  4. Expect retrieval hit and correct answer before SLA deadline.

Track time-to-correct-answer after doc updates as an operational accuracy metric.

Multi-Hop and Reasoning Questions

Simple FAQ metrics overstate quality. Include questions needing two chunks:

Q: Can contractors in Germany expense home internet under the 2026 policy?

May require contractor policy + regional addendum. Measure whether both docs appear and whether the final constraint is correct.

Checklist: RAG Accuracy Measurement Ready?

  • Correctness rules written
  • Dataset with gold answers or required facts
  • Relevant docs labeled where possible
  • Traces store retrieved chunks
  • Retrieval metrics at production k
  • Faithfulness scored
  • Answer correctness scored
  • OOS / abstention set included
  • Slices by topic and doc type
  • CI thresholds defined
  • Freshness canary exists
  • Weekly human audit scheduled

Common Mistakes When Measuring RAG Accuracy

Mistake 1: Only scoring final BLEU/ROUGE against a single reference

Open-ended phrasing varies. Critical facts matter more than n-gram overlap.

Mistake 2: Measuring generation while blind to retrieval

You will tune prompts forever while the index is wrong.

Mistake 3: Celebrating faithfulness on empty context

If nothing relevant was retrieved, "faithful" short answers may still fail users. Track joint conditions.

Mistake 4: No out-of-scope set

World-knowledge answers look accurate in demos and violate enterprise grounding.

Mistake 5: One global score for all document types

PDFs, tables, and HTML fail differently. Slice them.

Mistake 6: Stale datasets after policy changes

Gold answers must update with docs or accuracy becomes nonsense.

Mistake 7: Ignoring citation quality

Users trust footnotes. Wrong citations are accuracy defects.

Mistake 8: No production sampling

Offline sets drift from live questions. Sample continuously.

Building Gold Labels Without Boiling the Ocean

Teams stall because they think every answer needs a perfect essay reference. You have better options.

Required-fact labels

List atomic facts that must appear. Scoring becomes checklist precision/recall style and tolerates phrasing differences.

Span-level support labels

Highlight the doc spans that justify the answer. Useful for citation and faithfulness work.

Document-id relevance labels

Mark which docs are relevant even if you do not write a full gold answer. Enables classical IR metrics quickly.

Hybrid rows

Easy questions get full gold answers. Hard long-form questions get required facts only. Out-of-scope questions get should_abstain=true and no gold answer body.

Labeling guidelines should include edge cases: conflicting docs, partially updated policies, and "depends on employee type" answers.

Chunking Experiments as Accuracy Experiments

Chunk size and overlap are not cosmetic. They change accuracy.

Run controlled A/Bs:

ConfigContext recallFaithfulnessCorrectnessNotes
300 tokens, 0 overlap0.720.900.78Splits procedures
800 tokens, 100 overlap0.860.890.88Better procedures
1200 tokens, 100 overlap0.870.840.85More noise in context

Pick configs from measured tradeoffs, not blog defaults. Re-run when document types change (for example, adding many wide tables).

Tables, PDFs, and Other Hostile Formats

Accuracy often collapses on:

  • Multi-column PDFs
  • Scanned images without OCR quality checks
  • HTML pages with nav chrome indexed as content
  • Spreadsheets exploded into meaningless cell chunks

Create a dedicated slice in your dataset for hostile formats. If that slice is weak, invest in parsing, not only prompt poetry.

Canary test for OCR:

  1. Insert a unique alphanumeric token into a scanned doc.
  2. Ensure OCR/index pipeline captures it.
  3. Ask a question requiring that token.
  4. Fail the pipeline if retrieval misses.

Query Transformation Measurement

Modern RAG rewrites user questions, expands synonyms, or generates sub-questions. Measure those steps:

  • Does rewrite preserve critical entities (order ids, product SKUs)?
  • Do multi-query expansions improve recall@k without destroying precision?
  • Does hypothetical document embedding help your corpus or only public web-like data?

Log both raw and rewritten queries in eval traces. Many "model" failures are rewrite failures.

Reranking and Context Window Budget

If you retrieve 20 chunks and keep 5, your accuracy depends on the reranker.

Tests:

  • Gold chunk present in top 20 but missing after rerank (reranker regression)
  • Gold chunk present but truncated out of the prompt packing budget
  • Packing prefers diversity vs similarity incorrectly for multi-hop questions

Track "evidence present pre-rerank" vs "evidence present post-rerank" vs "evidence present in final prompt." That three-stage funnel shows where accuracy leaks.

User-Facing Accuracy vs Internal Metrics

Internal faithfulness might be high while users still dislike answers that are technically grounded but incomplete. Include task success rubrics for user goals, not only claim support.

Conversely, users may thumbs-up a fluent wrong answer. That is why online thumbs cannot be your only accuracy metric. Pair them with sampled audits and offline gold sets.

Governance: Who Can Change What

Write a lightweight RACI:

  • Who edits the production index schema?
  • Who approves embedding model changes?
  • Who updates gold answers after policy edits?
  • Who can waive an eval gate in an emergency?

Unowned measurement programs eventually become ignored dashboards. Ownership keeps accuracy real.

Incident Response Using Accuracy Tooling

When production reports a wrong answer:

  1. Capture question, answer, retrieved chunks, doc versions.
  2. Label the failure layer with the diagnostic grid.
  3. Add the case to the golden set.
  4. Add a regression test if it is deterministic enough.
  5. Only then ship the fix.

This turns incidents into permanent measurement assets.

End-to-End Example: From Question to Metric Line

Question: "What is the return window for opened headphones bought online?"
Gold required facts: 15 days from delivery; opened items eligible if undamaged; cite Returns Policy v4
Retrieved: shipping FAQ (irrelevant), Returns Policy v3 (stale), accessories policy

Scores:

  • context_recall: low (missing v4)
  • context_precision: low (noise)
  • faithfulness: medium (answer sticks to v3 but that content is outdated)
  • answer_correctness: fail vs current policy
  • citation accuracy: fail if UI shows v3 as current

Root cause: index freshness and ranking, not prompt tone. The fix is reindexing and deprecating v3, then remeasuring. Without layered metrics, a team might have rewritten the system prompt uselessly.

Choosing Thresholds Without Self-Delusion

Thresholds should come from:

  1. Current baseline on a trusted dataset
  2. Severity of errors below the line
  3. Cost of false release blocks
  4. Human-audited acceptance samples

If you set faithfulness >= 0.99 on a noisy corpus, you will ignore the gate. If you set correctness >= 0.60 for a medical-adjacent assistant, you are accepting unacceptable risk. Align thresholds with product harm, then revisit quarterly.

Communicating RAG Accuracy Without Hype

Avoid slogans like "our bot is 95% accurate" without definitions. Prefer precise statements:

On the 150-question July policy set, answer correctness was 90%,
faithfulness 0.93, context recall@5 0.86. Finance slice correctness was 81%.
Out-of-scope hallucination rate was 2%.

That statement is auditable. It also invites better questions: which finance docs fail, and is 81% acceptable for that risk class?

When leadership wants a single KPI, offer a weighted composite only if weights are published and safety metrics remain hard gates outside the composite.

Minimal Weekly Operating Rhythm

A sustainable accuracy program is boring on purpose:

  • Monday: review overnight eval diffs from deploys
  • Wednesday: label ten new production failures into the golden set
  • Friday: human audit sample and update threshold notes if needed

The rhythm matters more than any single metric library. Teams that only measure during crises always rediscover the same retrieval bugs under pressure. Teams that measure weekly catch silent index drift before customers do.

If you can only staff one role, assign a rotating "RAG accuracy owner" for the week with clear handoff notes. Continuity of measurement is part of accuracy itself. A short handoff should list open metric regressions, dataset edits in flight, and any waived gates with expiry dates so waivers do not become permanent blind spots. Expired waivers should automatically re-enable the original threshold unless someone re-approves them with a new expiry. Store waiver history so you can see whether the same gate is waived repeatedly, which usually means the threshold or the product risk model needs a real product decision rather than quietly stacking temporary exceptions forever.

Practice Path

Build a 30-question RAG set for a small doc folder, compute recall@k and a required-fact correctness score, then break chunk size on purpose and remeasure. Practice diagnostic thinking in QABattle or sign up to work through AI eval tracks.

Summary

To master how to measure RAG accuracy, measure retrieval and generation together, attribute failures by layer, use required facts and faithfulness rather than vibes, gate releases on thresholds, and keep datasets aligned with live documents. Accuracy is a system property of indexing, retrieval, and generation, not a single chat transcript.

Deepen toolkit skills with RAGAS, metric selection with LLM evaluation metrics, and hallucination-focused testing with hallucination detection. Then keep measuring every time the knowledge or the model moves.

FAQ

Questions testers ask

How do you measure RAG accuracy?

Measure both retrieval and generation: context recall/precision for retrieved chunks, faithfulness for groundedness, and answer correctness or task success against references. Use a labeled dataset, diagnose which layer fails, and track scores over versions in CI and production sampling.

What is the difference between retrieval accuracy and answer accuracy in RAG?

Retrieval accuracy asks whether the right evidence was fetched. Answer accuracy asks whether the final response is correct for the user. You can retrieve well and still answer poorly, or answer correctly from parametric memory while retrieval is weak, which is risky for enterprise grounding.

Which metrics are commonly used for RAG accuracy?

Common metrics include context precision, context recall, MRR/nDCG for ranking, faithfulness, answer relevancy, exact match or semantic correctness vs gold answers, citation accuracy, and end-task success. Toolkits like Ragas implement several of these patterns.

How large a dataset do you need to measure RAG accuracy?

Start with a high-quality set of real questions paired with sources or gold answers, often 50-200 for an MVP gate, then expand with hard cases and production failures. Balanced coverage of topics and difficulty matters more than raw size alone.

Can faithfulness alone prove RAG accuracy?

No. Faithfulness checks support from retrieved context, but the context can be wrong or incomplete, and a faithful answer can still miss the user question. Pair faithfulness with retrieval metrics and answer correctness.

How often should RAG accuracy be remeasured?

Remeasure on every change to indexes, chunking, embeddings, prompts, or models, plus scheduled runs when documents change. Production sampling should run continuously with periodic human audits.