AI & Data

Retrieval-augmented generation: architecture that holds up in production

A working retrieval pipeline is straightforward. Making it reliable enough to trust with business questions is where the engineering is.

Key takeaways

  • Every pipeline stage leaks quality — measure them separately.
  • Structure-aware chunking usually beats changing the model.
  • Hybrid retrieval plus reranking outperforms vector search alone.
  • Passage-level citation and an explicit refusal path build trust.

The pipeline and where it leaks

A retrieval system chunks documents, embeds them, stores the vectors, retrieves candidates for a query, reranks them and passes the best to a language model with instructions to answer only from what it was given.

Each stage leaks quality. Chunks that split a table from its caption lose meaning. Embeddings that do not match the domain retrieve plausible but wrong passages. A model given weak context will still produce a confident answer.

Chunking is the underrated decision

Fixed-size chunking is simple and frequently wrong, cutting mid-sentence and separating headings from content. Structure-aware chunking — splitting on document sections and keeping headings with their body — is usually a larger improvement than changing the model.

Retain metadata with each chunk: source document, section, effective date and access permissions. Without it you cannot cite properly or filter reliably.

Retrieval quality beats model choice

  • Hybrid search combining keyword and vector retrieval outperforms either alone for most corpora.
  • A reranking step over a larger candidate set materially improves precision.
  • Filter by metadata before ranking — recency and permissions especially.
  • Measure retrieval separately from generation, or you cannot tell which stage failed.

Grounding and refusal

Require citation to a specific passage, not a document. If the system cannot point at supporting text, it should decline rather than answer. This constraint removes most fabricated detail because it makes fabrication structurally difficult.

Build an explicit refusal path. A model with no better option will attempt an answer; give it one, and users will trust the answers it does give.

Handling permissions and freshness

Two production concerns are routinely deferred and both are difficult to retrofit. The first is access control: retrieval must filter by the asking user's permissions before ranking, not after, or the system will surface content the user should not see.

The second is freshness. Documents change and are superseded, and a corpus without an update pipeline drifts steadily out of date while continuing to answer confidently.

Build both into the ingestion design: carry permissions and effective dates as metadata on every chunk, and re-index on source change rather than on a schedule that guesses.


Frequently asked questions

For modest corpora, a vector extension on your existing database avoids operating another system. Dedicated stores earn their place at larger scale or where advanced filtering and hybrid search matter.

Large enough to carry meaning, small enough to be precise often a few hundred tokens with overlap. Test against your own evaluation set rather than adopting a default.

Rarely for knowledge tasks. Retrieval supplies the knowledge; fine-tuning is more useful for output format, tone or a narrow classification task.

Working on this?

A conversation with our team, no charge and no obligation.

Book a conversation