Last updated: Aug 20, 2026

RAG Evaluation Metrics That Matter

Dan Lee, JoinAI Founder · AI Tech Lead

JoinAI Founder · AI Tech Lead

Aug 20, 20265 min read
RAG Evaluation: Metrics for Retrieval and Answer Quality

A RAG system can return a wrong answer for at least two independent reasons: it retrieved the wrong evidence, or it generated a bad answer from good evidence. One end-to-end score cannot tell you which component to fix.

The useful evaluation model is therefore a pipeline:

Text
question → retrieval → context → generation → final answer
↑ ↑
retrieval metrics answer metrics

This guide turns that pipeline into a test plan. If you are still deciding whether retrieval is the right architecture, start with RAG vs fine-tuning vs long context.

Evaluate four different relationships

The cleanest RAG scorecard compares four pairs:

EvaluationComparisonQuestion answered
Retrieval relevanceretrieved documents vs user questionDid we fetch material about the request?
Context coverageretrieved documents vs reference evidenceDid we fetch enough evidence to answer?
Groundednessanswer vs retrieved documentsDoes the answer stay within the evidence?
Answer correctnessanswer vs reference answerIs the final answer actually right?

Add answer relevance—answer versus user question—when systems tend to produce correct but unhelpful tangents.

These dimensions should remain separate. A grounded answer can still be wrong when the retrieved document is outdated. A correct answer can be ungrounded when the model relied on prior knowledge rather than the supplied evidence.

Build a dataset that exposes retrieval failures

Start with real questions, not a list generated entirely from the same documents the system indexes. Document-derived questions tend to use the source vocabulary and make retrieval look easier than it is.

For each test case, capture:

JSON
{
"question": "Can contractors access the production analytics workspace?",
"reference_answer": "Only after security approval and time-limited access is granted.",
"relevant_document_ids": ["access-policy-v4"],
"relevant_passages": ["Contractor access requires..."],
"category": "permissions",
"difficulty": "multi_condition"
}

Include the cases that polished demos omit:

  • questions using customer vocabulary instead of document vocabulary;
  • answers split across multiple documents;
  • outdated documents that should lose to newer versions;
  • questions with no answer in the corpus;
  • ambiguous questions that require clarification;
  • authorization-sensitive questions where the user must not retrieve certain evidence.

Twenty carefully reviewed cases are more useful than 2,000 synthetic cases nobody has inspected. Expand the dataset from production failures after the first release.

Retrieval metrics that reveal different problems

Recall at K

Recall@K asks whether at least one required document or passage appears in the first K results. It is the right first metric when missing evidence is the dominant failure.

Text
Recall@K = relevant items retrieved in top K / relevant items available

High recall with poor answer quality points toward generation, context ordering, or noisy retrieval. Low recall means prompt tuning cannot rescue the system consistently.

Precision at K

Precision@K measures how much of the retrieved set is relevant. Low precision wastes context and can distract the generator.

Text
Precision@K = relevant items retrieved in top K / K

Do not maximize precision blindly. Returning one relevant passage produces perfect precision and may omit evidence required for a multi-document answer.

Mean reciprocal rank

Reciprocal rank rewards placing the first relevant result near the top. It matters when the model or UI weights early results heavily.

Text
RR = 1 / rank of first relevant result

Average reciprocal rank across the dataset to get MRR. Use it alongside recall rather than as a replacement.

Context coverage

Document relevance is not enough for questions requiring several facts. Context coverage scores how many reference claims have supporting evidence in the retrieved set.

For a reference answer with four required claims, retrieving evidence for three yields 75% coverage—even when every returned passage is individually relevant.

Answer metrics that should not be collapsed

Groundedness

Break the answer into factual claims, then determine whether each claim is supported by the retrieved context.

Text
Groundedness = supported answer claims / factual answer claims

An LLM judge can scale this check, but calibrate it against human labels. Require the judge to return the claim, supporting passage, and verdict so reviewers can audit disagreements.

Correctness

Compare the generated answer with the reviewed reference answer. Exact string matching works for IDs and structured values. Semantic grading works better for prose, provided the rubric defines which claims are required and which errors are critical.

Answer relevance

Check whether the answer directly resolves the user's request. This catches evasive responses, unnecessary background, and answers to a nearby question.

Refusal quality

For unanswerable questions, the desired output may be a refusal, a clarification request, or an explicit statement that the corpus lacks evidence. Score that behavior separately. A system that invents an answer should not receive credit merely because the response sounds relevant.

Diagnose with a metric matrix

RetrievalGroundednessCorrectnessLikely diagnosis
LowLowLowRetrieval is the first bottleneck
HighLowLowGenerator ignores or misuses evidence
HighHighLowEvidence is incomplete, stale, or reference is wrong
HighHighHighHealthy path; inspect latency and cost next
LowHighHighModel may be answering from prior knowledge

This matrix prevents the common response to every failure: changing the prompt.

Run offline and online evaluation differently

Offline evaluation uses a curated dataset before release. Run it when changing:

  • embedding models;
  • chunking or metadata filters;
  • top-K and reranking;
  • prompt or model versions;
  • document parsers;
  • index contents.

Online evaluation samples production traces. It is best for groundedness, answer relevance, citation validity, user corrections, and emerging query categories. Production feedback should create new offline cases, closing the loop described in the LLM observability guide.

A release gate that teams can operate

Define thresholds per category, not just globally. A 92% average can hide a serious failure in permissions or billing questions.

Example release policy:

Text
- No critical authorization case may regress.
- Recall@5 must not fall by more than 2 percentage points.
- Groundedness must remain above 95% on policy questions.
- Unanswerable-question refusal accuracy must remain above 90%.
- P95 latency and cost per successful answer must stay within budget.

Always inspect the changed examples. A score tells you that behavior moved; the examples tell you whether the evaluator or the application is wrong.

RAG evaluation checklist

  • Retrieval and generation receive separate scores.
  • Dataset cases include relevant document and passage identifiers.
  • No-answer, stale-content, and multi-document cases are represented.
  • Automated graders are calibrated against human labels.
  • Results are segmented by question category and difficulty.
  • Index, embedding, chunking, prompt, and model versions are recorded.
  • Production failures become regression cases.
  • Release thresholds include quality, latency, and cost.

Sources and further reading

Build better AI systems

One practical engineering lesson in your inbox each week.

JoinAI Premium

Go from reading to shipping

Get guided learning, hands-on AI engineering projects, and premium practice.

Explore Premium
Dan Lee, JoinAI Founder · AI Tech Lead

About the author

JoinAI Founder · AI Tech Lead

Dan Lee is the founder of JoinAI and an AI tech lead with more than 10 years of industry experience across data engineering, machine learning, and applied AI. He previously worked as an engineer at Google.