What is a production RAG system?
A production RAG (retrieval-augmented generation) system is an LLM application that answers questions from your own documents. At query time it retrieves the most relevant passages, cites them in the answer, and declines to answer when nothing relevant is found. Its retrieval accuracy is measured against a golden set of real questions before every release. Five techniques take a RAG demo to that standard: structure-aware chunking, hybrid search, re-ranking, grounded answers with citations, and continuous evaluation.
If you are still deciding whether RAG is the right approach, read RAG vs fine-tuning first.
Why the demo works and production doesn’t
Production RAG that doesn’t hallucinate depends on two things: retrieving the right passage, and measuring whether you did. A basic pipeline takes an afternoon to build and demos beautifully, because the person demoing it asks questions they already know the documents answer well. Real users don’t. They use different vocabulary, refer to things indirectly and ask about content spread across several documents.
So retrieval quality decides almost everything. Give a strong model the wrong passage and you get a fluent, confident, wrong answer. That’s worse than no answer, because it’s harder to catch and more likely to be believed.
Chunking is where most teams go wrong first
The standard advice is to split documents into fixed-size chunks with some overlap. It’s easy to implement, and it’s the reason so many RAG systems underperform. Fixed-size chunks cut arguments in half and separate claims from the conditions that qualify them.
We chunk on document structure instead. Contracts split on clauses, documentation on sections, and support tickets stay whole as conversations. When a chunk needs surrounding context to make sense, attach that context as metadata. Don’t count on the retriever also picking up the neighbouring chunk.
- Split on semantic boundaries such as sections, clauses and conversations
- Attach the document title and section path to every chunk as metadata
- Keep tables in one piece instead of splitting them across chunks
- Store a parent-document reference so you can pull full context when it’s needed
Hybrid retrieval beats pure vector search
Vector search is good at meaning and bad at exact matches. Ask about part number "XR-4400B" and semantic search will happily return passages about similar products while missing the one document that actually names it.
Combining vector search with keyword search and metadata filtering fixes this. Semantic search handles paraphrase and intent. Keyword search catches identifiers, names and quoted phrases. Metadata filters narrow the pool by date, document type or permission scope before ranking starts.
Anthropic’s Contextual Retrieval research (September 2024) measured this. Adding a short context to each chunk before embedding, and pairing that with BM25 keyword search, cut the top-20 retrieval failure rate by 49%, from 5.7% to 2.9%.
Re-ranking is the cheapest quality win
Retrieval returns candidates ranked by embedding similarity, which is only a rough proxy for relevance. Quite often the correct passage sits at rank eight or eleven. It was retrieved, but the model never saw it because only the top five were passed through.
A cross-encoder re-ranker scores each candidate directly against the query instead of comparing pre-computed vectors. It’s slower per document, which is why you run it on twenty candidates rather than twenty thousand. In our experience it is consistently the single highest-return improvement you can make to a RAG pipeline. In the same Anthropic study, adding a re-ranking step took the reduction to 67%, with failures falling to 1.9%.
| Retrieval setup | Good at | Misses | When to use |
|---|---|---|---|
| Vector search only | Paraphrase and intent | Exact identifiers such as XR-4400B, names, quoted phrases | Prototypes |
| Hybrid (vector + BM25 + metadata filters) | Paraphrase and exact matches, permission scoping | Correct passages ranked below the top-k cut-off | Baseline for production |
| Hybrid + cross-encoder re-ranking (top 20 candidates) | Moves the right passage into the top 5 | Adds re-ranker latency to each query | Any user-facing system |
Grounding, citations and knowing when to refuse
A production system has to be able to say no. Tell a system to always answer and it will, even when retrieval found nothing relevant. That’s exactly the situation where a confident answer does damage.
Restrict answers to the retrieved context, require a citation for every substantive claim, and tune a relevance threshold below which the system says it can’t find the information. Users trust a system that admits uncertainty far more than one that has been confidently wrong twice.
Refusal matters even more when retrieval feeds an AI agent that takes actions, not just one that answers questions.
Measure retrieval with a golden set
You can’t improve retrieval quality you aren’t measuring, and you won’t notice when it slips. Every RAG system we ship comes with a golden set of questions and their known-correct source passages, taken from real user queries wherever we can get them.
We score every configuration change against that set before release, and that is what makes iteration safe. You can try an aggressive chunking change, and if it causes a regression you see it as a number before release. Without the set, you’d find out from a support ticket three weeks later.
- Retrieval recall: is the correct passage in the candidate set at all?
- Ranking precision: does it make it into the passages the model actually uses?
- Groundedness: is every claim in the answer backed by a cited passage?
- Refusal accuracy: does the system decline when it should?
How do you enforce document permissions in RAG?
Enforce permissions at retrieval time, never at answer time. Store each document’s access list as chunk metadata and filter on the requesting user’s groups before ranking starts, so a passage the user cannot open never reaches the model. Filtering the answer afterwards is too late, because the model has already read the restricted text and can paraphrase it.
Sync access lists from the source system (SharePoint, Google Drive, Confluence) on the same schedule as content, so a revoked permission takes effect at the next sync instead of the next rebuild.
What does a production RAG system cost?
A focused RAG assistant over a single document collection usually costs $18K to $35K to build. Enterprise systems that span several sources with access control and compliance review run $45K to $110K.
After launch, expect vector database hosting of about $70 to $600 a month at typical scale, monitoring of $100 to $400 a month, and model usage that grows with the number of questions. Budget 15% to 25% of the build each year for tuning and model updates. We quote a fixed price after a free discovery call. If you would rather have this built than build it yourself, see our RAG development services.
How do you monitor a RAG system after launch?
A RAG system that passed its golden set on launch day can still drift, because documents change and users ask new kinds of questions. Monitoring catches that before your users do.
- Log every query with the passages retrieved and the answer given
- Track the refusal rate and how often users rephrase the same question, both early signs of retrieval gaps
- Review a sample of low-confidence answers every week
- Add every confirmed failure to the golden set, so the same mistake cannot ship twice
Frequently asked questions
How accurate can a RAG system realistically be?
Well-built systems over a well-maintained corpus typically reach 90 to 96% answer accuracy in our builds on questions the documents actually cover. Most of the remaining errors are retrieval failures on ambiguous phrasing. Model failures are rarer, which is why retrieval work improves accuracy more than model upgrades do.
Which vector database should we use?
For most workloads, pgvector inside your existing PostgreSQL is enough, and you avoid adding another system. Pinecone, Weaviate and Qdrant earn their place at very large scale or when you need specific filtering behaviour. The database is rarely the bottleneck. Chunking and re-ranking usually are.
How often does the index need rebuilding?
Update it incrementally as documents change, and automate that as part of the ingestion pipeline. You only need a full rebuild when you change the embedding model or the chunking strategy, and either change should be tested against the golden set first.
Need a RAG system your users can trust?
Book a free discovery call with our team in San Jose or Perth. We look at your documents and permissions, then send a fixed-price quote for a production RAG system.
Book a free discovery call