Feed a top model a 200 page compliance manual and ask about Section 14.3. You get a confident, well structured answer that is partly fabricated. Bigger context windows did not fix this. They moved the problem.
We built a Retrieval Augmented Generation system for a client managing more than 50,000 documents across regulated industries. Accuracy went from 96% to 99%, LLM cost dropped 96%, and the system freed 340 hours a month of manual document review. This is the production architecture, refreshed for the 2026 stack, with the engineering decisions that actually moved the numbers.
Key Takeaways
- RAG retrieves only the relevant fragments before generation, so a query sends 2,000 to 4,000 tokens instead of 128,000. Cost drops over 95% and accuracy rises because every token in the context is relevant.
- Larger context windows did not retire RAG. Models still lose information in the middle of long inputs, a failure shown in Lost in the Middle where accuracy fell up to 20% when the answer sat in the middle third.
- RAG is now the main defense against hallucination. Grounded retrieval reduces hallucinations by around 80%, and uncertainty aware variants cut them a further 27.8% with 93.1% accuracy in financial question answering.
- Retrieval quality matters more than model choice. Two stage retrieval (fast search plus cross encoder reranking) lifted answer relevance 12%. Switching to a newer model lifted it 3%.
- The economics are decisive. At 500 queries a day, full document stuffing costs roughly $19,200 a month. The same workload on RAG costs about $680. A 96% reduction.
- RAG crossed into production critical in 2026: 45% of enterprises plan to deploy or expand it, yet only 17% attribute meaningful EBIT to GenAI. The gap is engineering, not models.
Why Large Documents Still Break LLMs
Every model has a context window, and in 2026 those windows are huge. That did not solve the problem. Three things still go wrong when you stuff a long document into a prompt.
- Cost scales with input length. You pay per token on every query. Sending 128,000 tokens per question at frontier pricing turns a 500 query a day system into roughly $19,200 a month on input alone.
- Accuracy degrades in the middle. Models read the start and end of a long context well and overlook the middle. The Lost in the Middle research measured drops of up to 20% when the answer was buried mid context.
- Noise drowns out signal. A 200 page document holds maybe two or three paragraphs relevant to any question, so sending the whole thing forces the model to act as a search engine.
RAG removes all three problems by retrieving only the relevant fragments before generation.
The Production RAG Architecture
A production RAG system runs six stages. Each one carries engineering decisions that decide the final answer quality.
- Ingest. Raw documents enter the pipeline. PDF extraction is the hard part: tables, multi column layouts, and headers all need handling. We use layout aware parsing plus custom preprocessing per format.
- Chunk. Documents split into fragments. This is the most underestimated stage. Get it wrong and everything downstream suffers.
- Embed. Each chunk becomes a vector that captures its meaning, so a question can be matched to fragments mathematically.
- Store. Vectors go into a database built for similarity search across millions of entries.
- Retrieve. A question is embedded, the closest chunks are found, and they are returned.
- Generate. Retrieved chunks enter the prompt as context, and the model answers grounded in those fragments.
The insight that governs everything: retrieval quality matters more than generation quality. A mediocre model with excellent retrieval beats a top model with poor retrieval. We spend about 70% of engineering effort on stages 2 to 5 and 30% on the generation prompt. Teams that invert that ratio wonder why their system hallucinates.

Retrieval Is Where RAG Wins or Loses
Most RAG systems succeed or fail on retrieval. The goal is to find the 3 to 8 most relevant chunks out of 2.1 million in under 200 milliseconds.
- Chunking decides the ceiling. Splitting text every 500 tokens cuts a regulatory requirement in half: one chunk says "Under Section 12, companies must" and the next says "submit quarterly reports within 30 days." We use recursive splitting at 1,000 tokens with 200 token overlap, breaking at section headers first, then paragraphs, then sentences. On our corpus that produced about 2.1 million chunks and outperformed fixed size chunking by 18% on relevance.
- Two stage retrieval beats one. Fast approximate search optimizes for speed, not precision. We retrieve the top 20 chunks by vector similarity, then rerank them with a cross encoder that scores each chunk against the query more accurately, and keep the top 5. That second stage lifted answer relevance 12% over single stage retrieval.
- Metadata and diversity. Each chunk stores source, page, section, date, department, and type, so we can filter before vector search ("only Q4 2024 compliance documents"). Maximal Marginal Relevance then keeps the top 5 from being five near duplicates of the same paragraph. In 2026, graph structured retrieval pushes this further: organizing chunks as a knowledge graph rather than a flat list improves accuracy 20% to 35% on hard multi hop questions.

