Recommended resources
The freely available resources this lesson will direct you to.
- How to Build a Scalable RAG System for AI Apps (Full Architecture)www.youtube.com
- Session 7: RAG Evaluation with RAGAS and How to Improve Retrievalwww.youtube.com
- GitHub - Arnav-Ajay/rag-failure-modes: Failure-first analysis of retrieval-augmented and agentic systems, focused on isolating and attributing failures across retrieval, planning, execution, memory, and policy layers.github.com
- Engineering the RAG Stack: A Comprehensive Review of ...arxiv.org
Hello! Welcome to your next lesson on building robust RAG systems.
In our last session, we focused on selecting and configuring chunking strategies—a critical first step in preparing your knowledge base. We saw how choices about chunk size and overlap are fundamental design decisions that impact retrieval performance. Now that we have a well-structured index, the next logical step is to analyze and fortify the retrieval process itself. This is where we move from a promising prototype to a production-ready system that you can confidently offer to clients.
The learning outcome for this lesson is to identify and address common RAG failure modes: irrelevant retrieval, missing context, and conflicting sources. Understanding these failure modes is the difference between a system that works "most of the time" and one that is reliable, transparent, and auditable—exactly what's needed for delivering AI as a service.
1. The Anatomy of RAG Failures
When a RAG system provides a poor answer, it's tempting to blame the LLM's generation step. However, the root cause often lies upstream in the retrieval pipeline. Garbage in, garbage out. A production-grade system must be able to diagnose when retrieval goes wrong.
Let's start with a high-level overview of how even a seemingly well-constructed RAG system can fail in practice.
How to Build a Scalable RAG System for AI Apps (Full Architecture)
This video from ByteMonk provides a concise and practical introduction to why basic RAG systems break down in real-world scenarios. It perfectly sets the stage for our discussion.
Watch the section from 02:22 to 03:59. Pay close attention to the examples given: outdated policies, context cut off mid-sentence, and jumbled tables. These are classic examples of the failure modes we'll be dissecting.
As the video highlights, providing bad context can be worse than providing no context at all, as it can lead the LLM to hallucinate with confidence. The three core failure modes we will focus on are:
-
Irrelevant Retrieval: The system retrieves chunks that are semantically related to the query but do not actually contain the information needed to answer it. This is often due to ambiguous queries or limitations of the embedding model's understanding. The result is noise that pollutes the context window, potentially leading to an off-topic or evasive answer.
-
Missing Context: The system retrieves some relevant chunks, but they are incomplete. The full answer is spread across multiple parts of the source documents, and the retriever fails to fetch all necessary pieces. This is a common consequence of suboptimal chunking (from our last lesson) or a retrieval scope that is too narrow. The result is often a correct but partial answer, or a hallucination where the LLM tries to fill in the blanks.
-
Conflicting Sources: The system retrieves multiple chunks that contain contradictory information. This can happen when a knowledge base contains different versions of the same document, multiple sources with opposing viewpoints, or simply outdated information alongside current data. The LLM is then faced with a contradiction and may either pick one side arbitrarily, attempt to blend them into a nonsensical answer, or hallucinate.
This diagram illustrates where these failures can occur within the RAG pipeline.

