Enterprise AI Operations

RAG Evaluation: Metrics, a Practical Framework and Open-Source Tools for Retrieval and Generation

A working guide to RAG evaluation: the retrieval metrics (recall@k, precision@k, MRR, nDCG, context precision and recall) and generation metrics (faithfulness, answer relevance, citation accuracy) that matter, how to build an evaluation dataset, where LLM-as-judge scoring goes wrong, how Ragas, TruLens, DeepEval, Arize Phoenix, LangSmith and ARES compare, and how to run the whole loop offline or on-premises. Tool documentation and licences checked on 29 October 2026.

RAG evaluation measures a retrieval-augmented generation system in two halves. Retrieval metrics (recall@k, precision@k, MRR, nDCG, context precision and context recall) tell you whether the right passages were found and ranked well. Generation metrics (faithfulness or groundedness, answer relevance and citation accuracy) tell you whether the answer stays within those passages and addresses the question. Both are scored against a versioned set of real questions, often with an LLM as judge, which needs calibrating against human labels. Open-source tools such as Ragas, DeepEval, TruLens and Arize Phoenix compute the metrics, and all of them can be run without sending data to a cloud provider.

Why RAG evaluation splits into two halves

A wrong answer from a RAG system can have two very different causes. Either the retriever never found the passage that contained the answer, or it found it and the model ignored, misread or embellished it. The fixes are different: the first calls for changes to chunking, embeddings, hybrid search or reranking, and the second for changes to the prompt, the model or the context window. An end-to-end “was the answer right?” score cannot tell you which.

So a useful RAG evaluation framework scores each half on its own, then checks the whole. This guide covers the metrics for each half, how to build the dataset they run on, where model-based judging goes wrong, and the tools that automate the work. Two related guides go deeper on neighbouring questions: our framework for measuring private RAG accuracy focuses on the enterprise programme around evaluation, and the comparison of LLM evaluation tools covers general model and application testing beyond RAG.

RAG evaluation metrics for retrieval

Retrieval metrics compare what the retriever returned with what it should have returned. The classic information-retrieval metrics need labelled relevant passages for each question; the LLM-judged variants can work from a reference answer instead.

MetricWhat it measuresNeedsRead it as
Recall@kShare of the relevant passages that appear in the top k resultsLabelled relevant passages”Did we find what was needed?” The most important retrieval number for RAG, because a missed passage cannot be recovered later
Precision@kShare of the top k results that are relevantLabelled relevant passages”How much noise reached the model?” Low precision wastes context and invites distraction
Hit rate@kShare of questions with at least one relevant passage in the top kLabelled relevant passagesA coarse version of recall, useful for single-answer questions
MRR (mean reciprocal rank)Average of 1 / rank of the first relevant resultLabelled relevant passages”How high was the first good result?“
nDCG@kRanking quality with graded relevance, discounted by positionGraded relevance labelsRewards putting the most relevant passages first
Context precisionWhether relevant chunks are ranked above irrelevant ones, as a relevance-weighted mean of precision@kReference answer or reference contextsLLM-judged or string-matched ranking quality
Context recallWhether the retrieved context covers what the reference answer needsReference answerLLM-judged coverage when passage labels are not available

A few practical notes:

  • Choose k to match production. If the generator receives eight passages, report recall@8, not recall@20.
  • Label at the passage level where you can. Document-level labels overstate quality when the right document is retrieved but the wrong section of it.
  • Use the non-LLM variants when labels exist. Ragas, for example, documents a non-LLM context precision that compares retrieved chunks with reference contexts using string similarity, and an ID-based version that only checks whether retrieved chunk IDs appear in the reference set (checked October 2026). These are cheap, deterministic and easy to explain.
  • Test the filters. Permission filtering and metadata filters are part of retrieval. Include questions asked by users who should not see the answer, and count any leaked passage as a severe failure.

