Product Engineering
5 min
A RAG system can retrieve incorrect information even when its knowledge base holds the right answer. Failures can arise during document processing, chunking, embedding, query interpretation, ranking, or context assembly. This framework helps engineering teams pinpoint where retrieval goes wrong.
By Varsha Ojha
05 Nov, 2026
Key takeaways:
Your RAG system retrieves five documents and produces a fluent response, yet the answer is wrong. The LLM may not be the cause.
In Anthropic's experiments, combining contextual embeddings with contextual BM25 reduced the top-20 retrieval failure rate by 49%. Adding reranking increased the reduction to 67%.
The BEIR benchmark tested 10 retrieval systems on 18 datasets and found substantial variation in how well they generalized across domains.
Together, these findings underline a central engineering challenge: finding information is not the same as finding the right evidence.
Where is your RAG pipeline failing?
Explore the engineering choices behind document ingestion, retrieval, knowledge indexing, and grounded AI responses.
A RAG pipeline does more than search a vector database. It converts source content into searchable records, interprets questions, retrieves candidate passages, and assembles evidence for the language model.
Each stage can fail differently. This ladder follows the pipeline in order to help trace a wrong answer to its source.
RAG cannot retrieve information its knowledge base does not contain. Outdated documents, missing source repositories, and unsynchronized knowledge bases can produce answers that are no longer valid.
For example, if a company changes its refund policy but the index retains the old version, retrieval can work as designed and still return outdated guidance.
What To Check?
Source coverage, indexing timestamps, version history, and synchronization logs.
What To Improve?
Use incremental ingestion, document versioning, deletion handling, and freshness checks. Record when each source was last indexed.
A source may contain the right answer, but extraction can distort it before indexing.
Scanned PDFs, complex tables, multi-column layouts, and spreadsheets are common trouble spots. A pricing table that loses its column relationships, for instance, may link a price to the wrong customer category.
Google's document parsing guidance outlines ways to extract content from digital and scanned documents.
The Important Check
Compare extracted text with the original source, paying particular attention to tables, headings, footnotes, and reading order. Use OCR where necessary and validate extracted content before generating embeddings.
Chunking breaks documents into smaller passages for retrieval. Poor boundaries can separate details that must be read together.
Suppose a policy allows reimbursement claims within 30 days, then specifies that only approved travel expenses qualify. If those statements land in separate chunks, retrieval may return incomplete guidance.
Three Ways to Preserve Context
Embedding models represent text as numerical vectors to find semantically related passages. A similar passage, however, may not answer the question.
For example, a question about account suspension after failed payments may retrieve general suspension guidance rather than the relevant payment policy.
This mismatch can arise when a model struggles with specialized terminology, technical abbreviations, or closely related concepts.
What To Test?
Compare embedding models against representative questions and verified relevant passages. When exact terms matter, test hybrid retrieval alongside vector search.
Sometimes, the problem begins with the question itself. Conversational queries often contain incomplete references, abbreviations, or multiple conditions that a retriever cannot interpret independently.
For example, "What happens if it expires?" requires conversation history to establish what "it" refers to.
Query transformation can address this through three approaches:
| Technique | Purpose |
|---|---|
| Query rewriting | Clarifies incomplete or ambiguous questions |
| Query expansion | Adds relevant terminology |
| Query decomposition | Splits complex questions into smaller searches |
The actual query sent to the retriever should preserve the user's original intent. Rewriting that introduces assumptions can create another retrieval failure.
The correct document may exist in the index but never appear in the initial search results.
Approximate nearest-neighbor (ANN) algorithms make vector search faster by avoiding exhaustive comparisons. However, their configuration can affect recall. Similarly, restrictive metadata filters may exclude relevant documents based on department, date, language, or document category.
Try comparing retrieval results under different conditions:
| Comparison | What it Reveals |
|---|---|
| Exact vs. approximate search | Whether ANN misses relevant records |
| Search with vs. without filters | Whether filtering excludes evidence |
| Different top-K values | Whether relevant results fall outside the candidate limit |
| Vector vs. hybrid search | Whether keyword matching recovers missing results |
Hybrid retrieval combines lexical search, such as BM25, with vector search. Microsoft's hybrid search documentation explains how Reciprocal Rank Fusion (RRF) combines these result sets.
Retrieving relevant documents does not mean the most useful ones will appear first.
A general article may receive a higher similarity score than a specific policy passage, even when the latter directly answers the question.
This is where reranking becomes useful. A cross-encoder evaluates the query and each candidate together, producing a more context-sensitive relevance score.
A Common 3-Stage Approach
Pinecone's reranking guide explains this approach and its trade-offs involving precision, recall, and latency.
Even when retrieval finds the correct information, the LLM may never receive it.
The application must select, organize, and fit retrieved passages into the final prompt. If conversation history, instructions, and source metadata consume too many tokens, relevant evidence may be truncated or excluded.
There is another consideration: simply including more information does not guarantee better results. Stanford's Lost in the Middle study found that models can struggle to use relevant information positioned in the middle of long contexts.
The Final Check
Compare the retriever's results with the actual prompt sent to the LLM. Inspect which passages were removed, duplicated, truncated, or poorly ordered.
Context selection should account for relevance, redundancy, token budgets, and evidence ordering. A larger context window alone does not solve these problems.
From document ingestion and semantic retrieval to reranking and context construction, identify where your RAG system falls short and engineer a more reliable retrieval process.
Track these seven metrics to evaluate retrieval performance, context quality, and the reliability of generated answers:
These metrics help identify whether the problem lies in document retrieval, ranking, context selection, or answer generation.
The eight stages explain how evidence can be lost before generation. However, an incorrect answer does not always indicate a retrieval failure.
The distinction becomes clearer when you inspect the retrieved context and final response separately.
| What You Observe | Likely Problem |
|---|---|
| Correct answer absent from retrieved results | Retrieval failure |
| Correct document exists but extracted text is wrong | Ingestion failure |
| Relevant evidence appears below the cutoff | Ranking or candidate selection |
| Evidence is retrieved but excluded from the prompt | Context construction |
| Correct evidence reaches the model but answer contradicts it | Generation or grounding failure |
| Evidence is insufficient but the model invents details | Generation and abstention failure |
If retrieval consistently returns relevant, complete, and current evidence, investigate the generation stage.
Check whether the model follows source-grounding instructions, handles conflicting evidence, preserves numerical details, and abstains when the available information is insufficient.
This distinction matters when selecting the fix. Changing an embedding model will not resolve a generation problem.
Why does my RAG system return irrelevant documents?
Your RAG system may be using unsuitable embeddings, poorly structured chunks, an incomplete query, or restrictive search filters. Inspect the candidate results before investigating the generated response.
Can a RAG system hallucinate even when retrieval works correctly?
Yes. An LLM can misinterpret, contradict, or introduce information that is not supported by correctly retrieved evidence. This is a generation or grounding problem rather than necessarily a retrieval problem.
Does increasing the top-K value improve RAG accuracy?
Increasing top-K can improve retrieval recall by including more candidate passages. However, it can also introduce irrelevant information, increase token usage, and make context harder to process. Test recall and precision together.
How do I measure retrieval quality in RAG?
Use Recall@K, Precision@K, MRR, and nDCG@K to evaluate retrieval results. Use context precision and context recall to assess the evidence supplied to the LLM.
Is hybrid search better than vector search for RAG?
Hybrid search can improve retrieval when queries contain both semantic concepts and exact terms. However, its effectiveness depends on the corpus, query patterns, and ranking configuration. Evaluate both approaches against representative questions.
Should I use RAG as a service or an open-source implementation?
The choice depends on data privacy, infrastructure requirements, integration needs, maintenance capacity, and control over retrieval components. Managed services can reduce infrastructure work, while open-source implementations offer greater control but require engineering and ongoing evaluation.
Tell us what you're planning.
Product Engineering
5 min
Model Context Protocol (MCP) standardizes how AI agents connect with enterprise tools, APIs, and data systems without repetitive custom integrations. Production-ready MCP implementation requires secure server architecture, controlled tool access, authorization, and reliable execution. The MCP Integration Pattern helps enterprises design governed AI workflows, reduce integration complexity, and measure business outcomes through operational reliability, automation rates, and workflow performance.
Product Engineering
5 min
A practical guide to AI UX design for non-deterministic systems, covering output contracts, variance budgets, hallucination handling, evidence, correction loops, safe action gates, recovery paths, human review, and testing. See how Quokka Labs approaches reliable AI product design for enterprise workflows where model behavior can vary across real-world use cases.
Product Engineering
5 min
Learn how to design AI UX for non-deterministic outputs using practical patterns for uncertainty, hallucinations, validation, human review, recovery, and safe actions. Explore Quokka Labs’ Non-Determinism Design Patterns for building reliable generative AI products that give enterprise users clearer evidence, stronger control, and more predictable experiences across production AI workflows.
UG Floor, Tower-4, Assotech Business Cresterra, Plot No.22, Sector-135, Noida, Uttar Pradesh, 201305
111 Congress Avenue Suite 500, Austin,
Texas - 78701
Jasmijnlaan 88, 1187 EL Amstelveen,
Netherlands