Most RAG demos look great until they hit real data. Here's what actually breaks in production and how to engineer around it.
Most RAG systems work beautifully in demos. They fall apart in production.
After building RAG systems across legal, semiconductor, manufacturing, and enterprise domains, we've accumulated a set of hard-won lessons that don't make it into the LangChain tutorials. This post covers the ones that matter most.
A typical RAG demo uses:
Production looks like:
The gap is enormous. Here's how we bridge it.
The most common mistake is using default chunking. Splitting documents at 512 or 1024 tokens without considering structure destroys context.
What works:
For legal documents, we chunk by clause. For technical manuals, by section. For emails, by message thread. One-size-fits-all fails.
Pure semantic search misses exact keyword matches. BM25 alone misses semantic similarity. The winner is hybrid:
final_score = α * bm25_score + (1 - α) * vector_score
Typical α values: 0.3–0.5. The right value depends on your domain — keyword-heavy technical docs lean toward BM25; conceptual questions lean toward vectors.
We also add a re-ranking step using a cross-encoder model after the initial retrieval. This adds ~200ms but measurably improves answer quality.
If your retrieval doesn't surface the right chunks, no amount of prompt engineering will save the answer. Always evaluate retrieval independently from generation.
Our evaluation loop:
A Hit@3 below 0.7 means your chunking or embedding needs work — not your prompt.
Enterprise RAG systems contain sensitive data. Every user should only retrieve chunks from documents they're authorized to see.
Common approaches:
We've seen companies skip this and create serious data leakage bugs. Build it from day one.
The full RAG pipeline involves:
Total: 800ms–2.5 seconds before streaming. For a chatbot, this feels slow.
Optimizations:
Even when retrieval is correct, LLMs can generate claims that aren't grounded in the retrieved context. We add a grounding check:
After generating an answer, extract the key claims and verify each claim appears (semantically) in the retrieved chunks. Flag answers with a low grounding score rather than surfacing them as confident.
Users trust a system that says "I'm not sure" more than one that confidently hallucinates.
A production-grade RAG system we build typically includes:
It's significantly more than a LangChain quickstart. But it's also what clients actually need.
If you're building a RAG system and want to talk through the architecture, reach out — this is one of our most common project types.