← Back to blog
TechnicalOctober 21, 2026·16 min read

Your RAG System Retrieved the Wrong Evidence. Now What?

A practical guide to tracing retrieval failures, measuring evidence quality, and testing targeted fixes before changing the whole RAG pipeline.

Your RAG System Retrieved the Wrong Evidence. Now What?

When a Fluent Answer Is Still Wrong

Imagine asking an AI assistant, "Can a travel reimbursement request be accepted more than 30 days after the trip?"

The system searches the policy documents and retrieves a paragraph describing the standard 30-day deadline. However, it misses a separate rule allowing extensions for delayed fieldwork documentation. The language model then generates a confident answer based on incomplete evidence.

The answer sounds reasonable. It may even be grammatically perfect. But it is wrong, or at least incomplete.

This is one of the central challenges in Retrieval-Augmented Generation (RAG): generating a good answer depends not only on the language model but also on whether the system retrieves the right information in the first place.

Retrieval-Augmented Generation combines information retrieval with text generation. Instead of relying exclusively on knowledge encoded in a model's parameters, it retrieves relevant information from an external knowledge source and supplies that information to the model when generating a response.

However, adding a retrieval component does not automatically make a language model reliable. A system can retrieve irrelevant passages, overlook critical evidence, supply contradictory information, or provide so much context that the model struggles to identify what matters.

So, when your RAG system retrieves the wrong evidence, what should you do?

The answer begins with understanding where the failure occurs.

1. Understanding Where RAG Goes Wrong

A typical RAG pipeline consists of two major stages: retrieval and generation. In practice, it also includes document preparation, indexing, and context construction.

The process generally looks like this:

User query → Document retrieval → Context selection → LLM generation → Final answer

During indexing, documents are divided into smaller text segments, commonly called chunks. In a dense retrieval system, an embedding model converts these chunks into numerical representations that capture semantic relationships. The resulting vectors are stored in a vector database or search index. Lexical retrieval uses a different representation, such as an inverted index.

When a user submits a query, the system searches for relevant chunks, selects a subset, and passes them to a language model. The model uses the retrieved information to construct an answer.

Every stage introduces potential failure points.

For example, the correct information might never enter the index. Alternatively, it may be indexed successfully but ranked too low to appear among the retrieved results. Even when the correct passage is retrieved, the generation model may ignore it or draw an unsupported conclusion.

This distinction matters because retrieval failure and generation failure require different solutions.

Improving the language model will not necessarily solve a retrieval problem. Similarly, changing the embedding model will not fix an answer-generation problem if the necessary evidence is already present in the context.

The first step, therefore, is to diagnose the failure rather than immediately change the entire pipeline.

2. Why Does a RAG System Retrieve the Wrong Evidence?

2.1 Semantic Similarity Is Not the Same as Relevance

Many RAG systems use dense retrieval, in which queries and documents are represented as embeddings. The system identifies documents whose vectors are close to the query vector according to a similarity measure.

This approach is useful because a query and a document can express the same idea using different words.

However, semantic similarity does not guarantee that a document contains the specific evidence needed to answer a question.

Consider the query:

"What is the maximum reimbursement limit for international travel?"

A search system might retrieve documents discussing international travel expenses, accommodation, or travel insurance. These documents are topically relevant, but they may not contain the reimbursement limit.

This is particularly problematic when a question includes exact identifiers, technical terminology, numerical thresholds, dates, or policy exceptions.

A dense retriever may recognize the general meaning of a query while missing a critical detail.

The lesson: a relevant-looking document is not necessarily an answer-bearing document.

2.2 Chunking Can Destroy Context

Large documents are usually divided into smaller chunks because processing entire documents can be expensive and inefficient. However, chunking introduces a difficult trade-off.

If chunks are too large, they may contain multiple unrelated topics, increasing noise and reducing retrieval precision. If chunks are too small, they may lose the context needed to interpret their contents.

For example, consider the following sentence extracted from a policy document:

"The limit increases to $5,000 under these circumstances."

Without the preceding paragraph, a retriever may not know which limit is being discussed, which circumstances apply, or whether the statement refers to an individual or an organization.

The chunk might contain the right number but lack the information necessary to answer the question correctly.

Chunk boundaries can also separate a heading from its explanation, divide tables from their labels, or disconnect a question from its answer.

Consequently, chunking should not be treated as a simple preprocessing step. It directly affects what the retrieval system can find and what the language model can understand.

2.3 Embedding Models Have Limitations

Embedding models are trained to represent semantic relationships, but different models perform differently across domains and query types.

