Ragas Evaluation: How to Measure Whether Your RAG System Works

Ragas Evaluation: How to Measure Whether Your RAG System Works

Ragas evaluation is the practice of scoring a retrieval-augmented generation (RAG) pipeline with the open-source Ragas framework, which uses a language model as a judge to measure four things: whether answers stay faithful to the retrieved context, whether they actually answer the question, and whether retrieval found the right chunks and ranked them well. The question it answers is simple: is your RAG system good, and if not, which half is broken, the retriever or the generator? Ragas answers that by scoring the two halves separately, so a bad score points at a specific fix instead of a vague feeling that answers are off.

Most teams ship RAG systems with no measurement at all, relying on a few demo questions and user complaints to catch problems. That fails quietly: retrieval degrades as documents change, prompts drift, and models get swapped, and nobody notices until users lose trust. Ragas gives you a repeatable, automated check you can run on every change, which is the difference between a demo and a system you can operate.

Key takeaways

  • Ragas, short for Retrieval-Augmented Generation Assessment, is an open-source Python framework for evaluating RAG pipelines.
  • Its four core metrics are faithfulness, answer relevancy, context precision and context recall.
  • Two metrics diagnose the generator and two diagnose the retriever, so failures point at a specific fix.
  • Most metrics need no human-labelled ground truth, which makes them cheap to run at scale.
  • Scores are estimates from a judge model, not ground truth, so they need calibration against human judgement.

What Ragas is

Ragas is an open-source evaluation framework designed specifically for RAG systems. It was introduced by Shahul Es and colleagues in a paper presented at EACL 2024, and it has since become one of the standard tools for RAG evaluation. LangChain’s guide to evaluating RAG pipelines with Ragas shows the four metrics in use. It works with any RAG stack, whether built on LangChain, LlamaIndex or a custom pipeline, and it works with any judge model, so you can use a cheap model for evaluation even if your production system uses a frontier model.

The design decision that makes Ragas practical is that most of its metrics are reference-free: they do not need human-written correct answers for every test question. Instead, a judge language model examines the question, the retrieved context and the generated answer, and scores each dimension. That removes the biggest bottleneck in evaluation, which is building labelled test sets, though it introduces a new one: the quality of your scores depends on the quality of your judge.

The four core Ragas metrics

Each metric isolates one failure mode. Learning what each one catches is the whole skill of using Ragas, because a single combined score would hide exactly the information you need.

Faithfulness: did the answer stay grounded?

Faithfulness, also called groundedness, checks whether every claim in the generated answer is supported by the retrieved context. Ragas splits the answer into atomic statements and asks the judge whether each one can be inferred from the chunks, then returns the fraction supported as a score between 0 and 1. This is the hallucination check: a low faithfulness score means the generator is inventing things beyond its sources, and the fix is usually a tighter prompt, a lower temperature or better retrieval.

Answer relevancy: did it answer the question?

Answer relevancy measures whether the response actually addresses what was asked, independent of whether the facts are right. Ragas generates the questions the answer would be a good reply to, then measures how similar those are to the original question. A low score here usually means a prompt problem rather than a retrieval problem: the model is being verbose, evasive or answering a different question than the one asked.

Context precision: were the chunks ranked well?

Context precision checks that the relevant chunks appear near the top of the retrieval ranking, using a ranking-aware measure that penalises systems which bury the useful chunks at the bottom. If precision is low, retrieval is noisy: the system fetches material, but the good stuff is drowned out. Re-ranking or a stricter retrieval threshold usually helps.

Context recall: was anything missed?

Context recall measures whether the retriever fetched all the information needed to answer the question, judged against a ground-truth reference. A low recall score means the answer was impossible from the start, because the evidence never reached the model. The usual fixes are smaller chunks, a larger top-k, or a wider corpus. For more on the retrieval side, see our guide to RAG context recall and why retrieval coverage matters.

A magnifying glass resting on printed documents with highlighted passages
Ragas splits the evaluation problem in two: it scores the retriever and the generator separately, so each bad score points at a fix.

How a Ragas evaluation run works

A Ragas run starts with an evaluation dataset: a set of questions, each with the contexts your system retrieved, the answer it generated, and, for the metrics that need it, a ground-truth reference. You choose your metrics, wrap a judge model, and call the evaluate function. The result is a set of scores, one per metric, averaged across the dataset.

The dataset is the part teams get wrong. A test set written by the same people who built the system tends to reflect what the system already does well. Better test sets come from real user questions, from support tickets, or from synthetically generated questions grounded in your documents, which Ragas also supports. Aim for coverage of the question types your users actually ask, including the awkward ones: multi-hop questions, questions with no answer in the corpus, and questions that use the vocabulary of your domain rather than yours.

