RAG evaluation: find out if retrieval or the model got it wrong
A RAG answer can stick to its retrieved chunks and still be wrong, so score retrieval on its own too.
Rogerio Chaves · · LLM Evals
If your retrieval-augmented generation (RAG) app gets some answers wrong, you can't tell from the answer alone whether retrieval missed something or the model messed up. You need to know, because the fixes are different.
I built a small RAG app over seven help center articles of the made-up software company in our demo project. The test questions came from that project's traces in LangWatch, where simulated customers have been asking its support agent things since September. I took 17. For one of them, "Our VAT number changed in June, can the invoice be re-issued with the new one?", my app answered:
No. Past invoices can't be re-issued with a different VAT number.
That answer is wrong. The help center says to open a support ticket and ask for a credit note, so the customer had a way out and was told no.
Faithfulness, which checks that every claim in the answer is backed by the retrieved text, gave it a perfect score, and the score was correct: every claim was in the chunks the model got. Retrieval had cut the article into 400-character chunks, and the chunk it found stopped mid-sentence, right before the credit note.
How do you evaluate a RAG system?
Score every row of a test set three times: retrieval (context recall against an expected answer), generation (faithfulness to the retrieved chunks) and the outcome (does the answer match the expected one). If a wrong answer has low recall, fix retrieval. If recall is full, look at the answer and the model.
Grade retrieval and generation separately
I ran it as an experiment with the LangWatch Python SDK (pip install langwatch, then LANGWATCH_API_KEY in the environment). The dataset is a table with two columns, question and expected_answer, and I wrote each expected answer from the articles. Each RAG version is a target, the SDK's word for one version you compare, so versions sit side by side on the same rows.
Three evaluators from the LangWatch evaluators list score every row, with OpenAI's gpt-6-luna as the judge model. This is the loop, trimmed from the real file:
experiment = langwatch.experiment.init("acme-help-center-rag")
JUDGE = {"model": "openai/gpt-6-luna"}
for index, row in experiment.loop(df.iterrows()):
with experiment.target("v1", {"retrieval": "fixed 400 chars, top 2"}):
output, contexts = rag(row["question"])
experiment.log_response(output)
data = {"input": row["question"], "output": output, "contexts": contexts, "expected_output": row["expected_answer"]}
for evaluator in ["ragas/response_context_recall", "ragas/faithfulness", "langevals/llm_answer_match"]:
experiment.evaluate(evaluator, index=index, data=data, settings=JUDGE)
Here rag() returns the answer and the list of chunk texts it sent to the model. I ran it with uv run python experiment.py, and LangWatch listed the run under Experiments, with every row and its three scores.
The first version split each article into fixed 400-character chunks, embedded them with text-embedding-3-small and sent the top two to the model. That's the simplest splitter you can write, and it got four answers wrong. All four had context recall below 1, so each time retrieval had missed part of the answer. This is the VAT row from that run:

You get the judge's reasons next to every score, and that's where you see what to fix. Context recall split the expected answer into three statements and found two in the chunks. The missing one: "The context does not mention support tickets, credit notes, or a processing timeframe." The answer check failed it for the same gap. Faithfulness passed both claims the model made, because both were in the chunks.
The metrics: context recall, faithfulness and answer correctness
You need all three, because each one checks a different thing:
| Score | What it checks | Needs an expected answer | When it's low on a wrong answer |
|---|---|---|---|
| Context recall | Do the retrieved chunks hold each statement of the expected answer? | Yes | Fix retrieval: chunking, top k, search |
| Faithfulness | Is each claim in the answer backed by the retrieved chunks? | No | Fix the prompt or the model |
| Answer correctness (LLM Answer Match) | Does the answer match the expected answer? | Yes | Read the other two to find out why |
Faithfulness compares the answer only with the chunks the model got, so it can't see what retrieval left out. That's why it passed the VAT answer.
The first two are Ragas metrics, and Ragas says it straight: context recall "always requires a reference to compare against". Your expected answer is that reference. LangWatch runs the Ragas metrics as built-in evaluators. If you already evaluate RAG with Ragas in a notebook, you keep the same metrics and get the judge's reasons on every row, with your versions side by side.
If you suspect you're sending too much noise, add context precision, which checks how much of the retrieved context the answer needed.
Don't read faithfulness as pass or fail. It sat under 1 on plenty of correct answers too, because the judge also marks claims that come from your prompt, like "I can open a ticket for you", or from the customer's own question.
The fix for the VAT row was in the chunking, so I split each article on its ## headings, put the article title on top of each section and sent the top three:
def chunk_sections(text):
title = text.splitlines()[0].lstrip("# ").strip()
parts = re.split(r"\n(?=## )", text)
return [parts[0].strip()] + [f"{title}\n{p.strip()}" for p in parts[1:]]
I ran the same experiment with the new version as a second target, on the same 17 rows. This time the VAT answer says to open a ticket for a credit note, and all three scores pass:

