- A RAG pipeline grounds a language model in your own documents: ingest, chunk, embed, retrieve, rerank, generate. The demo is easy; production quality lives in the details.
- Retrieval decides quality, not the model. Chunking, hybrid search and reranking matter more than which LLM generates the final answer.
- The step most teams skip is evaluation. Without a test set of question-answer pairs, every change to the pipeline is a guess.
- In an enterprise, retrieval must be access-aware and, for European data, EU-resident. RAG that ignores permissions leaks documents; RAG that ignores residency breaks GDPR.
A retrieval-augmented generation prototype takes an afternoon: embed some documents, search on a query, paste the results into a prompt. It demos beautifully and then falls apart in production, returning confident wrong answers, leaking documents users should not see, or slowing to a crawl. This article covers what a RAG pipeline actually contains, where quality is won or lost, and the enterprise concerns that the tutorial version ignores.
What a RAG pipeline is, and why the demo lies
Retrieval-augmented generation grounds a language model in your own data. Instead of relying on what the model memorized during training, the system retrieves relevant passages from your documents at query time and gives them to the model as context, so the answer is based on current, private, verifiable information.
The demo lies because it runs on a handful of clean documents and softball questions. Production runs on thousands of messy documents, adversarial and ambiguous questions, permission boundaries and a latency budget. Every one of those exposes a stage the demo glossed over. A working RAG pipeline is a sequence of stages, and the weakest one caps the quality of the whole.
The pipeline, stage by stage
End to end, a production RAG pipeline has six stages:
- Ingestion. Pull documents from their sources (wikis, file shares, ticketing systems, databases), parse them (PDF, HTML, office formats) and normalize to text with structure preserved.
- Chunking. Split documents into passages small enough to retrieve precisely and large enough to keep context.
- Embedding. Convert each chunk into a vector with an embedding model, so semantic similarity becomes measurable.
- Retrieval. For a query, find the most relevant chunks, usually combining vector similarity with keyword search and metadata filters.
- Reranking. Reorder the retrieved candidates with a more precise model, keeping only the best few for the prompt.
- Generation. The language model answers using the retrieved context, ideally with citations back to the source.
Around these sit two things the tutorial omits: evaluation, and security. Both are where enterprise RAG succeeds or fails.
Retrieval is where quality is won or lost
The instinct is to blame the language model when answers are wrong. In practice, most wrong answers are retrieval failures: the right passage was never given to the model, so no model could have answered correctly.
- Chunking is the highest-leverage choice. Chunks that are too large dilute the relevant sentence among noise; too small, they lose the surrounding context that makes them meaningful. Structure-aware chunking (by section, not by fixed character count) usually beats naive splitting.
- Hybrid search combines dense vector similarity with sparse keyword (BM25) matching. Pure vector search misses exact terms like product codes and error numbers; pure keyword search misses paraphrase. Enterprises need both.
- Metadata filtering restricts retrieval by document type, date, department and access level. It is what keeps a query about the current policy from surfacing a superseded one.
- Reranking applies a cross-encoder to the shortlist, which is far more accurate at judging relevance than the initial vector search, at a cost that is acceptable on a handful of candidates.
Invest here before touching the model. A better retrieval stage improves every answer; a bigger model over bad retrieval just phrases the wrong answer more fluently.
Generation: grounding, citations and refusing to answer
Once the right context is retrieved, generation still has to be constrained. The model must answer from the provided context, cite which passage each claim came from, and refuse when the context does not contain the answer instead of inventing one.
That last behavior is the difference between a trustworthy assistant and a liability. A RAG system that always answers will confidently fabricate when retrieval comes up empty. One that says "the documents do not cover this" preserves trust. Citations make the answer auditable: a user can click through to the source and verify, which is essential in any regulated or high-stakes context.
Evaluation: the step teams skip
The single most common reason enterprise RAG stalls is the absence of evaluation. Teams ship a pipeline, tune it by trying a few queries by hand, and have no way to tell whether a change helped or hurt.
A minimal evaluation set is a list of representative questions with known-good answers and the source passages that should be retrieved. With it, you can measure retrieval quality (did the right passages come back?) separately from generation quality (did the model use them correctly?), and every change becomes a measured experiment instead of a vibe. This is unglamorous work and it is what separates a RAG demo from a RAG product.
Security and sovereignty
Enterprise RAG has two constraints the tutorial never mentions.
Access-aware retrieval. A user must only retrieve from documents they are allowed to see. If permissions are applied only at the UI and not at retrieval, the model can quote a document the user has no right to read, straight into the answer. Access control belongs in the retrieval filter, enforced per query against the user's identity.
Sovereignty. For European enterprises, both the documents and their embeddings are often sensitive or personal data. Generating embeddings through an external API or storing them in a non-EU service moves that data across a boundary GDPR may not permit. This is why many DACH deployments pair RAG with a self-hosted, EU-resident language model and an in-region vector store: the sensitive content never leaves the controlled environment.
Failure patterns
From the field, the patterns that break RAG in production:
1. Model-first thinking. Tuning the LLM while retrieval quietly fails to surface the right passages.
2. Naive chunking. Fixed-size splits that sever context, capping answer quality no matter what follows.
3. No evaluation set. Shipping without a way to measure, so tuning is guesswork and regressions go unnoticed.
4. Always answering. No refusal path, so empty retrieval turns into confident fabrication.
5. Permissions at the UI only. Retrieval that ignores access level, leaking restricted documents into answers.
Talk through your RAG pipeline
DNA Solutions helps European enterprises build retrieval-augmented generation that holds up in production: structure-aware ingestion and chunking, hybrid retrieval with reranking, grounded generation with citations, and an evaluation set so every change is measured. Where sovereignty requires it, we keep the documents, embeddings and model EU-resident and access-aware. Whether you are moving a promising demo to production or fixing one that hallucinates, we build the pipeline around the stage that actually caps your quality. Talk to us.
Related services: AI & Machine Learning, Data & Analytics



