Every tutorial makes Retrieval-Augmented Generation look simple. Embed your documents, store them in a vector database, retrieve the top-k chunks, stuff them into a prompt. Demo works in an afternoon.
Then you try to ship it. Answers hallucinate. Retrieval misses obvious documents. Latency blows past your SLA. Costs triple when real users hit the system. The "afternoon project" becomes a six-month engineering effort.
The gap between demo RAG and production RAG is enormous, and almost nobody talks about it honestly.
Your chunking strategy determines retrieval quality more than your embedding model does. Get it wrong and your retriever returns fragments that lack context or chunks so large they dilute the signal.
| Strategy | How it works | Best for | Watch out for |
|---|---|---|---|
| Fixed-size | Split every N tokens with overlap | Uniform content, quick start | Breaks mid-sentence, ignores structure |
| Semantic | Split on topic boundaries using embeddings | Long-form articles, reports | Slower, variable chunk sizes |
| Parent-child | Small chunks for retrieval, return the parent section | Technical docs, legal text | More complex indexing and storage |
| Document-aware | Split on headings, sections, or page breaks | Structured documents (PDFs, wikis) | Requires format-specific parsers |
There is no universal best strategy. Start with fixed-size (512 tokens, 20% overlap) as a baseline. Measure retrieval quality. Then iterate.
Your chunking strategy matters more than your embedding model. A mediocre embedder with good chunks beats a state-of-the-art embedder with bad chunks every time.
Most teams skip retrieval evaluation entirely. They eyeball a few queries, see reasonable-looking results, and move on. Then production users ask questions the team never tested, and the system returns irrelevant garbage.
Build an eval harness before you optimise anything else:
Run this eval on every change: new embedding model, different chunking, updated documents. Without it, you're tuning blind.
If you can't measure retrieval quality, you can't improve it. Build your eval harness before you optimise your pipeline.
RAG tutorials assume your documents are static. In production, they aren't. Policies update. Product docs change. Knowledge bases grow. If your RAG system serves stale content, it's worse than useless because users trust it.
Production RAG requires a proper ingestion pipeline:
This is data engineering, not AI engineering. Treat it accordingly.
Demo-scale RAG costs almost nothing. Production-scale RAG with real traffic gets expensive fast.
Embedding compute. Re-embedding a 100K document corpus on every update is wasteful. Cache embeddings, re-compute incrementally, and batch embedding calls.
Vector database sizing. Millions of vectors need careful index tuning (HNSW parameters, quantisation settings). Over-provisioned indexes waste memory. Under-provisioned indexes degrade recall.
LLM inference. Every retrieval-augmented call sends retrieved chunks as context. More chunks means more input tokens means higher cost and latency. Find the minimum context window that maintains answer quality.
Caching. Identical or near-identical queries hit production systems constantly. Semantic caching (embedding-based similarity on queries) can eliminate redundant LLM calls and cut costs dramatically.
| Cost lever | Impact | Effort |
|---|---|---|
| Incremental re-indexing | Reduces embedding compute 10-50x | Medium |
| Semantic query caching | Eliminates 20-40% of LLM calls | Low |
| Chunk count tuning (top-k) | Direct reduction in token cost per request | Low |
| Vector quantisation | Reduces memory and storage costs 2-4x | Medium |
RAG cost scales with corpus size, query volume, and context window. Optimise all three independently. The cheapest token is the one you never send.
Production RAG needs guardrails that demos don't:
Production RAG is three systems pretending to be one: a data pipeline, a search engine, and a language model orchestrator. Treating it as "just an LLM feature" is why most RAG projects stall after the demo.
Build the eval harness first. Invest in the ingestion pipeline. Monitor retrieval quality in production. The LLM is the easy part.