RAG in Production: From Demo to Reliable System
Sofia Reyes
AI Engineering Lead
Every AI team has a RAG demo that answers questions beautifully — on three documents. Production is where retrieval-augmented generation gets honest.
Why demos fail in production
- Data grows. 3 PDFs → 40,000 chunks across many sources.
- Queries get adversarial. Users ask things the docs never say.
- Chunks get stale. Documents change, vectors don't update themselves.
- Costs explode. Every retrieval is a database query plus an LLM call.
The production checklist
1. Chunking is a design decision
Fixed-size chunks are a starting point. Real systems use structure-aware chunking: headings, sections, tables, and metadata-rich boundaries.
2. Embeddings need versioning
When you change your embedding model, every vector changes. Version your embeddings, and backfill with batch jobs.
3. Retrieval needs a reranker
Top-k by cosine similarity is not enough. A cross-encoder reranker typically improves answer quality 15–30% and should be table stakes.
4. Evaluate continuously
Build a golden set of 100–200 realistic Q&A pairs. Track retrieval precision and answer faithfulness on every model or chunking change.
5. Guardrails on cost and latency
Cache identical queries, cap context windows, stream answers, and watch per-query cost. A RAG call that costs $0.05 × 1M users is a line item your CFO notices.
6. Observability from day one
Trace the full path: query → embedding → vector search → rerank → prompt → LLM → answer. When a user says "this is wrong", you need the whole chain.
The infrastructure angle
This is where platform engineering meets AI. Vector databases (Pinecone, pgvector, Weaviate) need scaling, backups, and failover. The RAG service needs autoscaling, secrets, and CI/CD. LLM providers need keys in Vault, not env files.
Production RAG is an infrastructure problem wearing an AI costume. Get the platform right and the AI has a chance.
Sofia Reyes
AI Engineering Lead at NxtPrism