· 2 min read

Retrieval-augmented generation in production: lessons from a dozen deployments

Most RAG demos work. Most RAG products struggle. These are the patterns that separate the two.

Retrieval-augmented generation (RAG) — answering questions with a language model grounded in your own documents — is the most common AI project we are asked to build. A demo takes an afternoon. A system people trust takes considerably more. Here is what we have learned.

Retrieval quality is the product

When answers are wrong, the cause is usually retrieval, not the model. The right passage was never shown to it. Invest first in:

  • Chunking that respects structure. Split on headings and sections, not on fixed character counts, and keep tables intact.
  • Hybrid search. Combine keyword search (BM25) with vector similarity. Product codes, names and legal references are often found by keywords, not embeddings.
  • Re-ranking. A cross-encoder re-ranker on the top 50 candidates is one of the cheapest, largest accuracy improvements available.

Measure before you tune

Create a set of 100–300 real questions with reference answers and the documents that should be cited. Track retrieval recall and answer correctness separately. Without this, prompt changes become guesswork.

Permissions are not optional

Enterprise documents have access rules. Filter retrieved passages by the user's permissions before they reach the model — never rely on the model to withhold information.

Show your sources

Answers should cite the passages they rely on, with links. Citations let users verify, build trust faster and give you a feedback signal when they click through and find the answer was wrong.

Plan for "I don't know"

A system that admits uncertainty is more useful than one that guesses confidently. We set retrieval-score thresholds below which the assistant says it could not find an answer and offers to route the question to a person.

Operate it like software

Version prompts, models and indexes; log every query with the retrieved context; and re-run the evaluation set before each release. RAG systems drift as documents change, so schedule re-indexing and monitor answer quality continuously.

Keep reading

Have a project in mind?

Tell us what you are building. A senior engineer will reply within one business day with questions, ideas and an honest view of how we can help.