Killing Hallucination: Grounding and Citations
Good retrieval makes generation almost boring, which is the point. The model receives the question plus 3 to 8 relevant fragments and synthesizes an answer from them.
The system prompt does the heavy lifting. It instructs the model to answer only from the provided context, to cite the source document for each claim, and to say so explicitly when the context is insufficient. The critical constraint is to ignore its own training data. Without it, the model blends retrieved context with general knowledge and creates untraceable hallucinations. When a compliance team asks what their policy says, the answer must come from their documents, not the model memory.
Three more controls catch the rest:
- Confidence scoring flags any answer whose best chunk falls below 0.72 similarity.
- Citation verification flags any claim that cannot be traced to a retrieved chunk.
- Temperature stays at 0.1, because for factual question answering, creative variation is a liability.
Together with grounded retrieval, this is why RAG reduces hallucinations by roughly 80%, and why uncertainty aware retrieval can cut them a further 27.8% in high stakes domains.
What It Costs at 500 Queries a Day
The economics are the easiest part to sell to a CFO. For this workload of 500 queries a day at 5 chunks of 1,000 tokens each:
- Embedding: about $0.25 a day
- LLM generation: about $15 a day input, $7.50 a day output
- Vector database: fixed infrastructure cost
- Total: roughly $680 a month
The naive approach of sending full documents costs about $19,200 a month for the same workload. RAG cut LLM cost by 96%. Caching adds more: identical and near identical questions hit a 34% cache rate in production, saving both latency and tokens. End to end latency stays at 1 to 2.3 seconds, inside the sub 3 second budget users expect.

RAG in 2026: From Experiment to Production Critical
RAG shifted from a promising technique to mission critical enterprise architecture this year. 45% of enterprises plan to deploy or expand RAG use cases in 2026, and the technique now anchors most serious knowledge systems.
The honest counterpoint matters too. While 71% of organizations report regular GenAI use, only 17% attribute more than 5% of EBIT to it. That gap is not a model problem. It is the distance between a demo in a notebook and a governed, measured, production system. The teams closing it are the ones investing in retrieval quality, evaluation, and monitoring rather than chasing the newest model.
That is why we measure continuously. Faithfulness above 95%, answer relevance above 0.85, context precision above 90%, context recall above 85%, tracked with automated evaluation plus weekly human review of 50 random query answer pairs. When a metric drops, we trace it to the exact stage (chunking, embedding, retrieval, or generation) and fix it surgically.
When RAG Is Not the Answer
RAG is not the tool for every problem. Use it when your knowledge base changes often, you need source attribution, your corpus exceeds 10,000 documents, or data sovereignty requires on premise processing. Reach for a different approach when you need to change the model behavior or output format rather than its knowledge.
These approaches combine well. Our production system uses RAG for the document knowledge base and fine tuning for output format, so answers arrive as structured JSON matching the client templates. Choosing between them is its own decision, which we cover in our companion guide on building production AI. For document heavy automation specifically, see our enterprise document classification case study.
How Oligamy Builds Production RAG
We build RAG systems and custom AI infrastructure for companies processing large document volumes, especially in fintech, legal, and compliance heavy industries. Our AI engineering team has shipped systems over 50,000 documents at 99% accuracy, and our dedicated team model covers ongoing architecture maintenance and iteration once the system is live.
Frequently Asked Questions
Processing large document volumes?
We assess your document volume, query patterns, and compliance needs, then tell you whether RAG, fine tuning, or a hybrid fits.
Book a free technical validationFor document heavy automation built on the same EU first principles, see our enterprise document classification case study. To map RAG, fine tuning, or a hybrid to your use case, book a free technical validation.


