Skip to content

AI, decoded

How do you evaluate a RAG system?

Evaluate source coverage, retrieval and generation separately. Check whether the needed information exists, whether the system retrieves it, and whether the answer is faithful to that evidence and answers the question; one end-to-end score can hide which stage failed.

· Updated · Chain of Thought

Level 4: How AI systems are built · 4.1 Retrieval and RAG

RAG & RetrievalAI Evaluation & Reliability

  • 3 episodes
  • 3 guest clips
  • 8 glossary terms
A RAG system split down the middle into a retrieval block and a generation block, under the question: which half broke? Score retrieval and generation apart.

In detail

Split the system before you score it

First check whether the required information exists in the source collection. Then evaluate the two RAG stages — retrieve, then generate — and they break for different reasons. If you only measure the final answer, you can’t tell whether a bad response came from fetching the wrong documents or from a model that ignored good ones. Evaluate the two halves separately so you know which one to fix.

Measuring retrieval

The question for retrieval is simple: did the right context come back? Context relevance checks whether the retrieved chunks bear on the query; recall checks whether the documents you needed were found at all. Weak retrieval poisons everything downstream — the best model can’t answer from context it never received.

Twilio’s Vinnie Giarrusso describes this triage on Twilio’s agent platform in episode 7 at 10:00. A basic RAG pipeline is quick to stand up, he says, but problems surface as knowledge sources, use cases and users’ unanticipated questions pile up. When an answer fails, his team reads the trace in order: did the agent pick the correct knowledge source, and if it did, did the top-K chunks set it up to answer? He reports that context-aware retrieval raised Twilio’s retrieval accuracy, without giving numbers. Galileo sponsored Season 1, when Conor worked there, and Giarrusso names Galileo as Twilio’s monitoring tool at 14:00.

Measuring generation

Given the retrieved context, two things matter. Faithfulness asks whether every claim in the answer is supported by the sources, with nothing invented — this is the anti-hallucination check. Answer relevance asks whether the response addresses the user’s question rather than reciting related-but-off material. An answer can be faithful to its sources and still miss the question.

Putting it together

Track retrieval and generation metrics side by side, on your own data, and re-run them on every change. When quality drops, the split tells you immediately whether to tune the retriever or the prompt — instead of guessing at a single number that went down.

Diagnose a policy-answer failure

Worked example, with an invented policy: “Can I claim expenses after 30 days?” The authoritative document says ordinary claims close after 30 days and approved exceptions require finance review. Inspect the exact retrieved chunks before changing the model.

What you observeLikely place to investigateNext experiment
The policy is absent from the source collectionCoverageAdd or update the authoritative document
The document exists but is not retrievedRetrievalTest the query, filters and ranking against labeled relevant passages
The deadline arrives without the exception clauseChunking or context assemblyRetrieve the linked clause or change the chunk boundary
Both clauses arrive, but the answer invents automatic approvalGenerationTest groundedness and the required qualification
The assistant cites a superseded policy accuratelyFreshnessApply effective-date and authority rules before generation

The table is a diagnostic aid, not evidence that one failure dominates production. Ragas supplies a research basis for scoring retrieval context and generated answers separately. Its automated scores are signals to validate on your own cases, not proof that a policy answer is correct.

Include questions the documents cannot answer

Add a case whose answer is genuinely missing and decide what a useful abstention or escalation looks like. A system that always produces a confident answer can improve apparent answer coverage while making accuracy worse. Conversely, a system that abstains on everything should fail answerable cases. Store the relevant passages or expected missing information with each case so you can inspect the diagnosis.

Conor’s bad-context essay argues for supplying useful context instead of flooding the window. Test that principle on your own retrieval traces. Continue with context and memory engineering when the documents are right but the assembled context is still failing.

Try it: where did the RAG answer break?

Inspect the evidence and answer in each case. Decide what you would investigate first, then reveal the diagnosis.

Question: Can I claim expenses after 30 days?

Current policy: Ordinary expense claims must be submitted within 30 days. Late claims require finance review; approval is not guaranteed.

