Why Your RAG System Gives Wrong Answers (And How to Fix It)
The Gap Between a RAG Demo and a RAG System
Retrieval-augmented generation looks simple in a tutorial. You load some documents, chunk them, embed them, drop them in a vector database, and let the model answer questions against them. It works on the first try, and it feels like magic.
Then you point it at your actual documents, your actual users start asking real questions, and the wheels come off. The model confidently answers using the wrong document. It misses information that’s clearly in the corpus. It cites a source that doesn’t say what the answer claims. None of this is a mystery once you understand what’s actually happening under the hood, but almost nobody explains the failure modes until you’ve already hit them.
This guide walks through the parts of a RAG pipeline that tend to break in practice, and what to check when they do.
Chunking: The Decision That Quietly Determines Everything
Chunking is the process of splitting your source documents into smaller pieces before embedding them. It seems like a formatting detail. It is not. Chunking strategy determines what the retriever is even capable of finding.
Fixed-size chunking is a trap
Splitting text every 500 or 1000 tokens regardless of content is the default in most starter code, and it’s also the fastest way to break your retrieval quality. Fixed-size chunks routinely slice sentences in half, separate a heading from the paragraph it introduces, and split a table from its caption. When that happens, the embedding for that chunk represents a fragment of an idea instead of the idea itself, and similarity search starts returning near-misses instead of the right answer.
What to do instead
- Chunk along natural boundaries first: headings, paragraphs, list items, table rows. Structure-aware splitting almost always outperforms fixed character counts.
- Keep chunks small enough to stay topically coherent but large enough to retain context. There’s no universal right size. Test with your actual content.
- Add overlap between chunks so that ideas spanning a boundary aren’t lost entirely to one side or the other.
- Preserve metadata with every chunk: source document, section title, date, and page or line number. You’ll need this later for both citation and debugging.
Embedding: Garbage In, Garbage Retrieved
Embeddings turn text into vectors that capture semantic meaning, and retrieval works by finding vectors close to the query’s vector. This step fails quietly, which makes it dangerous. A bad embedding doesn’t throw an error. It just returns plausible-looking but wrong results, and you may not notice for weeks.
Common embedding mistakes
- Mismatched embedding models. If you change embedding models after your index is already built, old and new vectors are no longer comparable in any meaningful way. Re-embed the entire corpus when you switch models, not just new content.
- Embedding noisy text. Boilerplate, navigation menus, headers and footers, and repeated legal disclaimers all get embedded right alongside your actual content unless you strip them out first. This pollutes the vector space and wastes retrieval slots on junk.
- Ignoring domain vocabulary. General-purpose embedding models can struggle with dense technical or legal language where subtle wording differences carry real meaning. If your domain is specialized, test retrieval quality specifically on the jargon-heavy parts of your corpus, not just the easy passages.
Retrieval: More Isn’t Better
Once documents are chunked and embedded, retrieval is the step where a user’s query gets matched against your stored vectors to pull back the most relevant chunks. This is where most people assume the hard work is done. It isn’t.
The top-k trap
It’s tempting to just retrieve more chunks to be safe, on the theory that more context can only help. In practice, stuffing the model’s context window with marginally relevant chunks does two things: it drowns the genuinely relevant chunk in noise, and it increases the odds the model latches onto the wrong one. More retrieved context is not the same as better retrieved context.
Pure similarity search misses obvious matches
Vector similarity is good at finding conceptually related text, but it’s surprisingly bad at exact term matching. If a user asks about a specific product code, error message, or proper noun, a pure embedding search can return semantically similar but factually irrelevant chunks while missing the document that contains the exact term. This is why many production systems combine vector search with keyword-based search and merge the results, rather than relying on embeddings alone.
Reranking matters more than people expect
Initial retrieval is usually a first pass optimized for speed, not precision. Adding a reranking step, where a smaller, more targeted model reorders the retrieved candidates by actual relevance to the query, often produces a noticeably better final answer than just taking the raw top results from vector search.
Evaluation: The Step Everyone Skips
Most RAG projects get built, demoed once or twice on friendly questions, and shipped. Then they degrade silently over time as the underlying documents change, and nobody notices until a user complains about a wrong answer.
Build a test set before you need one
Write down a set of real questions your users are likely to ask, along with what the correct answer should be and which source document it should come from. This doesn’t need to be large to be useful. Even twenty to thirty well-chosen question-answer pairs, covering your trickiest edge cases, will catch regressions that casual testing never will.
Evaluate retrieval and generation separately
When a RAG system gives a wrong answer, there are two very different possible causes: the retriever pulled back the wrong chunks, or the retriever did its job correctly but the model misread or misused good context. These require completely different fixes. Log which chunks were retrieved for every query so you can tell the difference instead of guessing.
Watch for silent corpus drift
Documents change. Policies get updated, prices change, product specs get revised. If your index isn’t refreshed on a schedule, your RAG system will keep confidently citing outdated information as if it were current. Set a re-indexing cadence that matches how often your source material actually changes.
The Failure Mode Nobody Warns You About
The most dangerous outcome in a RAG system isn’t a wrong answer with no source. It’s a wrong answer delivered with a confident, specific-sounding citation. Because the model is grounded in retrieved text, its answers carry an air of authority that raw hallucinations don’t have. Users trust cited answers more, which means an error here does more damage than an obvious guess would.
The fix isn’t a single trick. It’s treating each layer of the pipeline (chunking, embedding, retrieval, and evaluation) as something to test and monitor on its own, rather than assuming that if the demo worked, the system works. RAG systems that hold up in production are the ones where someone went looking for the failure modes before a user found them first.
For the complete, structured playbook on this topic, see RAG for Practitioners in our library. New here? Start with our free guide.