For tuning the retrieval layer itself, the guide to embedding models and rerankers explains which component usually moves which metric.

RAG evaluation metrics for generation

Generation metrics take the retrieved context as given and ask what the model did with it.

MetricWhat it checksTypical method
Faithfulness (groundedness)Every claim in the answer is supported by the retrieved contextSplit the answer into claims, check each against the context, score supported claims / total claims
Answer relevanceThe answer addresses the question that was askedJudge model compares question and answer, or generates questions from the answer and compares them with the original
Citation accuracyEach citation points to a passage that supports the sentence it is attached toCheck each sentence–citation pair; count unsupported or missing citations
Answer correctnessThe answer matches a reference answerJudge comparison, or exact and fuzzy matching for short factual answers
Refusal correctnessThe system declines when the context does not contain the answer, and answers when it doesInclude unanswerable questions in the test set and score both kinds of error

Ragas computes faithfulness exactly as described in the first row: it extracts the claims in a response, checks whether the retrieved context supports each one, and divides supported claims by total claims, giving a score from 0 to 1. TruLens frames the same ideas as its RAG triad of context relevance, groundedness and answer relevance (both checked October 2026).

Faithfulness and correctness are different things. An answer can be perfectly faithful to an out-of-date policy and still be wrong. That is a content problem, and it shows up only if your test set includes reference answers checked by someone who knows the current rule.

Citation accuracy deserves its own line in any enterprise report. Readers trust cited answers more, so a confident citation to a passage that does not say what the sentence claims is worse than no citation at all.

Building the evaluation dataset

Metrics are only as good as the questions they run on. A dataset that holds up has these properties:

  • Real questions first. Pull them from search logs, help desk tickets, chat transcripts and subject-matter experts. Synthetic questions generated from your documents are useful for coverage but tend to be easier than real ones, because they borrow the document’s own wording.
  • Reference answers and sources. For each question, record the expected answer and the passage or passages that support it. Domain experts should write or approve these.
  • Hard cases on purpose. Include multi-hop questions that need two documents, questions whose answer changed recently, questions with near-duplicate distractor documents, unanswerable questions, and permission-restricted questions.
  • Enough volume per segment. A few hundred questions spread across the main content areas gives more useful signal than thousands of near-identical ones. Report by segment, because averages hide weak areas.
  • Version control. Store the dataset with a version number, alongside the corpus snapshot it was built against. When documents change, some reference answers will need updating; track that, or scores will drift for reasons unrelated to the system.

Keep a held-out portion that nobody tunes against. Teams that optimise prompts on the full set end up measuring how well they have memorised it.

LLM-as-judge: what to watch

Most generation metrics, and the LLM-judged retrieval metrics, use a language model to score outputs. That scales, but the judge is a model with its own failure modes.

The best-known study of the approach, “Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena” by Lianmin Zheng and colleagues (2023), examined position, verbosity and self-enhancement biases, along with limited reasoning ability, and found that strong judges reached over 80% agreement with human preferences, about the level humans reach with each other. That is encouraging for broad comparisons and a warning for fine-grained scores. In practice:

  • Calibrate before trusting. Have experts label a sample of answers, run the judge on the same sample, and measure agreement. Repeat whenever you change the judge model or prompt.
  • Pin the judge. Record the judge model, version, prompt and temperature with every score. A judge upgrade can shift every number in the report.
  • Prefer claim-level checks. Asking a judge “is this claim supported by this passage?” is more reliable than asking for an overall score out of ten.
  • Avoid self-judging where possible. Using the same model to generate and to judge invites the self-enhancement bias the paper describes.
  • Use small classifiers where they fit. Ragas documents a faithfulness variant that replaces the judge LLM with Vectara’s HHEM-2.1-Open, a small open T5-based hallucination classifier that runs on CPU by default.

