← Back to Technical Library

RAG Explained: From Basic to Advanced Architectures

A Comprehensive Technical Reference on Retrieval-Augmented Generation Architectures for Sovereign, On-Premise AI

Category: RAG & Retrieval Systems Read time: ~35 min Updated: June 2026 Level: Intermediate-Advanced
Retrieval-Augmented Generation (RAG) combines a parametric language model with a non-parametric external knowledge store, grounding the model's outputs in documents it can cite. What began in 2020 as a simple three-stage pipeline -- index, retrieve, generate -- has since fractured into a family of architectures, each addressing a distinct failure mode. This article provides a comprehensive technical walkthrough of every major RAG variant in active production use: Naive RAG, Advanced RAG (with pre-retrieval, retrieval, and post-retrieval optimization), Modular RAG, Agentic RAG, Self-RAG, Corrective RAG (CRAG), Adaptive RAG, and Graph RAG. For each, we cover the architecture, the failure mode it solves, when to use it, and on-premise deployment considerations for sovereign AI environments where data must never leave your infrastructure.
RAG Retrieval Augmented Generation Agentic RAG Self-RAG CRAG Adaptive RAG Graph RAG Re-ranking HyDE On-Premise AI

Table of Contents

1. What Is RAG?

Retrieval-Augmented Generation (RAG) is a technique that augments a large language model with an external knowledge base. Instead of relying solely on knowledge baked into the model's parameters during training, a RAG system retrieves relevant documents at inference time and feeds them into the model's context window as it generates a response. The model then conditions its answer on both its parametric memory and the freshly retrieved evidence.

The original formulation, introduced by Lewis et al. at Facebook AI Research in 2020, was a single, linear pipeline: chunk your corpus into passages, embed each passage into a vector index, retrieve the top-k passages most similar to the user's query, and pass them as context to a seq2seq generator. This design -- now called Naive RAG -- remains the conceptual backbone of every RAG system built today. But the simplicity is deceptive: in production, naive RAG fails on anything beyond simple factual lookups. Documents get missed when the query phrasing differs from the document phrasing. Retrieved passages include noise that confuses the generator. Multi-step questions go unanswered because a single retrieval pass cannot surface all the needed facts.

The intervening years have produced a family of architectures that address these failure modes. Advanced RAG adds query transformation, hybrid search, and re-ranking. Modular RAG makes every component swappable. Agentic RAG lets the model decide when and what to retrieve, iterating over multiple rounds. Self-RAG trains the model to self-assess retrieved passages and discard irrelevant ones. Corrective RAG evaluates retrieval quality and falls back to alternative sources when the primary index underperforms. Adaptive RAG routes between architectures based on query complexity. Graph RAG replaces or augments vector similarity with knowledge-graph traversal.

This article covers each in depth. Throughout, we emphasize sovereign, on-premise deployment: every architecture here can run entirely on your own hardware, with no data ever leaving your network. This matters for regulated industries (healthcare, defense, finance), classified environments, and any organization that cannot accept the compliance, latency, or sovereignty risk of sending proprietary data to a third-party API.

Scope Note: This article is the comprehensive methods page for the RAG section. For hands-on implementation details (chunking strategies, embedding model selection, vector database benchmarks), see the related pages in the RAG technical library. Graph RAG is introduced here and covered in full depth on its own dedicated page.

2. Why RAG Over Fine-Tuning?

Before diving into architectures, it is worth understanding why RAG exists as a distinct approach rather than simply fine-tuning a model on your documents. Both methods inject custom knowledge into an LLM, but they solve fundamentally different problems.

Dimension RAG Fine-Tuning
Knowledge source External, retrieved at inference time Encoded into model parameters during training
Update cost Low -- re-index documents, no model retraining High -- full fine-tuning run per update
Citation / attribution Native -- retrieved passages are citable Not possible -- knowledge is diffuse in weights
Knowledge volume Unbounded -- limited only by index storage Bounded by training data and model capacity
Latency per query Higher -- retrieval adds a round trip Lower -- no retrieval step
Best for Factual Q&A, knowledge that changes, attribution Style, tone, domain-specific reasoning patterns
Hallucination risk Lower -- grounded in retrieved context Higher -- no external grounding at inference

The two are not mutually exclusive. A common production pattern is to fine-tune a model on domain-specific language and reasoning patterns, then deploy it behind a RAG pipeline for factual grounding. The fine-tune teaches the model how to talk; the RAG layer teaches it what to say. In a sovereign deployment, both the fine-tuned model and the RAG index run entirely on-premise.

Core tradeoff: RAG trades inference-time latency for knowledge that is cheap to update, unbounded in volume, and citable. Fine-tuning trades training-time cost for faster inference and behavior change. Most production systems use both.

3. Naive RAG

Naive RAG is the original three-stage pipeline: index, retrieve, generate. It is the simplest architecture that qualifies as RAG, and it remains the right starting point for many use cases. Every more advanced architecture is a modification or extension of this baseline.

The Three Stages

Stage 1: Index

Your document corpus -- PDFs, internal wikis, code, support tickets, medical records, whatever -- is split into chunks of a fixed token size (typically 256-1024 tokens) with optional overlap. Each chunk is passed through an embedding model that converts the text into a dense vector (commonly 768-1536 dimensions). These vectors are stored in a vector index -- a data structure optimized for fast approximate nearest-neighbor (ANN) search. Popular on-premise options include FAISS, Milvus, Qdrant, Weaviate, and Chroma.

