How RAG Works — The Five-Step Pipeline
A RAG architecture has two distinct loops: an indexing loop that runs when documents are added or updated, and a query loop that fires every time someone asks a question. The indexing loop collects content from your source systems — help-desk tickets, shared drives, product wikis, database exports — normalizes it into clean text, splits it into manageable passages called chunks (usually 200 to 800 tokens each), converts every chunk into a numerical vector that captures its meaning, and stores those vectors in a retrieval system along with metadata about where they came from.How RAG Indexing Works

RAG vs Fine-Tuning vs Long Context Prompts
Businesses trying to ground AI in their data face three main design choices, each with different trade-offs:- Retrieval-Augmented Generation: facts update instantly when you re-index new documents; costs are measured per user query and can stay very low; systems can cite which document each answer came from.
- Fine-tuning a model on your data: locks in facts at the cost of a full retraining run every time something changes; cannot easily produce citations; makes sense mainly when you need consistent output formatting or specialized behaviour rather than fresh factual answers.
- Prompting with long context windows: requires sending thousands of pages into every API call, which drives token costs up linearly and actually degrades accuracy as the input grows longer — it works for small stable collections only.
The Seven Steps to Build a Working RAG System
Step one: define what counts as correct before writing any code. Collect fifty to two hundred real questions your team actually asks, along with the expected answers and which document each answer lives in. This forms your evaluation set — every design decision you make from here on gets tested against it. Without a gold-standard question set you are iterating by feel rather than measurement, and that almost always extends timelines. Step two: fix source data quality. Retrieval performance stops at the quality of the documents in your index. Deduplicate entries, archive superseded policies (a model cannot distinguish your current procedure from a three-year-old draft), strip navigation and footer text from scraped web pages, and verify that scanned PDFs produce readable extracted text before it enters the pipeline. Many teams underestimate this cleanup effort; in practice source preparation consumes roughly thirty percent of the total build cycle. Step three: chunk with document structure, not character count. Split on headings, section boundaries, and list items instead of drawing hard lines every N tokens. Fixed-size splitting destroys tables that span a cut point and can leave a paragraph without its heading context. Add ten to twenty percent overlap between adjacent chunks so nothing important disappears at an edge. Attach metadata to every chunk — source file name, section path, effective date, access classification — because those fields enable critical filtering later. Step four: use hybrid search instead of vectors alone. Pure semantic search fails on exact identifiers: product SKUs, error codes, policy numbers, employee names. The embedding for "SKU AX-441" and "AX-441 replacement policy" will look similar but the match depends on whether those strings appear in the document at all. Running keyword (BM25) search alongside vector search and merging results with reciprocal rank fusion is the single largest accuracy improvement available to most teams, and it remains the most commonly missing component. Step five: apply permissions at retrieval time. Filter by access controls before returning results — never retrieve a restricted chunk and ask the model to ignore it. Models are not reliable gatekeepers; a database filter is. This distinction matters for every deployment handling sensitive or customer-facing data. Step six: re-rank retrieved candidates. Retrieve twenty to fifty initial matches with hybrid search, then sort them down to three to eight meaningful passages using a cross-encoder reranker. This two-stage approach — broad recall followed by precise ranking — consistently outperforms trying to retrieve the perfect subset in one pass, and it actually lowers token costs by ensuring the model receives fewer but more relevant passages each time. Step seven: constrain generation carefully. Instruct the model to answer only from provided context, cite sources for factual claims, and say "I could not find a definitive answer" when the retrieved evidence is insufficient. Guard all three of these constraints in production — they are what separate a credible assistant from a confident hallucinator.Sampling a RAG Question Query

What RAG Costs — Build and Running
Build costs scale roughly by system scope, based on market ranges compiled from published rates and implementation data across 2026:- Single-source internal tool under five thousand documents: $18,000 to $35,000 with a four- to six-week timeline.
- Multi-source customer-facing deployment requiring access permissions: $45,000 to $90,000 and eight to fourteen weeks.
- Fully enterprise-grade with SSO integration, data residency controls, and audit logging: $90,000 to $200,000 over four to seven months.
RAG Failure Modes Most Teams Encounter
- Stale documents outranking current ones. An outdated policy matches the query better than the updated version because the old text used different terminology. Fix: add freshness signals to ranking and flag archived content during ingestion.
- Answers split across two chunks with no overlap awareness. Question requires information from adjacent sections that were cut apart at the chunk boundary. Fix: retrieve neighboring chunks when a hit lands mid-section, or increase overlap to twenty percent.
- Exact identifiers returning poor semantic matches. Product codes and error numbers need keyword search; vectors alone miss those entirely. Hybrid search closes this gap.
- Model hallucination despite retrieved context. The model ignores instruction boundaries when prompted carelessly. Fix: tighten generation constraints, use a two-stage output format (citation list then answer), and test rigorously against the evaluation set.
Frequently Asked Questions
What is RAG in simple terms?
RAG means your AI assistant looks up relevant information from your own documents before answering a question, instead of responding from its general training data. It retrieves the context, augments the prompt with it, and generates an answer grounded only in what it found.
How long does it take to build a RAG system?
A focused internal deployment on a single source typically takes four to six weeks ($18,000–$35,000). Multi-source customer-facing systems with access controls, permissions, and evaluation infrastructure run eight to fourteen weeks at $45,000 to $90,000.
Does RAG replace fine-tuning?
No — they solve different problems. RAG keeps factual answers current and citable; fine-tuning improves style consistency, output formatting, or domain-specific behaviour. Many production systems use both, with RAG handling accuracy and fine-tuning handling form.
Can a small business afford RAG?
Yes. A team of six to fifty people typically starts with one support workflow, two or three document sources, and Postgres-backed vector storage — monthly operating costs of $150 to $400 once live, plus an initial build proportional to data complexity.
How do I measure if my RAG system is actually working?
Create a gold-standard evaluation set of real questions with expected answers before any engineering begins. Every design change you make should be tested against that set by measuring how many answers it produces that pass automated quality checks and random human review.
Ready to explore whether RAG makes sense for your organization? Contact ArcBeta Solutions — we design retrieval systems tailored to your data sources and permission requirements, with a clear evaluation plan before the first line of production code ships.