A general-purpose embedding model might work reasonably well for everyday questions but struggle with specialized medical terminology, legal clauses, programming documentation, or scientific literature.

The problem can become more noticeable when the user's query differs significantly from the language used in the knowledge base.

For example, a user might ask, "Why does the application keep crashing?" while the relevant documentation describes "unexpected process termination."

A strong embedding model may recognize the relationship. A weaker one might rank unrelated troubleshooting documents higher.

This means embedding quality should be evaluated against the actual retrieval task rather than assumed from a model's general reputation.

2.4 Relevant Evidence May Be Ranked Too Low

Retrieval systems typically return a limited number of documents or chunks, often represented by top-k. If the correct passage is ranked below that cutoff, the language model never receives it.

Suppose the relevant passage ranks 12th, but the pipeline retrieves only the top five results. The information exists in the knowledge base, yet the final answer cannot reliably use it.

Increasing top-k may help, but it is not a universal solution. More retrieved passages can introduce irrelevant information, increase latency and cost, and make it harder for the generation model to identify the most important evidence.

3. How Wrong Evidence Leads to Hallucinations

Hallucination is often discussed as though it were exclusively a language-model problem. In RAG systems, however, retrieval and generation can interact to produce unsupported answers.

Consider three scenarios:

  • Missing evidence: The system fails to retrieve the passage that directly answers the question.
  • Misleading evidence: The retrieved passages are related to the query but describe a different policy, item, date, or condition.
  • Conflicting evidence: The retrieved passages contain inconsistent information, and the system fails to recognize the disagreement.

In each case, the language model may generate an answer that sounds plausible without being adequately supported by the available evidence.

For instance, suppose a knowledge base contains two versions of a leave policy. An older document allows 15 days of annual leave, while a newer document allows 20 days. If the system retrieves only the older version, the model may confidently provide an outdated answer.

Even if the model generates a statement that is consistent with the retrieved passage, the response can still be incorrect relative to the current policy.

This highlights an important distinction: an answer can be faithful to retrieved evidence without that evidence being correct, complete, or up to date.

A reliable RAG system must therefore evaluate both what it retrieves and what it generates.

4. Diagnose Before You Optimize

When a RAG system produces an incorrect answer, the most useful question is not simply, "Why did the LLM hallucinate?"

Instead, investigate the pipeline stage by stage.

Step 1: Check Whether the Correct Information Exists

Start by inspecting the original knowledge base.

Is the required information present? Was the document parsed correctly? Were important sections, tables, footnotes, or metadata lost during extraction? Was the correct document included in the indexing process?

If the evidence is missing from the index, changing the retriever will not solve the underlying problem.

Step 2: Inspect the Retrieved Results

Run the original query and inspect the retrieved chunks, including their ranking and similarity scores.

Ask three questions:

  1. Was the correct evidence retrieved at all?
  2. If it was retrieved, where did it rank?
  3. Were irrelevant or contradictory passages ranked above it?

This inspection helps distinguish a missing candidate from a ranking failure, where the evidence is available among the candidates but does not reach the final context.

Step 3: Evaluate the Generated Answer Separately

Next, examine the exact context supplied to the LLM and compare it with the final answer.

If the relevant evidence was retrieved but the model ignored it, misinterpreted it, or introduced unsupported details, the problem may lie in context construction, prompt design, or generation.

If the necessary evidence never reached the model, focus on retrieval first.

Step 4: Build a Small Evaluation Dataset

Create a representative collection of questions with known relevant documents or passages and, where appropriate, reference answers.

Include straightforward questions, questions requiring exact numerical details, multi-part questions, queries involving terminology variations, and questions for which the knowledge base does not contain sufficient evidence.

Use a development or validation set for repeated comparisons, and reserve a separate test set for a final check. This makes it possible to measure improvements without repeatedly tuning on the final test questions.

5. Measure Retrieval Quality Instead of Guessing

A RAG pipeline needs evaluation at multiple levels. No single metric can capture every aspect of retrieval and generation quality.

Retrieval metrics

Several established information-retrieval metrics are particularly useful.

Recall@k measures the proportion of known relevant documents or passages retrieved within the top k results. It helps answer: did the system find the evidence? Its interpretation depends on the completeness of the relevance judgments.

For a query with four relevant passages, if the top-five results contain three of them, Recall@5 is 3/4, or 0.75.

Precision@k measures the proportion of the top k retrieved results that are relevant. It helps answer: how much of what the system retrieved is actually useful?

If two of the top five results are relevant, Precision@5 is 2/5, or 0.40.