Indexing is a batch operation. You run it once when the corpus is ingested, then incrementally re-index when documents change. The index lives on disk or in memory on your own servers. No document text needs to leave your infrastructure for indexing; the embedding model (e.g., a local BGE, E5, or gte-large model) runs on your GPUs.

Stage 2: Retrieve

When a user submits a query, the same embedding model encodes the query into a vector. The vector index performs a similarity search (usually cosine similarity or dot product) to find the top-k chunks whose vectors are closest to the query vector. A typical value for k is between 3 and 20. The retrieved chunks, along with their source metadata, are returned as candidates for context.

This is a single-step, single-shot retrieval. One query, one search, one set of results. There is no query reformulation, no iterative retrieval, and no assessment of whether the results are actually relevant.

Stage 3: Generate

The retrieved chunks are concatenated (or otherwise assembled) and inserted into the LLM's prompt as context. The prompt typically looks like:

You are a helpful assistant. Answer the question using only the provided context. If the context does not contain the answer, say you do not know. Context: {retrieved_chunk_1} {retrieved_chunk_2} ... {retrieved_chunk_k} Question: {user_query} Answer:

The LLM then generates a response conditioned on this context. Because the model has explicit access to the source text, it can ground its answer in the retrieved passages and, with appropriate prompting, cite which passage a claim came from. This is the fundamental value proposition of RAG: the model's answer is constrained by evidence it can point to.

NAIVE RAG ARCHITECTURE ======================= [Document Corpus] | v [Chunking] --> 256-1024 token chunks | v [Embedding Model] (e.g., BGE-large, E5-base) | v [Vector Index] (FAISS / Milvus / Qdrant) | | <-- indexed once, updated incrementally | ===== INFERENCE TIME ===== | [User Query] | v [Embedding Model] --> query vector | v [Vector Similarity Search] --> top-k chunks | v [Prompt Assembly] --> context + question | v [LLM Generator] --> answer with citations | v [Response to User]

Strengths

Limitations

When to use: Simple Q&A over small, homogeneous document sets (under ~10,000 chunks). Prototypes and proofs of concept. Use cases where the query vocabulary closely matches the document vocabulary. Environments where latency is more important than accuracy. Start here, measure, and only upgrade if naive RAG fails on your evaluation set.
Common mistake: Deploying naive RAG to production without an evaluation harness. Naive RAG looks impressive in demos (you hand-pick a question the system answers well) but degrades silently at scale. Always build a test set of 50-200 question-answer pairs and measure retrieval recall and answer faithfulness before shipping.

4. Advanced RAG

Advanced RAG keeps the three-stage pipeline but adds optimization at each stage: pre-retrieval, retrieval, and post-retrieval. The goal is to improve the quality of what the LLM sees without changing the fundamental architecture. It is the most common production RAG pattern because it offers the best accuracy-to-complexity ratio: significant gains over naive RAG without the engineering burden of agentic loops or custom-trained models.

4.1 Pre-Retrieval Optimization

Pre-retrieval optimization operates on the query before it reaches the vector index. The insight is that users are bad at writing queries. They use vague terms, ask questions in a different register than the document, ask multi-part questions, or use domain-specific jargon that the embedding model handles poorly. Pre-retrieval techniques rewrite the query to make it more retrievable.

Query Transformation

The simplest approach is to pass the user's query to an LLM and ask it to rewrite the query in a more retrieval-friendly form. For example, "How do I reset my password?" might become "password reset procedure steps administrator." This is a single LLM call that costs ~50 tokens but can dramatically improve retrieval when the user's phrasing differs from the document's phrasing.

A more structured variant is query decomposition: break a multi-part question into sub-questions. "Compare the maternity leave policies of the US and Sweden" becomes ["maternity leave policy United States", "maternity leave policy Sweden"]. Each sub-query is retrieved independently and the results merged.

Query Expansion

Query expansion generates multiple variant queries from the original and retrieves for each, then merges the results. This hedges against the embedding model's sensitivity to phrasing. If the original query misses the right document, one of the variants may hit it. Typical expansion counts are 3-5 variants.

Expansion can be keyword-based (adding synonyms from a domain thesaurus), LLM-based (asking the LLM to generate paraphrases), or pseudo-relevance-feedback-based (retrieving with the original query, taking the top results, extracting keywords from them, and re-querying with those keywords added).

HyDE (Hypothetical Document Embeddings)

HyDE, introduced by Gao et al. in 2022, is a particularly effective pre-retrieval technique. The insight: the embedding of a question is a poor query for finding answers, because questions and answers live in different semantic regions of the embedding space. HyDE bridges this gap by having the LLM generate a hypothetical answer to the question first -- a plausible-sounding paragraph that may contain factual errors but will be stylistically and topically similar to the real answer. This hypothetical document is then embedded, and the resulting vector is used to search the index.

Because the hypothetical document is in "answer space" rather than "question space," its embedding matches real answer documents more closely than the question's embedding would. The LLM's hallucination in the hypothetical document is not a problem -- it is a feature, because the hallucination has the right shape even if the facts are wrong.

# HyDE pseudocode query = "What is the maximum contribution limit for a 401(k)?" # Step 1: Generate a hypothetical answer hypothetical_doc = llm.generate( f"Write a plausible paragraph answering: {query}\n" f"Do not worry about factual accuracy." ) # Output: "The maximum contribution limit for a 401(k) # retirement account is set by the IRS and adjusted # annually for inflation. For 2024, the limit is # $23,000 for participants under age 50..." # Step 2: Embed the hypothetical document query_vector = embedding_model.encode(hypothetical_doc) # Step 3: Search using the answer-space vector results = vector_index.search(query_vector, k=10) # Results will be actual answer documents, not question-like text