It still got three wrong. Two were retrieval again: for "how do i enable saml sso", the top three sections didn't include the one that says to test before you enforce.
The third had full recall, and the answer check failed it for leaving out one detail, that the company emails the admins when it turns off a failing webhook. Retrieval was fine there, and I'd call the judge strict, which you only see by reading its reason. If the misses are retrieval, the vector vs hybrid search cookbook is a good next experiment.
Build the test set from real questions
Your test set should be the questions people actually ask. Mine came from the simulated customers in our demo traces, the closest a made-up company gets to real traffic: "how do i rotate an api key", "Is the price prorated or do we pay the full month?", "Do members get locked out while we test it?". They're short and messy.
The expected answers are the part that costs time. I wrote mine by hand from the articles, one or two sentences each. For your own app, take them from production: filter your traces, pick the questions, add them to a dataset and write the right answer next to each. Our post on building an evaluation dataset from production traces walks through it in LangWatch. A few dozen rows you've read yourself beat hundreds you generated and didn't check.
When to make RAG agentic: let the evals decide
An agentic version gives the model a search tool and lets it search again until it has what it needs. I added one to the same experiment as a third target: the same sections, a search_help_center tool that returns the top three, up to four searches.
The agent got one more answer right, for 2.8 times the tokens and more than twice the wait. Tokens and seconds count the RAG app only, not the judges:
| Version | Answers correct (of 17) | Context recall (avg) | Faithfulness (avg) | Tokens per question | Seconds per question |
|---|---|---|---|---|---|
| Agent with a search tool | 15 | 0.97 | 0.79 | 909 | 5.3 |
| One chunk per section, top 3 | 14 | 0.94 | 0.85 | 326 | 2.3 |
| Fixed 400-character chunks, top 2 | 13 | 0.81 | 0.79 | 298 | 2.6 |
On 17 rows, one answer could be noise, and I'd rerun before trusting it. The token cost isn't noise. For a support widget I'd keep the simple version and fix its two retrieval misses first, and on your data the table might say the opposite.
Earlier this year I ran the same comparison for a team at a utility company. They had held off on agentic features because they couldn't tell whether those would help, and on their small generated dataset the agentic version came out slower, more expensive and worse than their simple RAG.
To compare runs in LangWatch, tick them in the Experiments list and you get cost, latency and pass rate per run, with every row below. This screenshot from our docs shows two runs of another experiment side by side:

The experiments docs cover the Workbench, the SDK and running the same experiment in your CI/CD pipeline. Next time an answer looks wrong, check which of the three scores dropped before you change the prompt.
Put this into production with LangWatch.
Trace your agents, run evaluations, and turn failures into repeatable tests.
Frequently asked questions
- How do I evaluate my LLM application before shipping to production?
- Run it on a test set of real questions, each with an answer you trust, and score every row with evaluators, one per thing that can go wrong. For a RAG system that means one score for retrieval, one for whether the answer sticks to what was retrieved, and one for whether the answer is right. Rerun the same experiment on every change and compare.
- What is RAG evaluation?
- RAG evaluation checks the two halves of a retrieval-augmented generation system: did retrieval bring back the passages the answer needs, and did the model answer correctly from them. Score each half on its own, so a wrong answer tells you whether to fix your chunking and search, or your prompt and model.
- Is faithfulness enough to evaluate RAG?
- No. Faithfulness only checks that the answer sticks to the retrieved context. When retrieval misses part of the answer, the model can stay faithful to what it got and still be wrong. Pair it with context recall against an expected answer, and with an answer correctness check.
- Can I use Ragas metrics in LangWatch?
- Yes. LangWatch runs the Ragas metrics as built-in evaluators, such as ragas/faithfulness, ragas/response_context_recall, ragas/response_context_precision and ragas/response_relevancy. You call them from an experiment in the Python or TypeScript SDK, or pick them in the Experiments Workbench, and every row keeps the judge's reasons.
- Should I make my RAG agentic?
- Only if your evals say so. Add the agentic version as one more target in the same experiment and compare correct answers, tokens and seconds per question on the same test set. In our demo it got one more answer right for almost three times the tokens. On other data the agentic version came out worse.