Retrieval-Augmented Generation (RAG) at Scale: Optimizing Enterprise Vector Architecture and Data Pipelines

Written by A.T.

A RAG demo on 50 documents almost always works. The same system on 5 million documents often doesn’t. Here are the five failures that show up at scale, and the fix for each.

Failure 1: The ingestion is sloppy

Before a single search runs, documents have to be parsed, cleaned and split into chunks. PDFs with tables, scanned pages and slides break easily. One 2026 engineering write-up claims that most failures trace back to ingestion and chunking, not to the language model. Treat that as a practitioner’s view, not a measured law, but it matches what many teams report.

Fix: inspect real chunks by eye. Use structure-aware chunking (split by headings and sections) rather than fixed character counts, and keep titles and source details with each chunk.

Failure 2: Vector search alone misses exact terms

Embeddings find meaning but can miss a product code, a name or a clause number. Keyword search (BM25) has the opposite strength. A 2026 benchmark paper on text-and-table documents found that hybrid retrieval, combining BM25 and dense search through Reciprocal Rank Fusion, beat either method alone across all metrics and subsets, and recommended it as the minimum baseline.

Fix: use hybrid search.

Failure 3: The first results aren’t the best

The same paper found that adding a cross-encoder reranker, which rereads the top candidates and reorders them, gave the biggest improvement of any component tested: 17.2 percentage points on MRR@3 and 12.1 on Recall@5 over unreranked hybrid retrieval. Its authors note limits, including that all answers were numerical and documents weren’t chunked.

Fix: add a reranker, then measure its added latency and cost.

Failure 4: The system ignores who may see what

An enterprise index built without document-level access control can leak information, or force you to build a separate index for every group. One 2026 analysis warns that adding permissions after launch often means re-indexing everything.

Fix: store sensitivity and tenant metadata with each chunk from day one, and filter by the user’s permissions before results reach the model.

Failure 5: Nobody measures retrieval

If you only read the final answers, you can’t tell whether retrieval or generation caused a mistake. Evaluate retrieval separately, with a test set drawn from real user questions. Tools such as RAGAS measure properties like context precision and faithfulness.

Fix: build the evaluation set early, and keep adding failed production queries to it.

Choosing a vector store

A 2026 engineering overview describes the trade-offs this way:

  • pgvector (PostgreSQL): convenient if you already run Postgres and want joins, transactions and existing access controls. It needs careful tuning at high scale.

  • Qdrant: a purpose-built vector database, suggested for corpora in the 1 million to 100 million vector range where pgvector starts to strain.

  • Pinecone: managed, the easiest to operate if you don’t want to host it yourself.

  • Weaviate: has built-in hybrid search.

These are one author’s guidelines. Test with your own data.

What I’d do first

Before picking a fancier database, I’d fix chunking, switch to hybrid search and build an evaluation set. Those steps cost the least and, by the benchmark above, move quality the most. RAG also overlaps with how we keep sensitive data out of models, which we cover in our post on on-device AI and local LLMs.

Questions teams ask

Is RAG better than fine-tuning? They solve different problems. RAG supplies current or private facts at question time, and fine-tuning changes how the model behaves.

Do I need a reranker? Evidence suggests it helps a lot, but test its latency in your own pipeline.

How do I keep private documents private? Filter by permissions at retrieval time, using metadata stored with each chunk.

Source notes

Popular posts from this blog

Binance Hack: The Warning Signs Security Teams Had Already Seen

Megaspeed Spy Memo: What the Intelligence Report Says About Nvidia’s CEO

DeepSeek vs ChatGPT: Which AI Model Is Best for Coding, Writing, and Analysis?