The paper "A Comprehensive Review of the Architecture and Trust Frameworks" formally classifies these issues. In its "Retrieval Failure Mode Classification" table (Table 8.4), "Missing Content" corresponds to our Missing Context, while "Poor Ranking" is a primary cause of Irrelevant Retrieval. "Index Staleness" is a direct cause of Conflicting Sources.
2. A Systematic Approach to Diagnosing Failures
Identifying these failures requires moving beyond anecdotal checks to a systematic, evidence-based evaluation. For your goal of delivering professional services, being able to prove that your system is working—and diagnose it when it isn't—is paramount.
The "Failure-First" Mindset
A powerful mental model for building robust systems is to treat failure as the primary signal. Instead of optimizing for success, you intentionally seek out, isolate, and understand failure points.
rag-failure-modes: A Failure-First Analysis
This GitHub repository, rag-failure-modes, provides an excellent articulation of this 'failure-first' philosophy. It's designed for a technical audience and aligns with a rigorous, system-design perspective.
Please read the following sections on the main page: Why This Repository Exists What Problem This Repository Addresses Core Thesis (Failure-First Framing) Under Layers Examined, read the section on the Retrieval Layer. Focus on the core idea: a system you can't explain when it fails is a liability. Notice how it proposes isolating failures layer by layer, starting with retrieval.
This mindset requires a toolkit for measurement. This is where evaluation frameworks like RAGAS (Retrieval-Augmented Generation Assessment) become invaluable. RAGAS provides quantitative metrics to assess the performance of both the retrieval and generation steps.
Session 7: RAG Evaluation with RAGAS and How to Improve Retrieval
This video from AI Makerspace gives a detailed walkthrough of the core RAGAS metrics. Understanding these is key to diagnosing the failure modes we've discussed.
Watch the section from 07:31 to 16:08. Focus on the definitions and examples for the four key metrics, especially the two for retrieval: Context Precision and Context Recall.
Let's connect these metrics directly to our failure modes:
-
Irrelevant Retrieval is diagnosed by low
Context Precision.- Metric Definition:
Context Precisionmeasures the signal-to-noise ratio of your retrieved context. It asks: Of the chunks retrieved, how many are actually relevant to the query? - Diagnosis: A low score indicates that your retriever is pulling in documents that are semantically similar but factually irrelevant, polluting the context for the generator.
- Metric Definition:
-
Missing Context is diagnosed by low
Context Recall.- Metric Definition:
Context Recallmeasures the completeness of your retrieval. It asks: Did the retriever successfully find all the relevant chunks that exist in the knowledge base? - Diagnosis: A low score means your system is leaving crucial information behind, leading to incomplete answers.
- Metric Definition:
-
Conflicting Sources can be indirectly diagnosed by low
Faithfulness.- Metric Definition:
Faithfulnessmeasures how factually grounded the generated answer is in the provided context. - Diagnosis: If you retrieve conflicting chunks of context, the LLM might be forced to generate a statement that isn't supported by (or even contradicts) some of the retrieved information. This will result in a low faithfulness score, signaling that the generation step was built on a shaky foundation of contradictory evidence.
- Metric Definition:
By systematically calculating these metrics over a well-designed evaluation dataset, you can move from "it feels like the answers are wrong" to "our Context Recall is 0.6, indicating we are failing to retrieve complete information."
3. Architectural Solutions for RAG Failures
Once a failure mode is identified, the solution is often an architectural or strategic change, not just a simple prompt tweak.
Addressing Irrelevant Retrieval (Low Context Precision)
If your system is retrieving irrelevant noise, you need to improve the relevance signaling.
- Ensemble Retrieval (Hybrid Search): A single retrieval method is often insufficient. Semantic search is great for conceptual queries, but keyword search (like BM25) excels at matching specific terms, acronyms, and names. Combining them is a powerful pattern.
Session 7: RAG Evaluation with RAGAS and How to Improve Retrieval
Let's return to the AI Makerspace video, which demonstrates an architectural solution to this problem: the Ensemble Retriever.
Watch the section on the Ensemble Retriever (28:22 - 31:41). Understand how it combines a sparse retriever (BM25) with a dense vector retriever and uses reciprocal rank fusion to create a single, more accurate list of results.
- Reranking: A two-stage retrieval process is a common and effective architecture. First, a fast but less precise retriever (e.g., vector search) fetches a large number of candidate chunks (e.g., top 50). Then, a more powerful but slower reranking model (like Cohere's Rerank or a cross-encoder) re-orders these candidates for maximum relevance before passing the top few to the LLM. This significantly improves precision. The
rag-failure-modesrepository (LINK) even dedicates a specific layer to analyzing reranking failures.
Addressing Missing Context (Low Context Recall)
If you are consistently failing to retrieve all the necessary information, you need to broaden the context window intelligently.
- Parent Document Retriever: This is a direct architectural solution for when small chunks lack sufficient surrounding context.
Session 7: RAG Evaluation with RAGAS and How to Improve Retrieval
The AI Makerspace video also provides a direct solution for missing context.
Watch the section on the Parent Document Retriever (24:34 - 28:22). The key idea is to perform the search on smaller, more specific 'child' chunks but return the larger 'parent' chunks that contain them. This provides the LLM with both specificity and broad context.
Addressing Conflicting Sources
This is one of the most challenging failure modes and often requires enriching your data ingestion and retrieval process.
-
Metadata Filtering: This is a critical production strategy. During ingestion, tag each chunk with metadata:
source_document,version,creation_date,author, etc. Your retrieval query can then include filters. For example, a query could be: "Find information on 'parental leave' ANDdocument_source= 'HR_Manual_2024.pdf'". This prevents outdated or irrelevant sources from ever being considered. The ByteMonk video (LINK) alludes to this in its "production rag architecture" (section starting at 03:59). -
Multi-Signal Scoring: As mentioned in the "Comprehensive Review" paper (LINK, Section 7.1.2), advanced systems can move beyond just similarity scores. A confidence score for a retrieved chunk could be a weighted function of its semantic similarity, source credibility, and temporal relevance (recency). This allows the system to programmatically down-rank information from less trustworthy or outdated sources.
-
Evidence Assessment Layer: For mission-critical applications, you can design a specific component, as proposed in the
rag-failure-modesrepository (LINK, Section 6), whose sole job is to analyze the final set of retrieved chunks before generation. It can check for contradictions, assess if the evidence is collectively sufficient, and instruct the generator to either proceed, hedge its answer ("According to source A... but source B states..."), or refuse to answer due to low-quality evidence.
Conclusion
Today, we transitioned from building a RAG system's foundation to making it resilient. By understanding, diagnosing, and addressing the core failure modes of retrieval, you can construct agentic workflows that are robust, reliable, and worthy of your clients' trust.
Key Takeaways:
- Three Core Failure Modes: RAG systems primarily fail due to irrelevant retrieval, missing context, and conflicting sources. Providing bad context is often worse than none.
- Diagnose with Metrics: Adopt a "failure-first" mindset. Use quantitative frameworks like RAGAS to diagnose these issues systematically. Low
Context Precisionsignals irrelevant retrieval, lowContext Recallsignals missing context, and lowFaithfulnesscan signal problems with conflicting sources. - Solve with Architecture: The solutions are often architectural. Use Ensemble Retrievers and rerankers to fight irrelevant retrieval. Employ the Parent Document Retriever to address missing context. Combat conflicting sources with metadata filtering and dedicated evidence assessment layers.
In our next lesson, we will put these concepts into practice. We'll focus on how to diagnose retrieval quality issues by analyzing chunk relevance and context completeness, diving deeper into the hands-on analysis of what your retriever returns and why.