Step-Back Prompting

Step-back prompting asks the LLM to extract a more general, abstract version of the question before retrieval. "What was the revenue of company X in Q3 2024?" becomes "What is company X's financial performance?" The step-back question retrieves broader context documents that may contain the specific fact plus the surrounding context needed to interpret it. This is especially useful when the specific fact is buried in a larger document that would not be retrieved by the specific query.

4.2 Retrieval Optimization

Retrieval optimization improves the search itself. Even with a perfect query, single-vector similarity search has known weaknesses: it struggles with keyword matching (exact terms), handles rare terms poorly, and is dominated by semantic similarity that may not align with relevance. The two main techniques are hybrid search and re-ranking.

Hybrid Search

Hybrid search combines dense vector retrieval (semantic similarity) with sparse lexical retrieval (BM25 or similar TF-IDF-based scoring). Vector search excels at finding semantically related content but misses exact term matches. BM25 excels at exact term matching but misses synonyms and paraphrase. By running both and merging the results (via reciprocal rank fusion or a learned weight), you get the strengths of both.

In practice, hybrid search is one of the highest-impact changes you can make to a RAG pipeline. It is cheap to implement (most vector databases support hybrid search natively), adds minimal latency, and meaningfully improves retrieval recall, especially on technical documents with lots of proper nouns, code identifiers, and numeric values.

Re-Ranking with Cross-Encoders

The embedding model used for retrieval is a bi-encoder: it encodes the query and each document independently, then compares them via cosine similarity. This is fast (document embeddings are pre-computed) but weak, because the query and document never interact. A cross-encoder takes the query and document together as a single input, runs the full transformer over the concatenated pair, and outputs a relevance score. This is far more accurate because the model can attend to the interaction between query and document tokens.

The standard pattern is two-stage retrieval: use the fast bi-encoder to retrieve top-100 candidates (high recall), then use the slow-but-accurate cross-encoder to re-rank those 100 down to the top-10 (high precision). Popular cross-encoders include BGE-reranker, Cohere Rerank (cloud; not suitable for sovereign use), and ColBERT. On-premise options are mature: BGE-reranker-large runs on a single GPU and re-ranks 100 candidates in under 100ms.

ADVANCED RAG -- TWO-STAGE RETRIEVAL ================================== [User Query] | v [Pre-Retrieval: Query Transformation] | -- query rewriting (LLM) | -- query expansion (3-5 variants) | -- HyDE (hypothetical document) v [Stage 1: Bi-Encoder Retrieval -- high recall] | -- dense vector search (top-100) | -- sparse BM25 search (top-100) | -- merge via reciprocal rank fusion v [~100 candidate chunks] | v [Stage 2: Cross-Encoder Re-Ranking -- high precision] | -- BGE-reranker / ColBERT | -- score each (query, chunk) pair v [Top-10 re-ranked chunks] | v [Post-Retrieval: Context Processing] | -- compression / filtering | -- citation tracking v [LLM Generator] --> grounded answer

4.3 Post-Retrieval Optimization

Post-retrieval optimization processes the retrieved chunks after retrieval but before generation. The goal is to ensure the LLM sees only the most useful information, presented in the most effective form.

Context Compression

Retrieved chunks often contain irrelevant padding. A 512-token chunk retrieved for a single sentence of relevant content wastes 98% of the context window on noise. Context compression techniques extract only the relevant portions:

Citation Tracking

Advanced RAG systems track which chunks were used to generate which claims, enabling inline citations in the response. This requires the LLM to be prompted to cite sources (e.g., "[1]" after each claim) and a mapping from citation numbers back to chunk identifiers. In on-premise deployments, citation tracking is critical for regulated industries: a medical or legal answer must be traceable to the specific source document and page.

When to use: Larger datasets (10,000+ chunks), higher accuracy requirements, production deployments where retrieval quality directly impacts user trust. Advanced RAG is the sweet spot for most real-world applications. It adds complexity but each component is a well-understood, independently testable module. If you are building a production RAG system on-premise, start with Advanced RAG unless your use case specifically demands agentic reasoning or self-correction.

5. Modular RAG

Modular RAG is less a single architecture than a design philosophy: treat the RAG pipeline as a composition of independent, swappable modules. Naive RAG has three modules (indexer, retriever, generator). Advanced RAG adds more (query transformer, re-ranker, context compressor). Modular RAG makes the boundaries explicit and interchangeable.

The key idea is that each module has a well-defined interface (input and output types) and can be replaced without affecting the others. Want to swap your embedding model from BGE-large to OpenAI text-embedding-3-large? Change the indexer and retriever; the generator is unaffected. Want to upgrade your LLM from Llama-3-70B to a larger model? Change the generator; the retrieval pipeline is unaffected. Want to add a memory module so the system remembers previous turns in a conversation? Slot it in between retrieval and generation.

Standard Modules

