RAG evaluation means scoring a retrieval-augmented generation system in two stages: whether retrieval returned the right passages, and whether the model’s answer used them well. The OpenAI Cookbook splits it the same way, into retrieval evaluation (accuracy and relevance of what was retrieved) and response evaluation (quality of the answer given that information). The metrics below are grouped by stage so a bad answer can be traced to retrieval or generation.

Why two stages

LangSmith’s docs say to evaluate the retrieval step to ensure the correct documents are retrieved for the query, and the generation step to ensure the correct answer is generated from those documents. Its example uses a plain custom evaluator for retrieval and an LLM-based one for generation.

The original Ragas paper lists the same dimensions: the retriever’s ability to find relevant and focused passages, the model’s ability to use them faithfully, and the quality of the generation itself. The paper presents Ragas as a framework for reference-free evaluation, meaning no human-written ground truth is required. It is a 2023 preprint, revised in April 2025.

Retrieval metrics

MetricWhat it asksNeedsSource
Hit rateIn what share of queries is a correct passage in the top k?Expected passage IDsOpenAI Cookbook
MRRHow high does the first relevant passage rank, averaged over queries?Expected passage IDsOpenAI Cookbook
Context recallWas anything important left out?A referenceRagas
Context precisionAre relevant chunks ranked above irrelevant ones?Reference answer, reference contexts or IDs, or none (a variant compares against the response)Ragas
Retrieval relevanceAre the retrieved documents relevant to the question?No referenceLangSmith

The OpenAI Cookbook defines hit rate as “the fraction of queries where the correct answer is found within the top-k retrieved documents”. MRR is the average of the reciprocal ranks, so a first relevant result at rank 1 scores 1 and at rank 2 scores 1/2. LlamaIndex computes both by comparing what was retrieved for a query with a set of expected node IDs.

Ragas says that context recall “always requires a reference”. To avoid annotating reference passages, its LLM-based version uses the reference answer as a proxy: it breaks the answer into claims and checks which ones the retrieved context supports. Ragas also documents non-LLM and ID-based variants of context precision, which compare retrieved chunks with reference contexts directly.

Anthropic reported in September 2024 that it used “1 minus recall@20” as its retrieval metric, the percentage of relevant documents that fail to be retrieved within the top 20 chunks. The choice of k is part of the metric, so it is worth matching to the number of passages the generator actually receives.

Generation metrics

MetricWhat it asksNeedsSource
Faithfulness (groundedness)Is every claim in the answer supported by the retrieved context?No referenceRagas, LangSmith
Answer relevanceDoes the answer address the question?No referenceRagas, LlamaIndex
CorrectnessDoes the answer match a reference answer?A reference answerLangSmith
Noise sensitivityHow often is the answer wrong when it uses relevant or irrelevant passages?A reference answerRagas

Ragas defines faithfulness by listing the claims in the response, checking whether each can be inferred from the retrieved context, and dividing supported claims by total claims. A response is faithful “if all its claims can be supported by the retrieved context”. LlamaIndex offers a FaithfulnessEvaluator for the same check, aimed at responses free from hallucinations.

Faithfulness and relevance measure different things. Ragas states that answer relevancy works “without evaluating factual accuracy”: it generates questions from the response and compares their embeddings with the original question. LangSmith makes the same point that without a reference answer you cannot score accuracy, but you can still score whether the answer addressed the question.

Ragas credits the noise sensitivity metric to RAGChecker and scores it from 0 to 1, where lower is better.

What needs a reference answer

LangSmith advises starting with one question: does each example have a reference answer? With references, score correctness against them. Without, use reference-free checks of document relevance, answer faithfulness and helpfulness. It adds that reference-free prompts can run online against live traffic, while prompts that need a reference run offline on a dataset.

Without ground truth, groundedness, answer relevance and retrieval relevance can still be scored. Correctness and context recall cannot.

Frameworks compared

FrameworkWhat its own docs or paper say it coversJudgeStatus or source
RagasContext precision, context recall, noise sensitivity, response relevancy, faithfulness and moreLLM based metrics, plus non-LLM variants for someMetric list
ARESContext relevance, answer faithfulness, answer relevanceLightweight LM judges fine-tuned on synthetic data, corrected with a small set of human labelsPaper, NAACL 2024 per arXiv
RAGCheckerDiagnostic metrics for both retrieval and generationSee paperPreprint, marked “Under Review” on arXiv
LangSmithCorrectness, relevance, groundedness, retrieval relevanceLLM-as-judge promptsTutorial
LlamaIndexHit rate and MRR for retrieval; faithfulness, answer relevancy and context relevancy for responsesLLM evaluators; retrieval metrics compare with expected IDsDocs

ARES describes its method as creating its own synthetic training data to fine-tune judges, then using a small set of human-annotated datapoints for prediction-powered inference to reduce prediction errors. The authors report accurate evaluation with only a few hundred human annotations. RAGChecker’s authors report that their metrics correlate better with human judgments than other metrics, a claim from a preprint that has not been confirmed as peer reviewed.

Names overlap but definitions differ. Ragas answer relevancy is an embedding similarity between the question and questions generated from the answer. LlamaIndex scores answer relevancy from 0 to 1 with a judge LLM answering two questions worth one point each. Scores from different tools are not comparable.

A workable loop

The Ragas guide lays out five steps:

  1. Create an evaluation dataset from real queries from your system, or generate synthetic data with LLMs.
  2. Define a few simple metrics aligned with the use case.
  3. Run a baseline and analyze error patterns to find systematic failures.
  4. Improve retrieval (chunking, hybrid search), generation (prompts, models), or try agentic approaches.
  5. Compare against the baseline and change one thing at a time.

For the dataset, The OpenAI Cookbook uses LlamaIndex’s generate_question_context_pairs module that crafts questions from your own chunks, which yields expected passages for retrieval metrics.

Check the judge

Most generation metrics above use a model to score another model. LangSmith says LLM-as-judge evaluators work well for RAG because they can score factual accuracy and consistency between texts, and ARES pairs its judges with human annotations to catch their errors. The same rule applies to any framework: label a sample by hand and compare. How to do that is covered in What is LLM as a judge?.

When the system is an agent that decides when to retrieve, the retrieval step is one of several tool calls to evaluate. See How to evaluate an AI agent. For how retrieved content competes for space in the prompt, see What is context engineering?.

For a wider catalogue of RAG datasets and evaluation frameworks, a 2025 survey compiles and categorizes them. It is a preprint with no peer review stated on its abstract page.