Spaces:
Running
Running
File size: 21,623 Bytes
ca37a76 1d20677 1854e16 1d20677 36b4df9 1d20677 d05e72f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | const ragData = [
{
type: "Naive RAG",
year: 2020,
category: "Foundational",
indexing: "Preprocessing β Fixed Chunking β Simple Embedding β Vector DB Storage",
inference: "User Query β Embedding β Vector DB Lookup (Top-K) β Concatenation β LLM Generate",
benefits: "Establishes the knowledge retrieval baseline; Simple and cheap to implement.",
challenges: "Context loss due to rigid chunking; High hallucination risk; Poor handling of complex/multi-step queries.",
references: "Lewis, P., et al. (2020). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. NeurIPS 2020.",
paperUrl: "https://arxiv.org/abs/2005.11401"
},
{
type: "Self RAG",
year: 2023,
category: "Agentic & Modular",
indexing: "Preprocessing β Standard Chunking β Embedding β Vector DB Storage",
inference: "User Query β LLM Generates a thought β Retrieval β LLM Generates/Evaluates Retrieved Passages β LLM Decides if Answer is Ready β Final LLM Generate",
benefits: "Reduces hallucinations by self-critique/verification; Filters out poor quality retrieved passages.",
challenges: "Increases inference latency (multiple LLM calls per query); Requires careful tuning of reflection/critique prompt.",
references: "Asai, A., et al. (2023). Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection. arXiv:2310.11511",
paperUrl: "https://arxiv.org/abs/2310.11511"
},
{
type: "Modular RAG",
year: 2024,
category: "Modular",
indexing: "Preprocessing β Standard Chunking β Embedding β Vector DB Storage",
inference: "User Query β Router/Module Selection β Selected Module Executes β LLM Generate",
benefits: "Improves flexibility and component reusability; Enables optimal module selection for specific tasks.",
challenges: "Requires complex routing/planning logic; Overhead of training/managing multiple specialized components.",
references: "Gao, Y., et al. (2024). Modular RAG: Transforming RAG Systems into LEGO-like Reconfigurable Frameworks. arXiv:2407.21059",
paperUrl: "https://arxiv.org/abs/2407.21059"
},
{
type: "Cache RAG",
year: 2024,
category: "Modular",
indexing: "Preprocessing β Standard Chunking β Embedding β Vector DB Storage",
inference: "User Query β Cache Lookup β If Hit: Return Cached Answer β If Miss: Standard Retrieval β LLM Generate β Cache Store",
benefits: "Dramatically improves latency and reduces LLM cost for repeated or highly similar queries.",
challenges: "Complex cache invalidation logic; Requires robust query similarity and hashing functions.",
references: "Jin, C., et al. (2024). RAGCache: Efficient Knowledge Caching for Retrieval-Augmented Generation. ACM TOCS.",
paperUrl: "https://arxiv.org/abs/2404.12457"
},
{
type: "MultiModal RAG",
year: 2024,
category: "Structural",
indexing: "Preprocessing β Multi-Modal Embedding (e.g., CLIP) β Stores representations of all modalities in Vector DB",
inference: "User Query (Text or Image) β Multi-Modal Embedding β Vector DB Lookup (Retrieves related text, image, metadata) β LLM Generate",
benefits: "Unlocks knowledge stored in non-text data (images, charts, tables); Provides a richer context.",
challenges: "Requires specialized multimodal embeddings/models; Indexing is computationally expensive; Difficult to combine disparate modalities coherently.",
references: "Gao, Y., et al. (2024). Retrieval-Augmented Multimodal Language Modeling. CVPR 2024.",
paperUrl: "https://arxiv.org/abs/2211.12561"
},
{
type: "Graph RAG",
year: 2024,
category: "Structural & Modular",
indexing: "Preprocessing β Entity/Relation Extraction β Store in Knowledge Graph (KG) & Vector DB",
inference: "User Query β Embedding/KG Query β Simultaneous Retrieval (Vector + KG Path) β Concatenation β LLM Generate",
benefits: "Resolves complex, multi-hop queries by leveraging factual relationships; Improves interpretability and fact consistency.",
challenges: "High indexing complexity (KG construction); Expensive maintenance for rapidly changing data; Retrieval latency can be high.",
references: "Barry, M., et al. (2025). GraphRAG: Leveraging Graph-Based Efficiency to Minimize Hallucinations in LLM-Driven RAG. GenAIK Workshop.",
paperUrl: "https://aclanthology.org/2025.genaik-1.6/"
},
{
type: "Recursive RAG",
year: 2024,
category: "Structural & Modular",
indexing: "Preprocessing β Chunking & Summarization β Embeddings of both chunks & summaries β Vector DB Storage",
inference: "User Query β Retrieval β LLM evaluates initial result β Recursive Query β Retrieve Specific Chunks β LLM Generate",
benefits: "Summarizes context or decomposes queries recursively; Handles high-level questions that require abstract understanding.",
challenges: "Risk of information loss during aggressive summarization; Chain of thought adds significant latency.",
references: "Liu, Y., et al. (2024). RAG-GPT: Retrieval-Augmented Generation for Open-Domain Question Answering. IJCNN 2024.",
paperUrl: "https://arxiv.org/abs/2405.10627"
},
{
type: "Multi-Hop RAG",
year: 2024,
category: "Structural & Modular",
indexing: "Preprocessing β Chunking/Entity Extraction β Embedding β Structured Storage (Vector DB + Optional KG)",
inference: "User Query β Query Decomposition β Hop 1 Retrieval β Iterative Reasoning β Hop 2 Retrieval β Final Evidence Aggregation β LLM Generate",
benefits: "Solves questions requiring reasoning across multiple independent documents or retrieval steps.",
challenges: "Prone to error propagation (if one hop fails); Significantly higher latency; Requires generation of accurate intermediate queries.",
references: "Tang, B., & Yang, Y. (2024). MultiHop-RAG: Benchmarking Retrieval-Augmented Generation for Multi-Hop Queries. COLM 2024.",
paperUrl: "https://arxiv.org/abs/2401.15391"
},
{
type: "Corrective RAG",
year: 2024,
category: "Agentic & Modular",
indexing: "Preprocessing β Standard Chunking β Embedding β Vector DB Storage",
inference: "User Query β Standard Retrieval β Retrieved Docs Evaluated β Corrective Action β LLM Generate",
benefits: "Detects and corrects poor quality retrieval/generation post-hoc; Increases overall trustworthiness.",
challenges: "High latency due to iterative correction loops; Requires training a dedicated evaluation model.",
references: "Yan, S.-Q., et al. (2024). Corrective Retrieval Augmented Generation. arXiv:2401.15884",
paperUrl: "https://arxiv.org/abs/2401.15884"
},
{
type: "Agentic RAG",
year: 2024,
category: "Agentic & Modular",
indexing: "Preprocessing β Standard Chunking β Embedding β Vector DB Storage",
inference: "User Query β Agent Planning/Tool Selection β Agent Executes RAG Retrieval β Agent Reflects/Synthesizes β Final LLM Generate",
benefits: "Handles complex, goal-oriented tasks via dynamic planning, tool use, and state tracking.",
challenges: "Highest development/orchestration complexity; Slowest inference due to planning/execution loops; Failure in planning leads to catastrophic task failure.",
references: "Singh, A., et al. (2025). Agentic Retrieval-Augmented Generation: A Survey on Agentic RAG.",
paperUrl: "https://arxiv.org/abs/2412.09550"
},
{
type: "Adaptive RAG",
year: 2024,
category: "Agentic & Modular",
indexing: "Preprocessing β Standard Chunking β Embedding β Vector DB Storage β Train Query Complexity Classifier",
inference: "User Query β Query Classification (Router) β Adaptive Decision β Retrieval Execution β LLM Generate",
benefits: "Optimizes pipeline complexity and cost based on query assessment.",
challenges: "Requires training a robust query classifier/router; Misclassification can lead to poor quality results.",
references: "Jeong, S., et al. (2024). Adaptive-RAG: Learning to Adapt Retrieval-Augmented Large Language Models through Question Complexity. NAACL 2024.",
paperUrl: "https://arxiv.org/abs/2403.14403"
},
{
type: "Hierarchical RAG",
year: 2025,
category: "Structural & Modular",
indexing: "Preprocessing β Hierarchical Chunking (Multiple levels) β Multiple Embeddings (for each level) β Vector DB Storage",
inference: "User Query β Embedding β Multi-Level Retrieval β Concatenation β LLM Generate",
benefits: "Solves the 'needle-in-a-haystack' problem for very long documents; Efficiently prunes non-relevant sections.",
challenges: "Complex, multi-level chunking and indexing structure; Requires multiple retrieval passes.",
references: "Huang, H., et al. (2025). Retrieval-Augmented Generation with Hierarchical Knowledge (HiRAG). EMNLP 2025.",
paperUrl: "https://aclanthology.org/2025.emnlp-main.1/"
},
{
type: "Speculative RAG",
year: 2025,
category: "Modular",
indexing: "Preprocessing β Standard Chunking β Embedding β Vector DB Storage",
inference: "User Query β Standard Retrieval β Drafting LLM Generates Tokens β Verifier LLM Checks Drafted Tokens Against Context β LLM Generate",
benefits: "Significantly reduces token generation latency and LLM inference cost.",
challenges: "Does not inherently improve semantic quality or hallucination rate; Requires careful balance between drafting and verifier models.",
references: "Wang, Z., et al. (2025). Speculative RAG: Enhancing Retrieval Augmented Generation through Drafting. ICLR 2025.",
paperUrl: "https://arxiv.org/abs/2407.08223"
}
];
const chunkingData = [
{
type: "Sliding Window Chunking",
year: 1998,
category: "Size-based",
workflow: "Input Document β Define Chunk Size & Overlap β Slide Window (e.g., size 300, overlap 100) β Create Overlapping Chunks β Output Chunks",
description: "Uses a fixed chunk size plus overlap (e.g., chunk size 300, overlap 100). Maintains context continuity across chunks.",
references: "Carbonell, J. & Goldstein, J. (1998). The use of MMR, diversity-based reranking for reordering documents. SIGIR 1998.",
paperUrl: "https://dl.acm.org/doi/10.1145/290941.291025"
},
{
type: "Fixed-size Chunking",
year: 2001,
category: "Size-based",
workflow: "Input Document β Define Token/Word Limit β Split Text at Limit β Create Fixed Chunks β Output Chunks",
description: "Splits text into chunks based on a fixed number of tokens/words (e.g., 200-500 tokens). Simple but may break semantic boundaries.",
references: "Collobert, R., et al. (2011). Natural language processing (almost) from scratch. Journal of Machine Learning Research 12:2493-2537.",
paperUrl: "https://www.jmlr.org/papers/volume12/collobert11a/collobert11a.pdf"
},
{
type: "Discourse-aware Chunking",
year: 2005,
category: "Semantic-based",
workflow: "Input Document β Identify Discourse Markers (however, in contrast, therefore) β Detect Conceptual Shifts β Split at Discourse Boundaries β Output Discourse Chunks",
description: "Uses discourse markers (e.g., 'however', 'in contrast', 'therefore') to detect conceptual shifts and chunk accordingly.",
references: "Sporleder, C. & Lapata, M. (2005). Discourse Chunking and its Application to Sentence Compression. HLT 2005.",
paperUrl: "https://aclanthology.org/H05-1033/"
},
{
type: "Paragraph-based Chunking",
year: 2014,
category: "Structure-based",
workflow: "Input Document β Identify Paragraph Boundaries β Split at Paragraphs β Create Paragraph Chunks β Output Chunks",
description: "Uses natural paragraph boundaries for chunking. Preserves document structure and thematic grouping.",
references: "Dudhabaware, R. S., et al. (2014). Review on natural language processing tasks for text documents. IEEE ICCIC 2014.",
paperUrl: "https://ieeexplore.ieee.org/document/7238334"
},
{
type: "Recursive/Hierarchical Chunking",
year: 2023,
category: "Hierarchical",
workflow: "Input Document β Break into Sections β Split Sections into Paragraphs β Split Paragraphs into Sentences β Split Sentences into Tokens β Output Multi-level Chunks",
description: "Breaks document into progressively smaller units (section β paragraph β sentence β tokens). Enables multi-level retrieval.",
references: "Latif, S., et al. (2025). The Chunking Paradigm: Recursive Semantic for RAG. ICNLSP 2025.",
paperUrl: "https://aclanthology.org/2025.icnlsp-1.16/"
},
{
type: "Semantic Chunking",
year: 2024,
category: "Semantic-based",
workflow: "Input Document β Analyze Topic Shifts/Semantic Boundaries β Split at Semantic Breaks β Create Semantically Coherent Chunks β Output Chunks",
description: "Chunks based on topic shifts or semantic boundaries rather than size. Preserves meaning and context.",
references: "LangChain (2024). Semantic chunker. Accessed 2024-09-14.",
paperUrl: "https://python.langchain.com/docs/how_to/semantic-chunker/"
},
{
type: "Sentence-based Chunking",
year: 2024,
category: "Structure-based",
workflow: "Input Document β Split by Sentences β Group Sentences (Optional) β Create Sentence Chunks β Output Chunks",
description: "Splits text by sentences. Maintains grammatical integrity and natural language boundaries.",
references: "Dong, K., et al. (2024). Multi-view content-aware indexing for long document retrieval. arXiv:2404.15103",
paperUrl: "https://arxiv.org/abs/2404.15103"
},
{
type: "Hybrid Chunking",
year: 2024,
category: "Semantic-based",
workflow: "Input Document β Apply Semantic Analysis β Apply Fixed-size Constraint β Apply Overlap Strategy β Create Hybrid Chunks β Output Chunks",
description: "Combines semantic + fixed-size + overlap strategies. Balances context preservation with practical constraints.",
references: "Kamradt, G. (2024). 5 levels of text splitting.",
paperUrl: ""
},
{
type: "Embedding-similarity-based Chunking",
year: 2024,
category: "Semantic-based",
workflow: "Input Document β Generate Sentence Embeddings β Calculate Similarity Scores β Detect Similarity Drops Below Threshold β Split at Low Similarity Points β Output Chunks",
description: "Sequentially processes text and opens a new chunk when embedding similarity drops below a threshold. Data-driven approach.",
references: "Kamradt, G. (2024). 5 levels of text splitting.",
paperUrl: ""
},
{
type: "Page-based Chunking",
year: 2024,
category: "Structure-based",
workflow: "Input PDF/Scanned Document β Identify Page Boundaries β Split by Page β Create Page Chunks β Output Chunks",
description: "Splits by PDF page or scanned document page. Useful for document-level retrieval and citation.",
references: "",
paperUrl: ""
},
{
type: "Domain-specific Chunking",
year: 2024,
category: "Domain-specific",
workflow: "Input Domain Document β Apply Domain Rules (legal sections, medical records, code functions) β Split by Domain Logic β Create Domain Chunks β Output Chunks",
description: "Tailored to content type (e.g., legal documents by sections, medical records by encounters, code by functions).",
references: "Allamraju, A., et al. (2024). Breaking It Down: Domain-Aware Semantic Segmentation for Retrieval Augmented Generation. arXiv:2512.00367",
paperUrl: "https://arxiv.org/abs/2512.00367"
},
{
type: "Metadata-based Chunking",
year: 2025,
category: "Structure-based",
workflow: "Input Document β Extract Metadata (headers, bullets, sections) β Split Using Metadata Structure β Create Metadata-aware Chunks β Output Chunks",
description: "Splits text using document metadata (e.g., headers, bullets). Preserves document structure and hierarchy.",
references: "Zhao, J., et al. (2025). MoC: Mixtures of Text Chunking Learners for Retrieval-Augmented Generation. ACL 2025.",
paperUrl: "https://aclanthology.org/2025.acl-long.1/"
}
];
const chunkingCategoryBriefs = {
'Size-based': 'Chunks text by fixed sizes or overlapping windows. Simple, predictable, but may break context.',
'Semantic-based': 'Identifies meaning, topics, or discourse patterns to create contextually coherent chunks.',
'Structure-based': 'Uses natural document structure (sentences, paragraphs, metadata) for boundaries.',
'Hierarchical': 'Creates multi-level chunks (sections β paragraphs β sentences) for flexible retrieval.',
'Domain-specific': 'Applies domain knowledge and rules tailored to specific content types (legal, medical, code).'
};
const mainCategoryDefinitions = {
'Foundational': 'The baseline RAG approach establishing core retrieval-augmented generation principles with simple, fixed pipelines.',
'Modular': 'Focuses on pipeline flexibility through specialized, interchangeable components and intermediate operations between query and generation.',
'Agentic': 'Uses dynamic decision-makers (agents or classifiers) to guide the pipeline, perform self-correction, and enable adaptive behavior.',
'Structural': 'Innovations in how source documents are preprocessed, stored, and indexed for more effective retrieval (e.g., knowledge graphs, hierarchies, multi-modal embeddings).'
};
function getCategoryBadgeClass(category) {
if (category.includes('Foundational')) return 'badge-foundational';
if (category.includes('Agentic')) return 'badge-agentic';
if (category.includes('Modular')) return 'badge-modular';
if (category.includes('Structural')) return 'badge-structural';
return 'badge-modular';
}
function createFlowchart(workflow, containerId) {
const container = document.getElementById(containerId);
container.innerHTML = '';
const steps = workflow.split(' β ');
steps.forEach((step, index) => {
const div = document.createElement('div');
div.className = 'flow-step';
div.textContent = step;
container.appendChild(div);
});
}
// Shared Header and Navigation Injection
function injectHeader() {
const headerHTML = `
<h1>π RAG Types and Phases Suvery Dashboard</h1>
<div class="tabs">
<a href="index.html" class="tab" data-page="index.html">RAG Types</a>
<a href="chunking.html" class="tab" data-page="chunking.html">Chunking</a>
<a href="indexing.html" class="tab" data-page="indexing.html">Indexing & Vector DB</a>
<a href="augmentation.html" class="tab" data-page="augmentation.html">Augmentation</a>
</div>
`;
const container = document.getElementById('shared-header');
if (container) {
container.innerHTML = headerHTML;
// Set active tab based on current filename
const currentPage = window.location.pathname.split('/').pop() || 'index.html';
const tabs = container.querySelectorAll('.tab');
tabs.forEach(tab => {
if (tab.getAttribute('data-page') === currentPage) {
tab.classList.add('active');
}
});
}
}
// Initialize header on load
window.addEventListener('DOMContentLoaded', injectHeader);
// SOLUTION 1: Use mermaid.render() for dynamic content (Recommended)
async function renderDynamicDiagram(mermaidCode, containerId) {
const container = document.getElementById(containerId);
// Clear previous
container.innerHTML = '';
container.removeAttribute('data-processed'); // Critical: remove mermaid's "done" marker
// Generate unique ID for this render
const uniqueId = `mermaid-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
try {
const { svg } = await mermaid.render(uniqueId, mermaidCode);
container.innerHTML = svg;
} catch (err) {
console.error('Mermaid render failed:', err);
container.innerHTML = `<pre>${mermaidCode}</pre>`; // Fallback
}
}
// In your selector event listener:
selector.addEventListener('change', async (e) => {
const selected = enhancedRagData.find(r => r.type === e.target.value);
if (selected) {
// ... other updates ...
// Render diagrams dynamically
await renderDynamicDiagram(selected.indexingMermaid, 'indexingMermaid');
await renderDynamicDiagram(selected.inferenceMermaid, 'inferenceMermaid');
}
});
|