An interactive explainer for RAG builders
Retrieval is correct. The context is passed. The model has the facts in its window. And the answer is still wrong. This page walks through the six generation-side failures that separate people who can assemble a RAG pipeline from people who can debug one.
“Your RAG system retrieves the right documents but still gives wrong answers. Retrieval is correct. Context is being passed. The model has the information. Why is the answer wrong?”The question a senior engineer, fluent in LLMs, vector databases, embeddings, and fine-tuning, could not answer.
It stumps candidates because most RAG debugging intuition lives on the retrieval side: recall, chunking, embedding quality, reranking. But once the right text is in the prompt, a second, quieter set of failures takes over on the generation side. That is what the lab below simulates.
A user asks: “What is the refund window for annual plans?” The correct fact (retrieved perfectly every time) is: annual plans get a 45-day refund window. Pick a failure mode to see how the same correct context still produces a wrong answer, then apply the fix.
Long-context models attend most reliably to the start and end of the prompt. Facts buried mid-context get measurably less effective attention. Drag the slider to move the gold document through a 20-chunk context and watch its effective influence on the answer.
Practical takeaway: rerank so the most relevant chunk sits first or last, and keep total context tight. More retrieved chunks is often worse, not safer.
A senior-level answer is a debugging path, not a definition. When retrieval is verified correct, walk generation-side causes in this order: