Skip to content
Goal: Proficient✓ Sources verified 2026-11-24Recall@kFaithfulnessRagas

RAG Evaluation: Turning "Is It Good?" into Numbers ​

Core concepts ​

Evaluate RAG in two stages, otherwise you can't tell whether a problem lies in retrieval or in generation:

StageMetricMeaning
RetrievalRecall@kWhether the chunk containing the reference answer appears in the top k results
RetrievalMRRThe rank of the correct chunk (the higher the better)
GenerationFaithfulnessWhether the claims in the answer are supported by the retrieved context (i.e. no hallucination)
GenerationAnswer relevancyWhether the answer is on topic
End to endHuman-judged accuracyWhether the answer is right from the end user's point of view

How it works ​

  • Retrieval metrics need "question → correct chunk" labels: label them by hand, or have an LLM generate questions from chunks (synthetic data) and then spot-check by hand.
  • Lost in the Middle: Liu et al. 2023 found that models make poorer use of information in the middle of a long context, so a bigger top-k isn't always better; put important chunks at the start or end.
  • Frameworks such as Ragas use an LLM to compute metrics like faithfulness and context precision / recall automatically. This is still LLM-as-judge at heart and needs human spot checks for calibration.

In practice: a minimal retrieval evaluation ​

python
def recall_at_k(results: list[list[int]], gold: list[set[int]], k: int) -> float:
    hit = [bool(set(r[:k]) & g) for r, g in zip(results, gold)]
    return sum(hit) / len(hit)

# Compare three configs: vector only / hybrid / hybrid + rerank
for name, retriever in CONFIGS.items():
    res = [retriever(q) for q in questions]
    print(name, "R@5=", recall_at_k(res, gold, 5), "R@20=", recall_at_k(res, gold, 20))

Example output table (the numbers are placeholders; use your own data):

ConfigRecall@5Recall@20P95 latency
Vector only???
Hybrid (RRF)???
Hybrid + rerank???

Common pitfalls ​

  1. Only evaluating end to end: you can't tell whether the right chunk wasn't retrieved, or was retrieved but not used well.
  2. Synthetic questions that are too easy: questions an LLM generates from a chunk tend to reuse the chunk's wording, which overestimates vector search.
  3. An eval set that never gets updated: keep adding real user questions and failure cases from production.

Common interview questions ​

  1. RAG results are poor. How do you tell whether it's a retrieval problem or a generation problem?
  2. How is Recall@k calculated? Where does the evaluation data come from?
  3. What is faithfulness? How do you evaluate it automatically, and what are the limits?
  4. What does Lost in the Middle imply for RAG design?

How it relates to my projects ​

  • AI Document Review Pipeline W4: use the table above to compare three retrieval configs and put it in the README, so there is real data to talk about in interviews.

Sources ​

Vin Amory · AI development × content creation · Technical notes cite official docs in each page’s sources section