Module Input Output Example Implementations
Indexer Raw documents Vector index + metadata LlamaIndex, LangChain, custom pipeline
Query Transformer User query (string) Transformed query / queries LLM rewrite, HyDE, Step-Back, multi-query
Retriever Query vector Candidate chunks (top-N) FAISS, Milvus, Qdrant, Weaviate, Chroma
Reranker Candidate chunks + query Re-ranked chunks (top-K) BGE-reranker, ColBERT, Cross-encoder models
Context Processor Re-ranked chunks + query Compressed / filtered context LLM compressor, sentence filter, contextual embeddings
Memory Conversation history + query Memory-augmented query / context Vector memory, summary memory, entity memory
Generator Context + query Generated answer Llama, Mistral, Qwen, locally-served LLMs
Citation Tracker Generated answer + source chunks Cited answer with references Inline citation prompt, post-hoc alignment

Why Modularity Matters for Production

In a production system, components evolve at different rates. Embedding models improve every few months. LLMs improve every few weeks. Your document corpus changes daily. A monolithic RAG implementation -- where the indexing, retrieval, and generation code are tangled together -- makes upgrades painful. Each improvement requires re-validating the entire system.

A modular architecture isolates changes. You can A/B test a new embedding model by routing 10% of traffic to a retriever using the new model, while the rest of the pipeline is unchanged. You can roll back just the reranker without touching the index. You can swap the generator for a larger model on more powerful hardware while keeping the retrieval stack on cheaper servers.

Orchestration Frameworks

The two dominant orchestration frameworks for modular RAG are LlamaIndex and LangChain (with its LangGraph extension). Both provide abstractions for each module and allow custom implementations. For sovereign, on-premise deployment, LlamaIndex tends to have better support for local models and self-hosted vector stores, while LangGraph excels at stateful, multi-step workflows (which overlap with Agentic RAG).

When to use: Any production RAG system that will evolve over time. If you are building a one-off prototype, naive or advanced RAG without strict modularity is fine. If you are building a system that will be maintained, upgraded, and extended for months or years, modular RAG is the baseline architecture. It is not a different pipeline -- it is the same pipeline with explicit, tested module boundaries.

6. Agentic RAG

Agentic RAG represents a qualitative shift: the LLM is no longer a passive generator that consumes whatever context it is given. It becomes an agent that actively decides when to retrieve, what to retrieve, and how many times to retrieve. Retrieval is exposed to the model as a tool -- a function the model can call with arguments it chooses, as many times as it deems necessary, in service of answering the user's question.

This is the RAG analogue of tool-use in agentic LLM frameworks. Instead of a fixed pipeline (query → retrieve → generate), the system runs an agentic loop: the LLM reasons about the question, decides whether retrieval is needed, formulates a search query, receives the results, reasons about whether the results are sufficient, and either generates an answer or retrieves again with a refined query.

The Agentic Loop