The ARES framework (Saad-Falcon and colleagues, 2023) takes a related route: it generates synthetic training data, fine-tunes lightweight judge models for context relevance, answer faithfulness and answer relevance, and uses a few hundred human annotations with prediction-powered inference to put confidence intervals on the results. Its repository is Apache 2.0 licensed, though it has seen little recent activity.

A RAG evaluation framework in five steps

  1. Define what good means per use case. A policy assistant for staff needs high faithfulness and correct refusals; a research assistant may trade some precision for recall. Write the thresholds down before you measure.
  2. Build and version the dataset as described above, with a held-out split.
  3. Score components offline. Run retrieval metrics on every change to chunking, embeddings, indexes or filters. Run generation metrics on every change to prompts or models. Because each run is cheap, it can sit in continuous integration.
  4. Check end to end, including permissions. Run the full pipeline as different users and score answer correctness, refusals and leaks.
  5. Gate releases and monitor production. Block a release when a metric drops below its threshold or regresses beyond an agreed margin. In production, sample live traffic for judge-based faithfulness scoring and route low scores and user complaints to reviewers, whose labels feed back into the dataset.

The framework is the same whichever tool computes the numbers. What makes it work is the dataset, the thresholds and the habit of running it on every change.

RAG evaluation tools

These are the most widely used options for computing RAG metrics. Licences were read from each project’s repository, and features from its documentation, on 29 October 2026.

ToolLicenceRAG metrics it documentsLocal or self-hosted operation
RagasApache 2.0Context precision (LLM, non-LLM and ID-based), context recall, context entities recall, noise sensitivity, response relevancy, faithfulness, plus multimodal variantsPython library; OpenAI, Anthropic and Google supported directly, other providers through LiteLLM; HHEM option for faithfulness
DeepEvalApache 2.0Contextual precision, contextual recall, contextual relevancy, answer relevancy, faithfulnessPython library; documents Ollama as an evaluation model, set as the default via its CLI
TruLensMITRAG triad: context relevance, groundedness, answer relevancePython library maintained by Snowflake; Ollama, LiteLLM and Hugging Face listed as judge providers
Arize PhoenixElastic License 2.0LLM-based and code-based evaluators, with integrations for Ragas and DeepEvalFree to self-host via Docker, Kubernetes or Helm; docs state it can be fully air-gapped
LangSmithCommercialEvaluation alongside tracing and prompt toolingSelf-hosted version is an add-on to the Enterprise plan, installed on Kubernetes with Helm
ARESApache 2.0Context relevance, answer faithfulness, answer relevance with trained judgesResearch code; trains its own small judges

When to choose which. Ragas is the most RAG-specific of the libraries and the easiest place to start if you want named retrieval and generation metrics. DeepEval suits teams that want evaluations written as unit tests and run in CI. TruLens fits teams that want evaluation tied to traces of each step. Phoenix adds a UI for traces, datasets and experiments that can run inside your network; its licence lets you self-host freely but not offer it to third parties as a managed service. LangSmith suits teams already using the LangChain ecosystem with an Enterprise agreement. Our broader LLM evaluation tools comparison covers several more, including promptfoo, MLflow and Langfuse.

Running RAG evaluation offline or on-premises

Evaluation data is often more sensitive than production traffic. A test set built from real tickets and expert answers concentrates exactly the material you were careful about when you chose a private RAG deployment. Sending it to a cloud judge creates the export path you avoided.

A fully local evaluation stack is practical:

  • Retrieval metrics need no model. Recall@k, precision@k, MRR and nDCG are arithmetic over labels, and the non-LLM context precision variants use string similarity.
  • Judges can run locally. Serve an open-weight model with Ollama, vLLM or another OpenAI-compatible server and point DeepEval or TruLens at it, or route Ragas through LiteLLM after confirming your endpoint is supported. Use a different model family from the generator where you can. Our guide to the best local LLMs for RAG helps with choosing.
  • Classifiers reduce judge load. A small hallucination classifier such as HHEM can score faithfulness on CPU for routine runs, with a larger judge reserved for disputed cases.
  • Store results with the corpus. Keep scores, judge settings and dataset versions in the same controlled environment as the documents, so audit and regression analysis use one source.

