# Technical Diagram Analysis: RAG Architectures
## Overview
The image compares three RAG (Retrieval-Augmented Generation) architectures: **Naive RAG**, **Advanced RAG**, and **Modular RAG**. It includes modules, patterns, and workflows for document retrieval and generation.
---
## Naive RAG
### Components
1. **User Query** → **Documents**
2. **Indexing**
3. **Retrieval**
4. **Prompt** → **Frozen LLM**
5. **Output**
### Workflow
- User submits a query.
- Documents are indexed.
- Retrieval fetches relevant documents.
- A prompt is generated and processed by a frozen LLM.
- Final output is produced.
---
## Advanced RAG
### Components
1. **User Query** → **Documents**
2. **Indexing**
3. **Pre-Retrieval**
- Query Routing
- Query Rewriting
- Query Expansion
4. **Retrieval**
5. **Post-Retrieval**
- Rerank
- Summary
- Fusion
6. **Prompt** → **Frozen LLM**
7. **Output**
### Workflow
- Enhanced preprocessing (query routing, rewriting, expansion) before retrieval.
- Post-retrieval steps (reranking, summarization, fusion) refine results.
- Output generated via frozen LLM.
---
## Modular RAG
### Modules
- **Routing**
- **Search**
- **Predict**
- **Demonstrate**
- **Retrieve**
- **Rewrite**
- **RAG**
- **Rerank**
- **Read**
- **Fusion**
- **Memory**
### Patterns
1. **Naive RAG**
- Retrieve → Read
2. **Advanced RAG**
- Retrieve → Rerank → Read
3. **DSP (Khattab et al., 2022)**
- Retrieve → Search → Predict
4. **ITER-RETGEN (Shao et al., 2023)**
- Retrieve → Read → Retrieve → Read (iterative loop)
### Workflow
- Modular components interact via dashed lines (e.g., Routing → Search → Predict).
- Central RAG module connects to Retrieve, Rewrite, Rerank, and Read.
- Iterative patterns (e.g., ITER-RETGEN) emphasize cyclical processing.
---
## Key Observations
1. **Complexity Progression**:
- Naive RAG: Linear workflow.
- Advanced RAG: Adds preprocessing and post-processing.
- Modular RAG: Decentralized, iterative, and pattern-specific.
2. **Frozen LLM**: Used in both Naive and Advanced RAG for output generation.
3. **Iterative Patterns**: ITER-RETGEN highlights multi-step retrieval and reading.
4. **Research Citations**:
- DSP: Khattab et al., 2022
- ITER-RETGEN: Shao et al., 2023
---
## Diagram Structure
- **Color Coding**:
- Orange boxes: Pre-/Post-Retrieval steps.
- Blue boxes: Core components (e.g., Retrieval, Read).
- **Dashed Lines**: Represent optional or iterative connections (e.g., Memory → Fusion).
- **Central RAG Module**: Acts as a hub for key operations (Retrieve, Rewrite, Rerank, Read).