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 = `
${mermaidCode}`; // 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');
}
});