Mean Reciprocal Rank (MRR) averages the reciprocal rank of the first relevant result across queries. A first relevant passage at rank 4 contributes 1/4; a query with no relevant result within the evaluated cutoff contributes zero. It is useful when finding one answer-bearing passage early matters.

Normalized Discounted Cumulative Gain (nDCG) evaluates ranking quality while accounting for result positions and graded relevance. It is useful when some passages are more relevant than others. Specify the rank cutoff and relevance scale when reporting it.

These metrics answer different questions. A system can achieve high recall while returning too much irrelevant information. Another can achieve high precision but miss important evidence.

The appropriate balance depends on the application.

Generation and end-to-end metrics

Retrieval metrics alone cannot determine whether a RAG system generates reliable answers.

Additional evaluation dimensions include:

  • Faithfulness: Is the answer supported by the supplied context?
  • Answer relevance: Does the response address the user's question?
  • Correctness: Does the answer agree with a trusted reference answer or verified facts?
  • Citation accuracy: Do the cited passages actually support the claims associated with them?

Frameworks such as Ragas provide metrics for context precision, context recall, faithfulness, and response relevancy. Their definitions and required inputs differ by metric, so they should not be treated as interchangeable with traditional Precision@k or Recall@k. Automated scores should be checked against human judgments and the requirements of the task.

The key is to evaluate retrieval and generation separately before relying on a single end-to-end score.

6. Practical Ways to Improve a Failing RAG Pipeline

Once the failure has been identified, improvements should target the specific weakness rather than introduce complexity indiscriminately.

6.1 Experiment With Chunking Strategies

Start by examining whether chunk boundaries preserve meaningful information.

Compare fixed-size chunking with structure-aware approaches that respect headings, paragraphs, sections, or document boundaries. For tables and structured documents, preserve the relationships between values and their labels.

Chunk size and overlap should be treated as experimental parameters rather than universal constants. Overlap can preserve context across boundaries, but excessive overlap may create redundant results and increase indexing costs.

Evaluate different configurations on the same validation questions. Measure retrieval quality alongside latency, token usage, and final-answer quality, then check the selected configuration on a separate test set.

The objective is not to find the smallest or largest possible chunk. It is to preserve enough context for accurate retrieval without introducing unnecessary noise.

6.2 Combine Semantic Search With Keyword Search

Dense retrieval captures semantic relationships, while lexical methods such as BM25 emphasize matching actual query terms.

These approaches can complement each other.

Semantic search may retrieve a document that discusses the same concept using different wording. BM25 may be more effective when the query contains a precise document code, error identifier, technical term, or phrase.

A hybrid retrieval system combines results from both methods and merges their rankings. Reciprocal Rank Fusion (RRF), for example, combines ranked lists using result positions, so their raw similarity scores do not need to be directly comparable.

Anthropic's 2024 article on Contextual Retrieval discusses combining embeddings and BM25, contextualizing chunks, and reranking results. It reports fewer retrieval failures in its evaluated configurations and datasets. That is evidence for testing the approach, rather than a guarantee for every RAG application.

Hybrid retrieval is particularly worth testing when a system must handle both natural-language questions and exact terminology.

6.3 Introduce a Reranking Stage

A first-stage retriever is designed to search efficiently across a large collection. It may prioritize recall by returning a relatively broad set of candidate passages.

A reranker performs a second-stage evaluation of those candidates against the query, typically using a model that scores query-document relevance more directly.

For example, the initial retriever might return 50 candidates. A reranker then reorders them and selects the most promising 5-10 passages for the generation model.

This can improve ranking quality when relevant evidence is present among the initial candidates but appears too low in the original ranking.

However, reranking cannot recover a passage that the first-stage retriever never retrieved. It also introduces additional computational cost and latency.

The practical objective is to find a balance between candidate recall, reranking quality, response time, and expense.

6.4 Preserve Context During Indexing

A chunk should ideally contain enough information to be understood independently or retain a reliable connection to its parent document.

Useful strategies include attaching document titles, section headings, document identifiers, dates, and other relevant metadata to indexed chunks.

Contextual Retrieval goes further by adding a short description that situates each chunk within its source document before indexing. This can help when an isolated passage is ambiguous.

For example, instead of indexing only:

"The limit increases to $5,000 under these circumstances."

the retrieval representation could also identify the source as a reimbursement policy and specify the relevant category or section.

The added context must be accurate. Generated descriptions should not introduce claims absent from the original document, and the system should preserve access to the original text for evidence and citations.

6.5 Improve Query Understanding

Sometimes the document collection is not the main problem. The query itself may be ambiguous, incomplete, or phrased differently from the source material.