Invented policy and answers for practice. These are hand-authored examples, with no live model or automated scores.

  1. Case 1 A missing policy

    In the collection
    The collection contains travel-booking instructions, but no expense-claim policy.
    Sent to the model
    Book travel through the company travel portal.
    The answer
    These documents do not say whether late expense claims are allowed. Ask finance for the current policy.
    Reveal diagnosis for case 1
    1. Source collection Investigate here
    2. Retrieved context
    3. Generated answer

    Start with source coverage. The required policy is absent; a different retriever cannot find it in this collection. The answer correctly acknowledges the missing evidence.

    Next experiment: Add the authoritative policy, then repeat this question and a question whose answer is still absent. Check that the assistant answers the first and escalates the second.

    Context relevance
  2. Case 2 Half the policy

    In the collection
    The current policy contains both the ordinary deadline and the late-claim exception below.
    Sent to the model
    Ordinary expense claims must be submitted within 30 days.
    The answer
    The ordinary expense-claim deadline is 30 days.
    Reveal diagnosis for case 2
    1. Source collection
    2. Retrieved context Investigate here
    3. Generated answer

    The exception never reached the model. The answer is supported by its context, but leaves the late-claim question unresolved. Faithfulness alone would miss the incomplete evidence.

    Next experiment: Inspect chunk boundaries, filters, ranking and context assembly. Add the exception clause to the supplied context and check whether the answer now explains the finance-review requirement.

    Precision and recall
  3. Case 3 An invented approval

    In the collection
    The current policy contains both clauses below.
    Sent to the model
    Ordinary expense claims must be submitted within 30 days. Late claims require finance review; approval is not guaranteed.
    The answer
    Yes. Late claims are automatically approved.
    Reveal diagnosis for case 3
    1. Source collection
    2. Retrieved context
    3. Generated answer Investigate here

    The needed evidence arrived, but the answer contradicts it. Investigate generation: automatic approval has no support in the retrieved policy.

    Next experiment: Test a response that includes the finance-review requirement and does not promise approval. Keep the retrieved context fixed while comparing prompts or models.

    Faithfulness
  4. Case 4 A convincing old answer

    In the collection
    Both versions exist: an archived 60-day policy and the current 30-day policy with finance review for late claims.
    Sent to the model
    Expense claims may be submitted within 60 days.
    The answer
    Yes. You have 60 days to submit a claim.
    Reveal diagnosis for case 4
    1. Source collection
    2. Retrieved context Investigate here
    3. Generated answer

    The answer follows the retrieved passage, but that passage is superseded. Its archive status was not sent to the model. A faithfulness check can pass while the answer gives the wrong current guidance.

    Next experiment: Check effective dates and document authority during retrieval and context assembly. Repeat the case with both versions still in the collection; verify that the current policy governs the answer.

    Faithfulness and its limits
  5. Case 5 The complete answer

    In the collection
    The current policy contains both clauses below.
    Sent to the model
    Ordinary expense claims must be submitted within 30 days. Late claims require finance review; approval is not guaranteed.
    The answer
    A claim after 30 days requires finance review. Approval is not guaranteed.
    Reveal diagnosis for case 5
    1. Source collection
    2. Retrieved context
    3. Generated answer

    No defect is shown in this trace. The current evidence covers the question, and the answer preserves the exception and its limit. One passing case does not certify the whole system.

    Next experiment: Keep this as an answerable control alongside the missing-policy case. A change that makes the assistant refuse every question should fail this control.

    Answer relevance

These are starting points for investigation; real failures can span several stages. Compare the definitions in the Ragas paper and its faithfulness documentation. For missing evidence, read the context-recall documentation. Validate automated judgments against cases you have checked yourself.

Evaluating RAG: split the pipeline, then score each half A RAG pipeline cut in two at the retrieved context. The retrieval half asks whether the right context came back, measured by context relevance, whether the chunks bear on the query, and recall, whether the documents you needed were found at all. The generation half asks whether the answer is grounded and on point, measured by faithfulness, no claims beyond the sources, and answer relevance, whether it addresses the question. Chip Huyen's framing from episode 5: first evaluate whether the context retrieved is relevant and correct, then whether the answer based on that context is relevant and correct. Underneath: one end-to-end score hides which half broke. Vivienne Zhang's example: when NVIDIA's ChipNeMo copilot was failing early on, often the answer simply did not exist in the database, so the fix was the data, not the model. Cut the pipeline in two, then score each half Retrieval and generation fail for different reasons, so they get different metrics. question retrieve retrieved context generate answer cut RETRIEVAL Did the right context come back? context relevance do the chunks bearon the query? recall were the documentsyou needed found at all? GENERATION Is the answer grounded, and on point? faithfulness no claims beyondthe sources answer relevance does it addressthe question asked? One end-to-end score hides which half broke. Vivienne Zhang, episode 5: early on, when NVIDIA’s ChipNeMo copilot failed, often “the answer simply doesn’t exist in the database.” The fix was the data, not the model. The split tells you which one to tune. Track both halves side by side, on your own data, and re-run them on every change.
Score retrieval and generation separately so a drop points at what to fix. Chip Huyen frames the two questions and Vivienne Zhang gives the ChipNeMo example, both in episode 5. Download the image

Hear it from the guest

“So what we're trying to evaluate is whether, the context we retrieve is, relevant and correct to the questions. And second, based on this context, can the answers be, relevant and correct”
“The ChipNeMo example at NVIDIA, we have seen a lot of when at the beginning, when the co pilot was failing, is that the answer simply doesn't exist in the database. So we need to go back and improve the data instead of the model system.”
“Did it even pick the correct knowledge source, first of all? And if it picked the correct knowledge source, like what did the chunks look like?”

Quotes lightly edited to remove filler words.

Go deeper

From the conversation

This explainer is drawn from these episodes — each carries its full transcript.

Concepts in this explainer

FaithfulnessAnswer RelevanceContext RelevanceChunkingHybrid SearchRerankingRetrieval-Augmented Generation (RAG)Accuracy