Failure Modes in Retrieval
Goal
Debug a wrong RAG answer by following the retrieval pipeline in order and fixing the first step where the needed source, chunk, permission, query, or ranking result goes missing.
When a RAG answer is wrong, start with the source the answer needed and follow its journey. Do not tune the final prompt until you know where that source disappeared.
Use one running question:
What is the XR-8 warranty?
Step 1: did the right source enter the library?
If the current XR-8 policy was never ingested, no retriever can return it. Check the source inventory, ingestion status, version or update time, and deletion state.
Step 2: did chunking keep the useful sentence together?
The document may exist while the warranty sentence is split away from the product name or another sentence it depends on. Inspect the chunk text, neighboring chunks, metadata, and source-to-chunk mapping.
If the answer needs two adjacent chunks but the system or evaluation expects one, chunking may be the first broken step.
Step 3: was the chunk allowed for this request?
A permission or freshness rule may remove the chunk before ranking. That can be correct behavior. A missing result is not a retrieval bug when the user is not allowed to see the source.
Record the decision in plain terms:
eligible before scoring? yes/no
reason: ...
Step 4: did the search query keep the user's meaning?
Compare the original and rewritten queries. Check exact product codes, important dates, filters, and synonyms. A rewrite that drops XR-8 can make every later stage look healthy while searching for the wrong thing.
Step 5: did the first search stage rank the chunk high enough?
Now inspect the scores and versions used by keyword, embedding, or hybrid search. Compare an exact-search reference with the approximate index when useful. This tells you whether the problem is the representation or the index behavior.
Step 6: did the candidate cutoff remove it?
Suppose the useful chunk is ranked 18th, but only the first 10 candidates are sent forward:
useful rank: 18
candidate limit: 10
The reranker never receives the useful chunk. Changing the reranker cannot fix a candidate it never saw.
Step 7: did reranking make the order worse?
If the chunk enters the candidate set at rank 3 but leaves the final top 5 after reranking, compare the before/after ranks and inspect the reranker. At this point the earlier stages delivered the right candidate, so the problem really did begin later.
The important debugging habit is simple: find the first stage where the useful source stops being available. Fixing that stage is usually more informative than changing the final answer prompt.