Query rewriting can transform a conversational question into a more retrieval-friendly form. Query expansion can introduce relevant terminology or alternative expressions. For multi-part questions, decomposition can separate the request into smaller information needs.

For example, "Can I claim this if I submitted it late?" may require identifying what "this" refers to, which policy applies, and what the submission deadline is.

These techniques can help, but they also introduce risks. A rewritten query may change the user's intent or omit a critical constraint. Query transformations should therefore be evaluated on representative questions, not assumed to improve retrieval automatically.

6.6 Teach the System When Not to Answer

A trustworthy RAG system should not be forced to answer every question.

If the retrieved evidence is insufficient, the system should be able to request clarification, explain that the available documents do not establish an answer, or abstain from making a claim.

Similarity scores alone are not reliable universal confidence measures. A system should calibrate its abstention behavior using validation data, considering factors such as retrieval quality, evidence coverage, source reliability, and the consequences of an incorrect answer.

For high-stakes applications, human review may be necessary.

The goal is not merely to produce more answers. It is to produce answers that the available evidence can justify.

7. A Repeatable Workflow for Debugging RAG

These techniques are most effective when applied through a controlled evaluation process.

A practical workflow looks like this:

  1. Establish a baseline. Run a representative evaluation dataset through the existing pipeline and record retrieval metrics, answer quality, latency, and cost.
  2. Identify the failure stage. Determine whether the problem originates in document ingestion, chunking, retrieval, ranking, context construction, or generation.
  3. Change one component at a time. For example, compare fixed-size and structure-aware chunking while keeping the embedding model and evaluation dataset unchanged.
  4. Compare retrieval strategies. Test dense retrieval, BM25, hybrid retrieval, and reranking where appropriate.
  5. Evaluate the complete pipeline. A retrieval improvement is valuable only if it contributes to better answers or other meaningful application outcomes.
  6. Test difficult cases. Include ambiguous questions, missing evidence, contradictory documents, outdated policies, and queries involving exact identifiers.
  7. Monitor after deployment. User feedback, failed queries, retrieval traces, and periodic evaluation can reveal problems that were absent from the original test set.

This workflow makes RAG optimization more systematic. It also prevents a common engineering mistake: replacing several components simultaneously and then being unable to explain which change actually helped.

8. Follow the Evidence Through the Pipeline

RAG is often presented as a straightforward solution to the limitations of large language models. Yet its reliability depends on several interconnected components.

The quality of the source documents affects what can be retrieved. Chunking influences whether relevant information remains understandable. Retrieval determines which evidence reaches the model. Ranking and context construction affect what the model sees first. Generation determines whether that evidence is used faithfully.

A failure at any of these stages can compromise the final answer.

Lost in the Middle shows that the models and tasks evaluated in that study could be sensitive to where relevant information appeared in a long context. Providing more text did not ensure effective use of it. Likewise, BEIR evaluates retrieval across varied tasks and domains, showing why performance in one setting should not be assumed to transfer everywhere.

These findings point to a broader principle: measure RAG reliability across the entire evidence-to-answer process.

The best architecture will depend on the application. A small internal knowledge base may need little more than carefully prepared documents and a straightforward retriever. A large enterprise system may benefit from hybrid search, reranking, metadata filtering, contextual retrieval, and continuous evaluation.

Complexity should follow evidence of a problem, not precede it.

Fix the Evidence Before Blaming the Answer

When a RAG system retrieves the wrong evidence, the solution is rarely as simple as switching to a larger language model.

The failure may originate in missing documents, poor chunk boundaries, embedding limitations, weak ranking, ambiguous queries, or the generation model's inability to use the supplied context effectively.

A systematic approach begins by inspecting the evidence, measuring retrieval performance, isolating the failure stage, and testing targeted improvements. Techniques such as hybrid search, reranking, contextual chunking, and evidence-aware abstention can improve reliability when they address the underlying problem.

Ultimately, a successful RAG system is not the one that retrieves the most documents or generates the most convincing response. It is the one that consistently finds the evidence that matters and uses it to produce verifiable answers.

References

  1. Lewis, P., et al. (2020). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. Read source
  2. TensorFlow Ranking. Definitions of Precision@k, Recall@k, MRR, and nDCG. Read source
  3. Ragas. Metrics overview and definitions. Read source
  4. Anthropic (2024). Introducing Contextual Retrieval. Read source
  5. Thakur, N., et al. (2021). BEIR: A Heterogenous Benchmark for Zero-shot Evaluation of Information Retrieval Models. Read source
  6. Liu, N. F., et al. (2024). Lost in the Middle: How Language Models Use Long Contexts. Transactions of the Association for Computational Linguistics. Read source