RAGAS Explained: How to Measure Whether Your RAG Answers Are Grounded

RAGAS scores a RAG pipeline with four metrics: faithfulness, answer relevancy, context precision and context recall. What each one measures and how to run it.

By Galactic News Editorial · Published 2026-11-18T07:29:38+00:00 · Updated 2026-11-18T07:29:38+00:00

RAGAS rag evaluation measuring whether RAG answers are grounded in retrieved context

RAGAS Explained: How to Measure Whether Your RAG Answers Are Grounded

RAGAS is an open-source framework for evaluating retrieval-augmented generation. It turns a vague worry, "is my chatbot making things up?", into four numbers. Those numbers say whether retrieval found the right passages, and whether the answer stuck to them. This explainer covers what each RAGAS metric measures, how it is computed, and how to run an evaluation.

What RAGAS is, in one paragraph

RAGAS stands for Retrieval-Augmented Generation Assessment. It comes from a paper by Es and colleagues, presented at EACL 2024. The project ships as a Python library. It scores a RAG pipeline with an LLM as the judge. Most of its metrics are reference-free. You do not need a human to write the ideal answer for every test question. Faithfulness and answer relevancy judge the output against the retrieved context and the original question. That means you can run them on live production traffic, not only on a labelled test set.

All four core metrics score from 0 to 1. Higher is always better. Each one looks at a different part of the pipeline. That is what makes them useful for debugging. A low score points at a specific stage, not at the whole system.

The four RAGAS metrics at a glance

MetricQuestion it answersNeeds a reference answer?Points at
FaithfulnessIs every claim in the answer supported by the retrieved context?NoGeneration making things up
Answer relevancyDoes the answer address the question asked?NoOff-topic or padded answers
Context precisionAre the relevant chunks ranked near the top?Yes, or a judgeRetrieval noise and ranking
Context recallWas all the needed information retrieved?YesRetrieval missing information

Two metrics judge retrieval. Two judge generation. Together they cover the whole pipeline. The Ragas docs also list further metrics, including context entities recall, noise sensitivity and factual correctness. Start with the core four. Add the rest when you need them.

Faithfulness: is the answer grounded?

Faithfulness is the metric most teams care about first. It measures what fraction of the claims in the generated answer are supported by the retrieved context. The computation has three steps. First, the judge model splits the response into individual claims. Second, it checks each claim against the retrieved context. Third, it divides supported claims by total claims.

An answer with five claims, where four are supported, scores 0.80. An answer with one supported claim and one unsupported claim scores 0.50. The score runs from 0 to 1.

Faithfulness is not correctness. An answer can be fully supported by a wrong or outdated passage. It will score high on faithfulness and still be wrong. Faithfulness catches hallucination. It does not catch bad sources. Keep the distinction clear when you report scores.

When faithfulness drops, the fix sits in generation. Tighten the system prompt. Tell the model to answer only from the provided context. Use a model that follows instructions well. Check the retrieved chunks too. A model cannot stay grounded on empty context.

Answer relevancy: does it answer the question?

Answer relevancy measures whether the generated answer addresses the user's question. It does not check factual accuracy. It checks topical fit. A long, polished answer to the wrong question scores low.

The computation is indirect. The judge model generates questions from the answer, three by default. It then measures the embedding similarity between those generated questions and the real question. The average similarity is the score. The docs note that the score is not strictly guaranteed to stay between 0 and 1, because it is a cosine similarity average.

Low answer relevancy usually means the prompt is vague or the context is noisy. The model drifts, pads, or answers a nearby question instead. Fix it by revising the prompt to focus on the specific question. Trim context noise. Reduce the number of chunks passed to the model.

Context precision: is the good stuff ranked first?

Context precision is a retrieval metric. It asks whether the relevant chunks were ranked near the top of the retrieved list. It is rank-aware. A relevant chunk at rank one counts for more than the same chunk at rank five.

The score is the mean of precision at k across the retrieved chunks. Precision at k is the share of relevant chunks among the first k results. The docs give a clear example. Putting an irrelevant chunk first drops the score from about 1.0 to about 0.5. Order matters, not just inclusion.

Context precision needs a reference answer, or a judge, to decide which chunks are relevant. That makes it harder to run on live traffic than faithfulness. It is worth the effort on a labelled test set. It tells you whether your ranking is the problem, or your coverage.

When context precision drops, tune the retriever. Raise the similarity threshold. Add a reranker. Reduce top k. A smaller, cleaner context list often beats a long, noisy one.

Context recall: did retrieval find everything?

Context recall is the other retrieval metric. It asks whether all the information needed to answer was retrieved. The computation breaks the reference answer into claims. It checks whether each claim appears in the retrieved context. The score is the share of reference claims found.

Context recall also needs a reference answer. It is the mirror of context precision. Precision asks if the retrieved chunks were relevant. Recall asks if the relevant information was retrieved at all. A system can score high on one and low on the other.

When context recall drops, the retriever missed something. The cause is often chunking. A passage split across two chunks may never match the query. Or the embedding model may rank a paraphrase below the threshold. Try smaller chunks with overlap. Try hybrid search, combining keyword and vector retrieval. Check the query itself. A vague question retrieves vague chunks.

How to run a RAGAS evaluation in five steps

  1. Build a test set. Collect 20 to 50 real questions. Include the reference answer for the metrics that need one. Cover your hardest cases, not only the easy ones.
  2. Run the pipeline and save everything. For each question, store the user input, the retrieved contexts, the response and the reference. RAGAS needs all four fields.
  3. Pick the metrics. Start with faithfulness and answer relevancy. They run without references. Add context precision and context recall on the labelled set.
  4. Score with the current API. Ragas 0.4.x moved metrics to ragas.metrics.collections. Call them with keyword arguments, such as await metric.ascore(user_input=..., response=...). Older metric classes are deprecated and will be removed in 1.0.
  5. Read the scores per question. Averages hide the failures. Sort by lowest faithfulness. Read the worst five answers. Fix the pattern, not the single case.

Common mistakes with RAGAS scores

Three mistakes show up again and again. First, treating faithfulness as correctness. It is groundedness, not truth. A grounded answer can still be wrong if the source is wrong. Second, judging a pipeline by one average. A 0.9 average can hide five answers at 0.3. Look at the distribution. Third, using a weak judge model. The judge's own errors become your scores. Use a capable model for the judge, even if the pipeline itself runs a cheaper one.

Another trap is stale tutorials. Ragas changed a lot between 0.3 and 0.4. Many guides online still use APIs that are now deprecated. Check the current docs at docs.ragas.io before copying code. The project also moved on GitHub to vibrantlabsai/ragas. Old links to the previous owner still redirect, but the docs are the source of truth.

Bottom line

RAGAS gives a RAG pipeline four numbers that point at four different failures. Faithfulness catches answers that invent claims. Answer relevancy catches answers that drift off topic. Context precision catches bad ranking. Context recall catches missing information. Run faithfulness and answer relevancy on live traffic. Run all four on a labelled test set. Then fix the stage the scores point at, and re-run. A RAG system without evaluation is a guess. RAGAS replaces the guess with a measurement.