DeviAI
All notes

AI & ML · 2026-02-10 · 9 min read

RAG Pipelines in Production: Lessons Learned

We've built RAG systems that serve thousands of queries daily. Here are the hard-won lessons that documentation won't teach you.

Retrieval-Augmented Generation (RAG) is the most practical AI pattern in production today. It lets you ground LLM responses in your own data without fine-tuning. But production RAG is very different from tutorial RAG.

Chunking Strategy Matters More Than Model Choice

The biggest lever in RAG quality isn't the embedding model or the LLM — it's how you chunk your documents. We've experimented with dozens of chunking strategies and settled on a hybrid approach:

  • →Semantic chunking for narrative content (blog posts, documentation)
  • →Structured chunking for tabular data (product specs, pricing tables)
  • →Sliding window with overlap for code and technical content

Retrieval Is the Bottleneck

If your retrieval step returns irrelevant context, no amount of LLM sophistication will save you. We use a multi-stage retrieval pipeline:

1. Broad retrieval — Vector similarity search returns top-50 candidates 2. Re-ranking — A cross-encoder model re-ranks candidates for relevance 3. Filtering — Business logic filters (access control, recency, source quality) 4. Selection — Top-5 chunks are passed to the LLM

This pipeline consistently outperforms single-stage retrieval by 30-40% on relevance metrics.

Monitoring RAG Quality

The hardest part of production RAG is knowing when it's wrong. We implement automated quality monitoring:

  • →Retrieval relevance scoring on every query
  • →Answer faithfulness checks (is the answer supported by retrieved context?)
  • →User feedback integration (implicit and explicit)
  • →Automated regression testing with golden query sets

The Stack We Use

Pinecone or Weaviate for vector storage, depending on scale. OpenAI or Cohere embeddings. Claude or GPT-4 for generation. FastAPI for the API layer. Redis for caching frequent queries.

Build simple, measure everything, iterate based on data. That's production RAG.

Written by

Hari — Devi AI Solutions