Best for: teams that already have a working RAG pipeline and need a repeatable check they can run before every release, rather than teams still choosing an architecture.

Ragas metrics at a glance

Metric What it measures Needs ground truth? Low score usually means
Faithfulness Claims in the answer supported by context No Hallucination; tighten the prompt
Answer relevancy Answer addresses the question asked No Prompt problem; rewrite instructions
Context precision Relevant chunks ranked at the top No Noisy retrieval; add re-ranking
Context recall All needed information retrieved Yes Missing coverage; adjust chunking or top-k
Answer correctness Answer matches the reference answer Yes Substance problem; read the failing rows

Note that context relevancy, an older Ragas metric, was deprecated in favour of context precision in newer versions, so guides written for early versions may name a metric that no longer appears in the current API. If you are comparing Ragas with other tools, our comparison of RAG evaluation frameworks sets the options side by side, and our guide to RAG evaluation metrics explains the underlying measures in more depth.

Reading Ragas scores honestly

Scores are estimates, not ground truth. They inherit the judge model’s biases, and they drift when the judge changes, so a score of 0.85 from one judge is not directly comparable to 0.85 from another. Pin your judge model and its version, record it with your results, and treat changes in the judge as a reason to re-baseline rather than as a reason to celebrate or panic.

As a starting point, many teams aim for faithfulness above 0.80, answer relevancy above 0.85, context precision above 0.75 and context recall above 0.80, then adjust those targets to their domain. A medical or legal system should demand far more than a casual internal search tool. The absolute number matters less than the trend: scores should be stable or improving across releases, and any sharp drop should block a deployment until someone has read the failing rows.

Also remember that averages hide failures. A system can score well on average while failing every question in one category, such as questions with no answer in the corpus. Break scores down by question type, and always read a sample of the lowest-scoring rows by hand. The metric tells you where to look; it does not tell you what went wrong.

Where Ragas fits in a testing workflow

Ragas is a batch evaluation tool: you run it over a dataset and get scores. That makes it natural for regression testing in continuous integration, for comparing two retriever configurations, or for checking a prompt change before it ships. It is not a live monitoring tool, and it does not trace individual requests in production. Teams that need both usually pair Ragas with an observability tool that records traces and runs feedback functions on live traffic.

The cheapest effective setup is a small, well-chosen test set run on every pull request that touches retrieval or prompts, plus a larger run before each release. Keep the test set fixed between runs so the numbers are comparable, and version it alongside your code. When a change moves a score, you want to know whether the change caused it or the test set did.

Getting started checklist

  • Collect 50 to 100 real user questions as the seed of your test set.
  • Generate contexts and answers with your current pipeline, and add ground truth for recall and correctness.
  • Pin a judge model and record its version with every run.
  • Run the four core metrics and record the baseline before changing anything.
  • Break scores down by question type, not just as one average.
  • Read the lowest-scoring rows by hand before acting on any metric.
  • Set thresholds per metric and block releases that breach them.
  • Re-baseline whenever the judge model or the test set changes.

Frequently asked questions

Does Ragas need ground-truth answers?

Mostly no. Faithfulness, answer relevancy and context precision are reference-free and need only the question, retrieved contexts and generated answer. Context recall and answer correctness need a ground-truth reference, so include labelled answers if you want those two metrics.

How is Ragas different from LLM-as-a-judge in general?

LLM-as-a-judge is a technique; Ragas is a framework built on it, specialised for RAG. Its contribution is the decomposition into four metrics that separate retrieval failures from generation failures, with defined procedures for computing each one.

Can Ragas evaluate agentic RAG systems?

Yes, with care. When an agent decides not to call retrieval at all, the contexts field comes back empty and both retrieval metrics fail the row, even if the answer was good. Record whether the tool was called and analyse those rows separately instead of averaging them in.

What judge model should I use?

Use a capable but cheap model, since evaluation calls can outnumber production calls. The judge does not need to be the same model as your generator, but it should be strong enough to follow the scoring instructions reliably, and its version should be pinned.

Why did my Ragas score drop after a model change?

Either the new model genuinely performs differently, or the judge changed, or the test set changed. Check those three in order before concluding the system got worse, and re-baseline whenever the judge or the dataset changes.

Is a single Ragas score enough to judge a RAG system?

No. Ragas reports one score per metric precisely because a single number hides the difference between retrieval and generation failures. Use all four core metrics together, and pair them with human review of failing rows.

Latest articles

Scroll to Top