What Is RAG: Retrieval-Augmented Generation and Enterprise Adoption
Summary: The common weakness of large models is this — they do not know your private data, they do not know the policy you updated last week, and they do not know the knowledge specific to your organization. RAG (Retrieval-Augmented Generation) is the mainstream architecture that fixes it: retrieve the relevant documents first, then hand them to the model together with the question to generate an answer. That makes answers traceable, reduces hallucination, and lets knowledge be updated at any time without retraining the model. This article covers the five stages of a RAG pipeline, chunking and hybrid search, reranking, citation traceability, the evaluation triad, plus the six most common failure modes and the 30-day cadence for taking an enterprise project from demo to production.
Key Takeaways
- The essence of RAG: it connects "the model's general reasoning ability" with "your proprietary knowledge" at query time — knowledge comes from retrieval, not from parameters.
- Five stages: ingest and clean, chunk-embed-index, retrieve, augment, generate. Every stage is measurable, which is what lets you locate a problem when one appears.
- The quality mainline is three things: chunking (semantic chunking scores roughly 15–25% higher precision than fixed-length splitting) plus hybrid search (vector plus BM25) plus reranking (rerank is usually the single highest-yield optimization).
- Citation traceability and permission pre-filtering: every chunk carries source metadata for inline citation; write the ACL into metadata and filter before retrieving, otherwise zero documents may reach the model.
- Evaluate on the RAG triad: context relevance, groundedness (is the answer supported) and answer relevance. Most teams test generation but not retrieval, which makes failures impossible to diagnose.
- From demo to production: swapping the embedding model is a breaking change, context overflow, and answers built on stale sources are the three most common ways it goes wrong.
What Problem RAG Actually Solves
Large models are powerful, but they have three hard flaws: they do not know your private data (it was not in training), their knowledge has a cutoff (they do not know what happened after it), and they fabricate (hallucination, delivered confidently).
RAG's fix is plain: do not let the model answer from memory — go look it up in your own material first, then let it answer based on what was found. That gives you:
- Knowledge that can be updated at any time — edit the document, no retraining needed.
- Every answer traceable to a specific document fragment, verifiable and auditable.
- Hallucination dropping sharply, because the model is constrained to "answer only from the given context".
It is the most widely deployed AI architecture in enterprises today, without exception.
The Five-Stage Pipeline: From Ingest to Generation
The complete RAG pipeline splits into five stages, and every stage must be measurable:
1. Ingest and Normalize to 2. Chunk, Embed and Index to 3. Retrieve to 4. Augment to 5. Generate
- 1. Ingest and clean: load raw documents and run ETL cleanup — strip boilerplate (headers, footers, navigation menus), normalize whitespace, extract structured content from tables and code. Garbage in, garbage out; cutting corners here breaks everything downstream.
- 2. Chunk, embed, index: cut documents into chunks, pass each chunk through the embedding model to turn it into a vector, and write it into the vector store together with the original text and metadata (document title, date, source URL, permissions). Indexing typically uses HNSW for approximate nearest neighbor search, reducing a full linear scan to sub-millisecond time.
- 3. Retrieve: after the user asks a question, convert the question into a vector with the same embedding model, run similarity search in the vector store for top-k, then apply hybrid search and reranking to produce the final context.
- 4. Augment: assemble the retrieved fragments into the prompt. The typical structure is "system instruction (answer only from the context, say you do not know if it is not there) plus retrieved fragments plus the user's original question".
- 5. Generate: the model generates an answer from the context and emits citations as required.
Chunking and Embedding: Semantic Chunking Beats Fixed-Length Splitting
Chunking decides the granularity of retrieval, and it matters enormously:
- Fixed-length splitting (for example 512 tokens with 10% overlap) works, but is not optimal — a 512-token chunk that straddles two subsections mixes contexts and interferes with retrieval.
- Semantic chunking: cut along natural boundaries (paragraphs, section headings, list item transitions). For enterprise documents like policies, contracts and reports, semantic chunking delivers roughly 15–25% higher retrieval precision than fixed-length splitting.
- Practical defaults: chunk size 300–800 tokens with 10–20% overlap; for structured documents cut by heading block first and then by token; merge chunks that are too short (under 100 tokens) with their neighbors.
Two things matter for the embedding model: ingest and query must use the same model (switching models is a breaking change requiring a full re-embed); and when choosing a model, run 100–200 representative queries on your own corpus and measure recall@10 rather than reading general leaderboards.
The Retrieval Quality Mainline: Hybrid Search Plus Reranking
The quality bottleneck in RAG is usually retrieval, not generation. Three actions are mandatory:
Hybrid search: pure vector retrieval is weak at exact matching — when a user searches "clause 14.3(b)", "error code E-1024" or a product model number, the vector representation is not necessarily close enough to the source fragment. Hybrid search runs dense vector retrieval (semantic) and BM25 (keyword, strong on exact and rare terms) in parallel, then fuses them (RRF reciprocal rank fusion, or weighted). BM25 weight in enterprise knowledge bases is often 30–40%. In practice hybrid almost always beats pure dense retrieval.
The fusion looks like this:
def hybrid_score(vector_score, lexical_score, alpha=0.65):
return alpha * vector_score + (1 - alpha) * lexical_score
Reranking: first recall the top 20–80 with fast vector or BM25 search, then use a cross-encoder to score each query-document pair precisely and take the top 3–5 into the prompt. A cross-encoder is slower and more expensive (it processes query and document together) but far more accurate — adding reranking is usually the single highest-yield step among all optimizations.
Query rewriting: user questions are often short, colloquial and full of anaphora ("what did we agree with the vendor on support?"). Rewrite them into a retrieval-friendly form before searching ("vendor support agreement SLA response time"), and for multi-turn conversations carry the previous 2–3 turns to resolve references; recall improves noticeably.
Also set a similarity threshold as a backstop: filter out documents below the threshold. Passing irrelevant context is worse than passing none — it consumes the context window and raises the risk of the model mixing correct and incorrect information.
Citation Traceability and Permission Pre-Filtering
Enterprise RAG has two hard requirements:
- Citation traceability: store source metadata on every chunk (document name, section, page, date, permission level), require the model to cite inline in the prompt, and post-process the citations into a structured list returned to the user. This is both a user trust mechanism (they can click through and check) and an engineer's debugging tool (when an answer is wrong you can trace it back to the source chunk).
- Permission (RBAC) pre-filtering: write the user or role ACL directly into chunk metadata and filter at the retrieval stage, not after retrieval. Filtering after retrieval often leaves you with top hits that are all restricted documents, so zero documents reach the model and the answer collapses outright.
Evaluation: The RAG Triad
RAG has two quality dimensions — retrieval quality and generation quality. Most teams measure only the latter, so when an answer is wrong they cannot tell whether "it was not retrieved" or "it was retrieved but generation went sideways".
The RAG triad — measure all three axes:
- Context relevance: did the retriever find the right documents? The core metric is recall@k (does the correct fragment appear in top-k) — this is what you must look at before tuning generation.
- Groundedness / faithfulness: can every claim in the answer be traced back to a retrieved fragment? This is the most direct hallucination risk metric.
- Answer relevance: does the answer actually respond to the user's question?
Then layer on operational metrics: latency p50/p95 and cost per request. To start, build a golden evaluation set of 50–200 queries with known correct answers, and run it as a regression every time you change the prompt, the reranker or the model.
The Six Most Common Enterprise Failure Modes
- Recall failure: the correct document never enters the top-10 (its embedding sits too far from the query). Diagnose by running test queries and checking whether the right source is in the top-10; fix by improving chunking, adding semantically richer context around key facts, and lowering the similarity threshold.
- Context window overflow: retrieved chunks plus system instruction plus query exceed the model window. Fix by limiting to the top 3–5 after reranking and capping chunk size.
- Answers built on stale or wrong sources: the retrieved content is itself out of date. Fix by adding document freshness metadata and filtering by time window at retrieval.
- Swapping the embedding model without re-embedding: treating a model swap as a harmless upgrade when it is actually a breaking change — old and new vectors do not live in the same space, so a full re-embed is required.
- Multi-tenant metadata filtering gaps: permissions not pre-filtered, causing privilege leaks or zero results.
- Logging raw prompts in full: these contain sensitive data and must be masked (PII and secrets).
The 30-Day Rollout Cadence
- Week 1: ingest, clean, chunk and build the vector index.
- Week 2: hybrid search, reranker and citation traceability.
- Week 3: evaluation set, dashboards and failure analysis.
- Week 4: guardrails, caching and the production SLO.
Guardrails include blocking out-of-scope questions, rejecting policy-violating outputs and masking logs. Cost reduction comes from semantic caching (semantically identical questions return the cached answer directly) and model tiering (a small model does rewriting and summarization, the strongest model only does final generation). On scale, the vector store scales horizontally easily; the LLM API is usually the bottleneck.
Getting-Started Checklist
- Clean at ingest: strip headers, footers and navigation boilerplate; normalize format and whitespace.
- Prefer semantic chunking: 300–800 tokens with 10–20% overlap; cut structured documents by heading block first.
- Use one embedding model for both ingest and query; pick it by measuring recall@10 on your own corpus.
- Always add hybrid search (vector plus BM25) and cross-encoder reranking (recall 20–80, rerank to 3–5).
- Add query rewriting; set a similarity threshold and prefer missing over irrelevant.
- Give chunks source metadata plus ACL, emit citations inline, and pre-filter by permission.
- Build a golden set of 50–200 queries and regress on the RAG triad plus recall@k plus p95 latency.
- Add semantic caching and model tiering; mask logs; set the SLO in week 4.
The retrieval foundation of RAG is exactly the core capability of enterprise search — query understanding, semantic recall, hybrid search, reranking and permission-aware retrieval.
FAQ
Q: How do I choose between RAG and fine-tuning?
A: The goals differ. Fine-tuning teaches the model behavior, style and domain habits — it changes parameters. RAG gives the model an external knowledge base that can be updated at any time — it changes the input. Choose RAG for private, frequently changing, traceable questions; consider fine-tuning only to standardize output format or instill a stable domain style. The two can also be combined.
Q: Why are my answers still inaccurate after adding RAG?
A: Usually the retrieval stage is weak rather than the model. Check in order: is the correct document in the top-10 (recall@k), is chunking sensible (semantic beats fixed-length), is hybrid search in place (exact term hits), is there a rerank (the highest single-point yield), does the query need rewriting. Tuning only the prompt generally cannot fix recall failure.
Q: How large should a chunk be?
A: The practical default is 300–800 tokens with 10–20% overlap. Factual Q&A can skew smaller (around 256) for precision, summarization can skew larger (1024). For structured documents cut by heading block first and then by token, and merge chunks that are too short (under 100 tokens) with their neighbors. The key is not to let a chunk straddle unrelated semantic boundaries.
Q: Why must hybrid search include a keyword component (BM25)?
A: Because pure vector retrieval is weak at exact matching. When users search error codes, version numbers, clause numbers or product model numbers — literally exact queries — vector similarity does not necessarily rank them first. BM25 is strong at exact and rare-term matching; run it in parallel with vectors and fuse with RRF or weighting, and hybrid almost always beats pure dense retrieval on enterprise corpora.
Q: Should permission filtering happen before or after retrieval?
A: Before retrieval, always. Write the ACL into chunk metadata and filter at the retrieval stage. If you filter after retrieval, your top hits may all be documents you have no access to, leaving zero after filtering — the model gets no context and the answer collapses. This is one of the easiest traps to fall into in enterprise RAG.
Q: Which metrics should I watch for RAG?
A: The RAG triad — context relevance (use recall@k to see whether retrieval is right), groundedness (can answer claims be traced to retrieved fragments, measuring hallucination) and answer relevance (does it actually answer the question). Add p50/p95 latency and cost per request. Build a golden query set of 50–200 items and run it as a regression after every change.
About Tengence
The retrieval foundation of RAG is exactly the core capability of enterprise search. Tengence Search brings query understanding, semantic recall, hybrid search, reranking and permission-aware retrieval to these scenarios, so enterprise knowledge is genuinely retrieved and cited. Tengence is the enterprise growth engine for the AI era, focused on public-channel acquisition and private-channel conversion; its core products are Tengence GEO (a GEO plus SEO dual engine) and Tengence Search.
Related Reading
- Enterprise Knowledge Base Search: A Practical Implementation Guide for Document Retrieval
- Vector Search in Production: Semantic Retrieval from Principles to Deployment
- Semantic Search vs. Keyword Search: A Full Comparison
- What Is Site Search? How It Works, Core Metrics and Capability Framework
- How to Optimize Search Relevance Ranking? A Two-Stage Recall + Ranking Method
Data Sources
- End-to-End RAG Workflow: How Retrieval Augmented Generation Works — Databricks: the five-stage RAG pipeline; the embedding model must be identical for ingest and query; chunking strategy and HNSW indexing; hybrid search (vector plus BM25, RRF) and rerank; similarity threshold filtering.
- Retrieval-Augmented Generation: How It Works and When to Use It — Digital Fractal: starting at 512 tokens with 10% overlap and adjusting per scenario; model selection by measuring recall@10; recall 10–20 then rerank to 3–5; retrieval metrics recall@k and precision versus generation metric groundedness; incremental indexing and freshness SLAs.
- RAG Implementation Patterns — AI Solutions Wiki: semantic chunking improves precision 15–25% over fixed-length; hybrid search BM25 weight 30–40%; rerank has the highest single-point yield; query rewriting and reference resolution; citation metadata; three failure-mode diagnoses.
- Best Practices for Designing Enterprise RAG Systems — Alps Agility: semantic chunking and lineage; hybrid search plus query rewriting plus reranking; RBAC metadata filtering must be pre-filtering; the RAG triad (context relevance, groundedness, answer relevance); semantic caching and model tiering for cost reduction.
- RAG Systems Complete Guide (2026): From Prototype to Production — Learnixo: the full production pipeline; chunk 300–800 with 10–20% overlap; hybrid weighted fusion (alpha 0.65); tiered recall 30–80 then rerank 5–10; evaluation metrics and guardrails; a 30-day build plan.