// BLOG

Why most RAG projects underperform in production

December 5, 2024·Burhan PashaRAGAIEngineering
RAG / RETRIEVAL PIPELINE

The prototype works. Production does not.

A basic RAG pipeline takes about an afternoon to build. Chunk the documents, embed them, store them in a vector database, pull the top results for a query, hand them to a model with a prompt. The demo looks great. Then real users start asking real questions, and some of the answers come back confidently wrong.

On a scoping call, this is the gap I spend the most time explaining. The problem is almost never the basic architecture. It is that the decisions determining whether the system actually works, how documents get split, how retrieval scores relevance, what goes into the model's context, and what happens when nothing relevant was found, get left at their defaults instead of being treated as the core of the project. Most underperforming RAG systems were not designed. They were copied from a tutorial and shipped.

Chunking decides what the system can ever find

How you split a document determines what retrieval can surface later. A chunk that starts mid-sentence because it hit a character limit carries no coherent meaning. A chunk that covers three unrelated topics scores reasonably well for three different queries and gives a strong answer to none of them.

The right chunking strategy comes from the structure of the documents and the kinds of questions people will actually ask. Technical documentation with clear sections chunks differently than legal contracts. Support transcripts chunk differently than product manuals. Running one flat character-count split across every document type is usually the clearest sign that nobody actually looked at the documents before building the pipeline.

A few approaches consistently beat naive chunking. Semantic chunking splits on meaning boundaries rather than character counts. Structural chunking uses the document's own headings, paragraphs, and tables to set boundaries where that structure exists. Hierarchical chunking keeps a fine-grained chunk for retrieval alongside its parent section for generation, so the model gets the surrounding context along with the specific match. Which one is right depends on the documents in front of us, and the mistake is picking one before looking at them.

Retrieval has to be more than vector similarity

Plain top-match vector search is a starting point, not a finished system. It has known blind spots: a query phrased differently than the source document scores poorly even when the meaning is identical, a document with high word overlap but low actual relevance scores well anyway, and a question with several parts tends to retrieve content for one part while missing the rest.

Hybrid retrieval, combining dense vector search with sparse keyword search and reranking the merged results, consistently performs better than either method alone in the systems we have built. Dense search catches paraphrased or conceptual matches. Sparse search catches exact terminology that embedding models sometimes miss, which matters a lot in technical and regulated domains. A reranking pass applied to the combined results reorders them by how relevant they are to the question asked, instead of by similarity score alone. That difference is often the gap between a tool people trust and one they quietly stop using.

What goes into the model's context matters as much as what gets retrieved

Chunks that are individually relevant can still combine into a context that is contradictory, repetitive, or missing the connective detail needed to actually answer the question. A few decisions determine how well this works.

Ordering matters: content closer to the query generally belongs earlier in the context, though this needs to be checked against the specific model, since some attend more to the start and end of a context window than the middle. Deduplication matters: documents with near-identical sections produce near-identical chunks, and retrieving several of them wastes space and skews the answer toward whatever happened to be repeated. Source metadata, document name, section, date, needs to travel with the content, because grounding information next to the text it supports reduces the model's tendency to answer confidently from something it half-remembers instead of what was actually retrieved. And the system needs a defined behavior for when nothing relevant turns up. Left on its own, a model instructed to answer from context will often answer anyway, from training data, in a tone that sounds just as confident as a grounded answer. Explicit not-found handling is what prevents that.

Grounding is an architecture requirement, not a nice feature

A system people trust shows its sources. Every claim in an answer traces back to a specific source, and the interface shows that source so a person can check it. That means source metadata has to survive every processing step, the prompt has to instruct the model to cite in a format the system can parse, and the output layer has to render those citations somewhere a user will actually see them.

Most teams skip this because it adds real engineering work. It is also the single feature that determines whether the people using the system trust it enough to rely on it for anything that actually matters to their job. This is the same reasoning behind how we built Ezly: drafts come from a persona built on an uploaded knowledge base of a team's own case studies and offers, not from a model guessing at what the team would say, because unattributed output is not something a recruiter or salesperson can send to a client with confidence.

The documents nobody designed for

Every RAG system eventually hits a document it was not built for. A new file format, an oddly structured contract, a scanned page with messy OCR, a table that needs different handling than prose. Whether the system degrades gracefully or produces confident nonsense comes down to how the document processing layer was built in the first place.

A pipeline worth running classifies documents before processing them, applies a strategy suited to each type, flags anything outside known patterns for a person to look at, and logs its own decisions so a wrong answer can actually be traced and fixed. None of this is glamorous. It is also where most production RAG failures come from.

If you are building something on top of your own documents and want a second opinion on whether the architecture actually fits the problem, get in touch or start with a free automation audit.