Retrieval-augmented generation is easy to demo and hard to run. The tutorial version - split on 500 characters, embed, cosine similarity, top five - works beautifully on a clean corpus with no access control and no deadlines. Your corpus is not clean, your documents belong to different people, and half of them were scanned in 2019.
A RAG engineer is hired for the distance between those two situations.
What breaks in production, in order of frequency
- Parsing. The PDF pipeline drops table structure, so a number loses its column header and the model confidently misreads it.
- Chunking. Fixed-size splits cut clauses in half. Contract language, policy documents and specifications are hierarchical, and the chunker should be too.
- Permissions. The demo searched everything. Production must not, and post-filtering leaks.
- Freshness. Nobody defined how stale is too stale, so the index quietly drifts a quarter behind the source of truth.
- Ranking. Pure vector similarity retrieves topically related but useless passages. Hybrid search plus a reranker usually beats a better embedding model.
- No retrieval evals. Quality is discussed rather than measured, so every change is a guess.
What gets built
Ingestion
Layout-aware parsing, OCR where needed, table and structure extraction, deduplication, and a pipeline that is re-runnable and incremental rather than a one-off script someone ran in a notebook.
Chunking and indexing
Structure-aware splitting with overlap tuned against a real eval set. Metadata that supports filtering - source, owner, ACL, effective date, version. Hybrid BM25 plus dense retrieval, because keyword search still wins on identifiers, codes and names.
Retrieval
Pre-filtered by permission, reranked by a cross-encoder, with query rewriting for the cases where users type three words and mean a paragraph. Explicit handling of “the corpus does not cover this” - a system that refuses cleanly beats one that confabulates confidently.
Generation
Citations with spans, so a reviewer can check the claim against the source in one click. Groundedness checks that catch the answer that quietly went beyond its evidence.
Evaluation
Retrieval scored separately from generation. Recall@k and MRR on a labelled query set, groundedness and answer quality on top, both in CI.
Related
If the system needs to take actions rather than answer questions, see hire an agentic AI engineer. If the pain is cost, latency or eval coverage at the model layer, see hire an LLM engineer.