AGENTIC RAG ARCHITECTURE ======================== [User Question] | v [LLM Agent] <--> [Tool: Retrieve(query) -> chunks] | +---> Reason: "I need to find who wrote paper X" | Call: Retrieve("paper X author") | <--- Results: [chunk about paper X] | +---> Reason: "The author is Y. Now I need to find | the company that acquired Y's startup." | Call: Retrieve("startup founded by Y acquisition") | <--- Results: [chunks about acquisition] | +---> Reason: "The acquirer is Z. Now I need Z's CTO." | Call: Retrieve("Z chief technology officer") | <--- Results: [chunk about Z's CTO] | +---> Reason: "I have all the pieces. The answer is W." | v [Final Answer to User] Key: The LLM decides each step. It may retrieve 0, 1, 3, or 10 times depending on the question.

How It Works

The LLM is given a system prompt that describes its available tools. One of these tools is retrieve(query: str) -> List[Chunk]. The model is prompted to reason step-by-step (Chain of Thought) and to call the retrieve tool whenever it needs information it does not already have. After each tool call, the results are added to the model's context, and the model is prompted to continue reasoning.

This loop continues until the model either (a) decides it has enough information to answer, (b) decides retrieval is not needed (the question can be answered from parametric knowledge), or (c) hits a maximum iteration limit (a safety guardrail to prevent infinite loops).

Multi-Hop Reasoning

Agentic RAG excels at multi-hop questions -- questions that require chaining multiple facts, each dependent on the previous. The example in the diagram above ("Who is the CTO of the company that acquired the startup founded by the author of paper X?") requires three sequential retrievals, each using information from the previous step. No single retrieval pass could answer this, because the second and third queries are not known until the first query's results are seen.

This is the fundamental advantage of agentic RAG over advanced RAG: the retrieval strategy is dynamic, conditioned on intermediate results. Advanced RAG can pre-generate multiple queries, but it must do so upfront, without seeing any results. Agentic RAG generates each query in response to what it has learned so far.

When You Don't Know Which Documents Are Relevant

Agentic RAG also shines when you cannot predict which documents the question will need. In a large, heterogeneous corpus (e.g., a company's entire internal knowledge base spanning HR, engineering, legal, finance, and operations), a question like "What's the process for hiring a contractor in Germany?" might require documents from HR (hiring policy), Legal (contractor classification in Germany), and Finance (payment process for international contractors). An agentic system can explore each of these areas in sequence; a fixed-pipeline system must either retrieve all of them upfront (wasting context) or miss some.

Tradeoffs

Sovereign deployment note: Agentic RAG requires an LLM capable of tool use and multi-turn reasoning. Not all open-weight models are equally good at this. Llama-3.1-70B and Qwen-2.5-72B handle agentic loops well; smaller models (7B-14B) often fail to converge or loop. If you are deploying on-premise with limited GPU budget, verify your model's agentic capability on a multi-hop test set before committing to this architecture.
When to use: Complex questions requiring multi-hop reasoning. Heterogeneous document corpora where you cannot predict which documents are relevant. Research and analysis tasks where the question may require iterative exploration. When latency is acceptable (seconds, not milliseconds) and the accuracy gain justifies the cost. Avoid for simple factual lookups -- the overhead is wasted.

7. Self-RAG

Self-RAG, introduced by Asai et al. in 2023, trains the model to self-reflect on the retrieval and generation process. Rather than treating retrieval as a fixed step that always happens, Self-RAG teaches the model to make two key decisions autonomously: (1) whether retrieval is needed at all for this query, and (2) whether each retrieved passage is relevant and should be used.

This is achieved through special reflection tokens that the model generates alongside its text output. These tokens act as the model's internal monologue about its own reasoning process, and they control the retrieval and grounding behavior.

The Reflection Tokens

Self-RAG introduces three types of reflection tokens:

SELF-RAG ARCHITECTURE ===================== [User Question] | v [LLM generates Retrieve token] | +--> Retrieve = No --> [Generate from parametric knowledge] | (no retrieval, no context) | +--> Retrieve = Yes --> [Retrieve top-k passages] | v [For each passage, generate IsRel token] | +---- Relevant ---> Keep passage | +---- Irrelevant -> Discard passage | v [Generate answer using relevant passages] | v [Generate IsSup token for each claim] | +---- Supported ----> Keep claim | +---- Not supported -> Discard / retry | v [Final grounded answer]

Training Process

Self-RAG requires a custom training process. The model is fine-tuned on a dataset where the training examples include the reflection tokens as targets. The training data is generated by a critic model that labels whether retrieval is needed, whether passages are relevant, and whether claims are supported. The base model then learns to predict these tokens itself, internalizing the critic's judgment.

This is a significant departure from plug-and-play RAG: you cannot take an off-the-shelf LLM and make it Self-RAG by changing the prompt. The self-reflection behavior is baked into the model weights through fine-tuning. This means Self-RAG requires training infrastructure and labeled data, which is a higher barrier than the other architectures.

Effect on Hallucination

Self-RAG's primary value is hallucination reduction. By discarding irrelevant passages (IsRel) and self-checking that generated claims are supported (IsSup), the model is forced to ground its answers in retrieved evidence. In the original paper, Self-RAG showed significant improvements over both standard RAG and no-RAG baselines on factuality benchmarks, with a particular improvement on questions where the retrieval system returns irrelevant documents.

When to use: When hallucination reduction is the primary concern. Regulated domains (medical, legal, financial) where every claim must be grounded. When you have the training infrastructure to fine-tune a model with reflection tokens. When you want the model to skip retrieval for questions it can answer from parametric knowledge (saving latency on easy questions). Not suitable if you need to use an off-the-shelf model without fine-tuning.

8. Corrective RAG (CRAG)

Corrective RAG (CRAG), introduced by Yan et al. in 2024, addresses a specific failure mode: the retrieval system returns documents, but those documents are wrong or low-quality. Instead of trusting the retriever's output, CRAG adds an evaluation step that scores the quality of retrieved documents and, if quality is too low, falls back to alternative retrieval sources -- typically web search.

The Three-Tier Quality Assessment

CRAG uses a lightweight retrieval evaluator (a small fine-tuned model) to classify each retrieved document into one of three tiers:

Knowledge Refinement

For ambiguous documents, CRAG does not simply include or exclude the whole document. It applies a decomposition-and-compression step: the document is split into smaller knowledge strips, each strip is scored for relevance, and only the high-scoring strips are kept. This is a more granular form of the context compression used in Advanced RAG, but applied at retrieval-evaluation time rather than post-retrieval.

Fallback to Web Search

When the retrieval evaluator determines that the retrieved documents are incorrect (or all are ambiguous with low confidence), CRAG triggers a web search as a fallback. The web search results are then subjected to the same evaluation and refinement process. This is the "corrective" in Corrective RAG: the system does not passively accept bad retrieval -- it actively detects failure and seeks better information.

CORRECTIVE RAG (CRAG) ARCHITECTURE ================================== [User Query] | v [Standard Retrieval] --> top-k documents | v [Retrieval Evaluator] (fine-tuned small model) | +--> "Correct" --> [Use as-is] | +--> "Ambiguous" --> [Knowledge Refinement] | | -- decompose into strips | | -- score each strip | | -- keep relevant strips | v | [Refined context] | +--> "Incorrect" --> [Fallback: Web Search] | v [Web results] | v [Same evaluation] | v [Refined web context] | +---------+---------+ | | | v v v [Final Context Assembly] | v [LLM Generator] --> corrected, grounded answer
Sovereign deployment consideration: The standard CRAG design falls back to web search (Google, Bing) when retrieval quality is low. In a sovereign, on-premise environment, web search may not be available (air-gapped) or may be prohibited (data egress policy). In this case, the fallback can be redirected to an alternative internal index -- a broader corpus, a different embedding model, or a keyword-based BM25 index. The corrective loop still works; only the fallback source changes. This is the recommended adaptation for air-gapped or regulated deployments.
When to use: Noisy or heterogeneous document sets where retrieval quality varies significantly. When your corpus has a mix of high-quality and low-quality documents. When you have access to an alternative retrieval source (web search for non-sovereign, alternative index for sovereign). CRAG adds one model inference (the evaluator) per query but catches retrieval failures that would otherwise lead to hallucinated answers. Particularly effective for knowledge bases that combine authoritative documents with user-generated content.

9. Adaptive RAG

Adaptive RAG, introduced by Jeong et al. in 2024, observes that different questions need different amounts of retrieval. A simple factual question ("What is the capital of France?") needs no retrieval at all -- the model knows it. A medium-complexity question ("What is our company's remote work policy?") needs a single retrieval pass. A complex multi-hop question ("Compare the Q3 revenue of the three companies we acquired in 2024") needs iterative retrieval.

Running the full agentic RAG pipeline for every question wastes latency on simple questions. Running naive RAG for every question fails on complex ones. Adaptive RAG solves this by classifying the query first, then routing to the appropriate RAG strategy.

The Query Complexity Classifier

A small, fast classifier (a fine-tuned model or even an LLM-based prompt) examines the incoming query and assigns it to one of three complexity tiers:

ADAPTIVE RAG ARCHITECTURE ========================= [User Query] | v [Query Complexity Classifier] / | \ / | \ v v v [Level A] [Level B] [Level C] Simple Medium Complex | | | v v v [No Retrieval] [Advanced RAG] [Agentic RAG] (LLM only) (1 retrieval) (N retrievals) | | | v v v [Answer] [Answer] [Answer] \ | / \ | / v v v [Unified Response to User]

Training the Classifier

The classifier can be trained in several ways:

In practice, the LLM-based approach is the most common starting point because it requires no training data and adapts to new question types. As traffic grows, a fine-tuned classifier can replace it for lower latency.

Latency Savings

The key benefit of Adaptive RAG is latency optimization. If 60% of your traffic is simple questions that need no retrieval, those questions skip the retrieval pipeline entirely and respond in LLM-generation time only. The 30% that need single-step retrieval use the efficient Advanced RAG path. Only the 10% that truly need multi-hop reasoning pay the cost of the agentic loop. The average latency across all queries drops significantly compared to running Agentic RAG for everything.

When to use: Systems with mixed query types. Customer-facing chatbots, enterprise search, and support systems where the question distribution spans simple factual lookups to complex analytical questions. When you want to optimize average latency without sacrificing accuracy on hard questions. The overhead is the classifier; the benefit is routing each query to the cheapest pipeline that can answer it correctly.

10. Graph RAG

Graph RAG replaces or augments vector-similarity retrieval with knowledge graph traversal. Instead of (or in addition to) embedding chunks into a vector index, the system builds a knowledge graph from the corpus: entities (people, organizations, concepts, products) become nodes, and relationships ("works at", "acquired by", "is a subtype of") become edges. Retrieval then traverses the graph rather than (or alongside) searching the vector index.

Graph RAG excels at relationship-heavy queries -- questions that are fundamentally about connections between entities. "Who are all the people who have worked at both company X and company Y?" is trivial in a graph (follow the "works at" edges from X, find the intersection with those who "work at" Y) but nearly impossible with vector similarity, which has no notion of entity relationships.

How It Works

The corpus is processed by an LLM (or NER + relation extraction pipeline) that extracts entities and relationships, building a structured graph. At query time, the system identifies the entities mentioned in the query, locates them in the graph, and traverses the graph to find connected entities and the paths between them. The subgraph discovered by this traversal is then converted to text and passed to the LLM as context.

Microsoft's GraphRAG (2024) popularized a specific approach: build the graph, then compute community summaries -- hierarchical summaries of clusters of related entities. At query time, the system determines which community summaries are relevant and uses them as context. This enables queries that span many documents, because the community summaries aggregate information that no single document contains.

When Graph RAG Outperforms Vector RAG

Full coverage: Graph RAG is a deep topic with its own indexing strategies, query patterns, and deployment considerations. This section is an introduction. A dedicated page in the RAG technical library covers Graph RAG in full depth, including knowledge graph construction, community detection algorithms, hybrid graph+vector retrieval, and on-premise graph database options (Neo4j, NebulaGraph, Apache AGE).
When to use: Relationship-heavy queries, multi-entity questions, cross-document reasoning, hierarchical summarization. Domains with rich relational structure (organizational data, supply chain, legal entity networks, biomedical ontologies). Often used in combination with vector RAG rather than as a replacement -- the hybrid approach uses vector search for initial candidate retrieval and graph traversal for relationship reasoning.

11. Architecture Comparison Table

The following table compares all eight architectures across the dimensions that matter for architectural selection. Use it as a quick reference when deciding which approach to adopt.

Architecture Complexity Accuracy Latency Best Use Case On-Premise Suitable
Naive RAG Low Baseline Low (<1s) Simple Q&A over small, homogeneous document sets; prototypes Yes -- minimal infra (1 embedding model + 1 vector DB + 1 LLM)
Advanced RAG Medium High Medium (1-3s) Production Q&A over larger datasets; most enterprise use cases Yes -- all components have mature on-prem options (BGE, FAISS, local LLMs)
Modular RAG Medium High (same as Advanced) Medium Production systems that will evolve; long-term maintained systems Yes -- architectural pattern, not a specific dependency
Agentic RAG High Very High (multi-hop) High (3-15s) Multi-hop reasoning; heterogeneous corpora; research tasks Yes -- requires a strong tool-use LLM (Llama-3.1-70B, Qwen-2.5-72B); GPU-heavy
Self-RAG High (training) Very High (hallucination-resistant) Medium-High Regulated domains; medical/legal/financial; precision-critical Yes -- requires fine-tuning infrastructure; model weights stay on-prem
Corrective RAG Medium-High High (error-correcting) Medium Noisy document sets; variable retrieval quality; mixed-authority corpora Yes -- fallback source must be adapted (alternative internal index for air-gapped)
Adaptive RAG Medium-High High (query-optimized) Variable (low avg) Mixed query types; latency-sensitive systems with diverse traffic Yes -- classifier runs locally; routes to on-prem RAG subsystems
Graph RAG High Very High (relational) Medium-High Relationship-heavy queries; cross-document reasoning; hierarchical summaries Yes -- Neo4j, NebulaGraph, Apache AGE all run on-premise

Cost & Infrastructure Summary

Architecture Models Required Training Needed Min GPU (On-Prem) Engineering Effort
Naive RAG 1 embedding + 1 LLM No 1 GPU (7B LLM) Days
Advanced RAG 1 embedding + 1 reranker + 1 LLM No 1-2 GPUs 1-2 weeks
Modular RAG Same as Advanced (swappable) No 1-2 GPUs 2-4 weeks (framework setup)
Agentic RAG 1 embedding + 1 LLM (tool-use) No 2-4 GPUs (70B model) 2-4 weeks (prompt eng + eval)
Self-RAG 1 fine-tuned LLM + critic Yes (reflection token FT) 4+ GPUs (training + inference) 4-8 weeks (data prep + FT + eval)
Corrective RAG 1 embedding + 1 evaluator + 1 LLM Yes (evaluator FT, small) 2 GPUs 2-3 weeks
Adaptive RAG 1 classifier + Advanced + Agentic stack Optional (classifier FT) 2-4 GPUs 3-6 weeks (full stack)
Graph RAG 1 LLM (graph extraction) + graph DB No (graph built from corpus) 2 GPUs + graph DB server 3-6 weeks (graph construction + tuning)

12. Architecture Diagrams (Side-by-Side)

The following diagrams present all architectures in a uniform format for direct comparison. Each shows the data flow from user query to final answer, highlighting where decisions are made and where the architectures diverge.

Naive RAG vs. Advanced RAG

NAIVE RAG ADVANCED RAG ========= ============ [Query] [Query] | | v v [Embed] [Query Transform] | / | \ v / | \ [Vector Search] [Rewrite][Expand][HyDE] | \ | / v \ | / [top-k chunks] v v v | [Merged Queries] v | [Prompt] v | [Hybrid Search] v (dense + BM25) [LLM] | | v v [top-100 candidates] [Answer] | v [Cross-Encoder Re-Rank] | v [top-10 chunks] | v [Context Compression] | v [Prompt with Citations] | v [LLM] | v [Answer]

Self-RAG vs. Corrective RAG

SELF-RAG CORRECTIVE RAG ======== ============== [Query] [Query] | | v v [Retrieve?] [Standard Retrieval] (token decision) (always retrieves) | | +-- No --> [LLM] v | [Answer] [Eval Retrieved Docs] | (3-tier: correct/ +-- Yes ambiguous/incorrect) | | v +-----+-----+ [Retrieve top-k] | | | | v v v [IsRel token] Keep Refine Discard (per passage) docs strips + fallback | | | | +-- Relevant --> Keep | | [Web/Alt Index] | | | | +-- Irrelevant -> Drop | | [Re-evaluate] | | | | v | | [Refined] [Generate answer] | | | | v v v v [Final Context Assembly] [IsSup token] | (per claim) v | [LLM] +-- Supported --> Keep | | v +-- Unsupported -> Drop [Answer] | v [Grounded Answer]

Adaptive RAG Routing

ADAPTIVE RAG -- QUERY ROUTING ============================== [User Query] | v [Complexity Classifier] / | \ v v v [Simple] [Medium] [Complex] | | | v v v [No Retrieval] | [Agentic RAG] (LLM direct) | (multi-hop loop) | | | | v | | [Advanced RAG] | | (single pass) | | | | v v v [Answer] [Answer] [Answer] \ | / \ | / v v v [Unified Response]

Graph RAG (Hybrid with Vector)

GRAPH RAG (HYBRID VECTOR + GRAPH) ================================== [Document Corpus] | +-----------+-----------+ | | | v v v [Chunking] [Entity & [Vector | Relation Index] | Extraction] | | v v [Vector Index] [Knowledge Graph] | | | [Community | Detection] | | | [Community | Summaries] | | v v [Query] ----> [Hybrid Retrieval] | | | +-----+-----+ | | | | v v | [Vector [Graph | Search] Traversal] | | | | v v | [Chunks] [Subgraph + | Community | Summaries] | | | | +-----+-----+ | | | v | [Context Assembly] | | v v [LLM Generator] | v [Grounded Answer]

13. On-Premise Deployment Guide

Every architecture in this article can run entirely on-premise, with no data leaving your network. This is a hard requirement for many deployments: classified government environments, HIPAA-regulated healthcare, GDPR-sensitive European deployments, financial institutions under audit, and any organization that treats its data as a sovereign asset. The following guidance covers the practical considerations for each layer of the stack.

Embedding Models (On-Premise)

The embedding model converts text to vectors for both indexing and querying. It must run locally. The leading open-weight options are:

Model Dimensions License Notes
BGE-large-en-v1.5 1024 MIT Strong general-purpose; widely deployed on-prem
BGE-M3 1024 MIT Multilingual; supports dense, sparse, and multi-vector in one model
E5-large-v2 1024 MIT Microsoft; good for technical text
gte-large-en-v1.5 1024 MIT Alibaba; strong on MTEB benchmarks
Nomic-embed-text-v1.5 768 Apache 2.0 Open data; fully reproducible; long context (8K)

Vector Databases (On-Premise)

Database License Hybrid Search Deployment
Qdrant Apache 2.0 Yes (native) Docker, Kubernetes; Rust; fast and memory-efficient
Milvus Apache 2.0 Yes (via BM25 endpoint) Distributed; scales to billions of vectors; Go + C++
Weaviate BSD-3 Yes (native) Docker, Kubernetes; Go; built-in modules for common models
Chroma Apache 2.0 Limited Python; easiest setup; good for prototyping and small deployments
FAISS MIT No (library only) C++ library; fastest ANN search; no server; embed in your app
pgvector PostgreSQL Yes (with pg_trgm) Extension for PostgreSQL; leverages existing DB infrastructure

Re-Ranking Models (On-Premise)

LLM Generators (On-Premise)

The generator LLM is the largest infrastructure cost. Model choice depends on the architecture:

All of these models are available as open weights and can be served locally with vLLM, TGI, or Ollama. No API calls leave your network.

Air-Gapped Considerations

Air-gapped note: In a fully air-gapped environment (no internet access), the CRAG fallback to web search is not available. Replace the web-search fallback with an alternative on-premise retrieval source: a secondary index using a different embedding model, a BM25-only index, or a broader corpus index. The corrective loop's value (detecting bad retrieval and trying an alternative) is preserved; only the fallback source changes. Similarly, any LLM-based pre-retrieval (HyDE, query expansion) must use a local model, not a cloud API.

14. Selection Decision Tree

Use the following decision tree to select the right RAG architecture for your use case. Start at the top and follow the branch that matches your constraints.

RAG ARCHITECTURE SELECTION TREE ================================ START | +-- Is this a prototype or proof-of-concept? | | | +-- Yes --> NAIVE RAG (ship in a weekend, learn from it) | | | +-- No --> continue | +-- Is your document set small (<10K chunks) and homogeneous? | | | +-- Yes --> ADVANCED RAG (query transform + hybrid + re-rank) | | | +-- No --> continue | +-- Do your questions require multi-hop reasoning | (each step depends on the previous)? | | | +-- Yes --> AGENTIC RAG (LLM-driven iterative retrieval) | | | +-- No --> continue | +-- Is hallucination reduction the #1 priority | (regulated domain, every claim must be grounded)? | | | +-- Yes --> SELF-RAG (requires fine-tuning investment) | | | +-- No --> continue | +-- Is your corpus noisy with variable retrieval quality? | | | +-- Yes --> CORRECTIVE RAG (evaluator + fallback) | | | +-- No --> continue | +-- Are your questions primarily about relationships | between entities? | | | +-- Yes --> GRAPH RAG (or Graph + Vector hybrid) | | | +-- No --> continue | +-- Do you have a mix of simple and complex questions | and want to optimize average latency? | | | +-- Yes --> ADAPTIVE RAG (classifier + route to subsystems) | | | +-- No --> continue | +-- Default: ADVANCED RAG in a MODULAR RAG framework (covers ~80% of production use cases)
Practical note: The most common production path is: start with Naive RAG to validate the use case → upgrade to Advanced RAG with hybrid search and re-ranking → adopt Modular RAG as the framework → selectively add Agentic, Self, Corrective, Adaptive, or Graph components where the evaluation set demands it. Do not start with the most complex architecture. Start simple, measure, and upgrade only the components that the data tells you are failing.

Summary & Key Takeaways

RAG has evolved from a single three-stage pipeline into a family of architectures, each addressing a distinct failure mode of its predecessor. Understanding these architectures -- and knowing when to apply each -- is the core competence of anyone building production retrieval-augmented systems.

  1. Naive RAG (index → retrieve → generate) is the baseline. Simple, fast, sufficient for small corpora and simple questions. Start here.
  2. Advanced RAG adds pre-retrieval (query transformation, HyDE), retrieval (hybrid search, cross-encoder re-ranking), and post-retrieval (compression, citation) optimization. The sweet spot for most production systems.
  3. Modular RAG makes each component swappable. Not a different pipeline, but a design discipline that enables independent upgrades and A/B testing.
  4. Agentic RAG lets the LLM decide when and what to retrieve. Necessary for multi-hop reasoning and heterogeneous corpora. Higher latency and cost.
  5. Self-RAG trains the model to self-assess retrieval necessity and passage relevance. The strongest approach for hallucination reduction in regulated domains. Requires fine-tuning.
  6. Corrective RAG evaluates retrieval quality and falls back to alternative sources on failure. Best for noisy corpora with variable retrieval quality.
  7. Adaptive RAG classifies query complexity and routes to the cheapest sufficient pipeline. Optimizes average latency across mixed query distributions.
  8. Graph RAG uses knowledge graphs for relationship-heavy queries. Unmatched for multi-entity and cross-document reasoning. Often combined with vector RAG in a hybrid approach.

Every architecture in this article runs fully on-premise. For sovereign, air-gapped, or regulated deployments, the open-weight ecosystem -- BGE embeddings, FAISS/Qdrant/Milvus indexes, BGE-reranker, Llama/Qwen/DeepSeek LLMs -- provides a complete, no-data-egress RAG stack. The choice of architecture is independent of the deployment model; what changes is the fallback source (for CRAG) and the available models (for agentic and Self-RAG). Build the simplest architecture that passes your evaluation set, and upgrade only when the data tells you to.

Further Reading