Skip to content

RAG evaluation: retrieval and answer quality

Separate the two halves of RAG quality so you know whether to fix retrieval or generation.

7 MIN READUPDATED 2026-11-18RAG & knowledge
ORIGINAL DIAGRAM · RETRIEVAL FLOWQUERYuser inputEMBEDvectorVECTOR STOREchunksRERANKtop-kLLMgroundedCITED ANSWERsource-linked

Original rag diagram — not a copied image

§ 01Key concepts
Recall@kWhether the relevant passage appears in the top k retrieved results.
FaithfulnessWhether every claim in the answer is supported by retrieved content.
Answer relevanceWhether the answer actually addresses the question.
§ 02When to use
  • Users report confident but wrong answers.
  • You are changing chunking, embeddings or prompts.
  • Before a model or index migration.
§ 03How it works
  1. 01Build a labelled set of queries with known source passages.
  2. 02Measure retrieval recall@k before touching the prompt.
  3. 03Score answers for faithfulness and relevance with judges plus spot checks.
  4. 04Track regressions per change with the same evaluation set.
§ 04Use cases & scenarios

Policy migration without regressions

Context
A knowledge base is re-indexed with new chunking rules.
Problem
Answer quality appears to drop but the cause is unclear.
Approach
Measure recall at 10 against labelled chunk IDs, then score faithfulness separately.
Outcome
The team knows whether to fix ingestion or the generation prompt.

Out-of-scope questions

Context
Users ask the assistant questions the documents cannot answer.
Problem
The model produces confident answers from thin air.
Approach
Include no-answer cases in the eval set and measure abstention.
Outcome
Fewer confident wrong answers and a measurable refusal rate.
§ 05Examples

A labelled evaluation case

json
{
  "query": "What is the return window for a leased device?",
  "expected_chunk_ids": ["policy-returns-v3-2"],
  "must_cite": true,
  "answer_contains": ["14 days"],
  "no_answer_expected": false
}

Version the eval set with the index and include no-answer cases so abstention is measured too.

Report the two halves separately

text
recall@10:      0.92   # evidence was retrieved
faithfulness:   0.61   # answer supported by that evidence
-> fix the generation prompt, not the index

If recall is low, fix ingestion and retrieval first; a better prompt cannot cite a passage that was never found.

§ 06Trade-offs

Human evaluation

Up: Highest trust

Down: Slow and expensive

LLM-as-judge

Up: Scalable and fast

Down: Needs calibration against human ratings

Exact-match metrics

Up: Cheap

Down: Poor fit for open-ended answers

§ 07Implementation checklist
  • Keep retrieval and generation metrics separate.
  • Include adversarial and no-answer queries.
  • Version the evaluation set with the index.
  • Sample judge results for human review.
§ 08Configuration reference
KeyTypical valueNote
eval_set_size50–200Cover common and edge queries.
recall_at5 / 10Report both.
judge_modelpinnedCalibrate against human labels.
§ 09Troubleshooting
SymptomCauseFix
Answers wrong but sources rightGeneration or prompt issueFix instructions and grounding, not retrieval.
Metrics improve, users disagreeEvaluation set not representativeAdd real queries and re-label.
§ 10Frequently asked questions

What metric matters most?

Retrieval recall first: if the evidence is not retrieved, generation cannot be correct.

Can an LLM grade answers?

Yes, as a scaled approximation. Calibrate it against human judgements and review samples regularly.

More in RAG & knowledge