Calibrate the local judge against human labels exactly as you would a cloud one; a smaller model is not automatically a worse judge, but you need evidence either way.

How VDF AI fits

VDF AI runs retrieval, models and evaluation inside your own environment: on-premises, in a private cloud, air-gapped, or on VDF AI Cloud where policy allows. With local models configured, documents, indexes, test sets, judge prompts and results stay on infrastructure you control.

Private RAG returns answers with citations to the passages used, and retrieval respects each user’s permissions, so groundedness, citation accuracy and permission tests can be run against the same controls production uses. Agents can call checking tools from the tool registry, such as citation verification and answer confidence scoring, as steps in a workflow. For the model side, the Model Evaluation Suite lets domain experts store test scenarios and compare candidate models, including local ones, with timestamped results for audit. The AI Router can send judge calls and generator calls to different models and logs each one, and the enterprise RAG page describes the retrieval architecture these metrics measure.

Deployment and licensing options are on the pricing page.

Sources

Checked 29 October 2026.

Frequently asked questions

What is RAG evaluation?

RAG evaluation is the practice of measuring how well a retrieval-augmented generation system works, by scoring its two halves separately and together. Retrieval is scored on whether the passages needed to answer each question were found and ranked near the top. Generation is scored on whether the answer sticks to those passages, actually addresses the question, and cites the right sources. Scores are computed against a fixed set of test questions and rerun whenever the documents, models, prompts or retrieval settings change.

What are the main RAG evaluation metrics?

For retrieval: recall@k (did the needed passages appear in the top k), precision@k (how much of the top k was relevant), mean reciprocal rank and nDCG (how high the relevant passages ranked), and LLM-judged context precision and context recall. For generation: faithfulness or groundedness (are the answer's claims supported by the retrieved context), answer relevance (does it address the question), citation accuracy (do the cited passages support the sentences they are attached to), and answer correctness against a reference where one exists.

What is a good RAG evaluation framework?

A practical RAG evaluation framework has five parts: a versioned test set of real questions with reference answers and source passages; component metrics for retrieval and for generation; end-to-end checks including refusals and permission cases; a judge setup that has been calibrated against human labels; and a regression gate that blocks a release when scores drop. Open-source libraries such as Ragas, DeepEval and TruLens compute the metrics, but the test set and thresholds have to come from your own domain.

What are the best RAG evaluation tools?

Widely used open-source options include Ragas (Apache 2.0) for RAG-specific metrics, DeepEval (Apache 2.0) for pytest-style tests, TruLens (MIT) for the RAG triad with tracing, and Arize Phoenix (Elastic License 2.0) for tracing plus evaluation that can be self-hosted and air-gapped. LangSmith is a commercial platform whose self-hosted version is an Enterprise add-on. ARES is a research framework that trains small judge models. Pick based on whether you need metrics in code, a tracing UI, or both, and on whether the judge can run locally.

Can you evaluate RAG without sending data to a cloud model?

Yes. Non-LLM retrieval metrics such as recall@k, MRR and nDCG need no model at all. For judge-based metrics, DeepEval documents Ollama as an evaluation model, TruLens lists Ollama, LiteLLM and Hugging Face as judge providers, Ragas offers a faithfulness variant that uses Vectara's open HHEM classifier, and Phoenix states it can run fully air-gapped. Calibrate any local judge against a sample of human-labelled answers before trusting its scores.

Filed under
private RAGRAGopen-source AIlocal LLMon-premises AIenterprise AI
Private RAG & Search

Evaluate your knowledge stack

Find out how a private RAG and retrieval layer would perform on your data — accuracy, latency, governance, and what to fix before you scale.

Or start free — no credit card →

Keep reading