Advanced RAG Techniques πŸš€

Snapshot 2026-08-04 16:17:00 UTC Β· version 1

● published
C
Collider.club487 cards Β· 9.8/10 MDRSS

A community-driven hub of 42+ runnable notebooks covering RAG techniques from foundational to cutting-edge - the intuition, the code, and the references to build more accurate, context-rich retrieval systems. Use it as a repeatable review, validation or hardening pass.

MARKDOWN SNAPSHOT

Loading…

Direct .mdRaw + metadata0 commentsMDRSS 9.8/10
INDEXABLE MARKDOWN SNAPSHOT

Research document

Open canonical .md

Advanced RAG Techniques πŸš€

A community-driven hub of 42+ runnable notebooks covering RAG techniques from foundational to cutting-edge - the intuition, the code, and the references to build more accurate, context-rich retrieval systems. Use it as a repeatable review, validation or hardening pass.

Editorial note: curated source snapshot published by Collider.club under the MIT License. Source attribution is preserved in the front matter.

Source snapshot

Advanced RAG Techniques πŸš€

Elevating Your Retrieval-Augmented Generation Systems

A community-driven hub of 42+ runnable notebooks covering RAG techniques from foundational to cutting-edge - the intuition, the code, and the references to build more accurate, context-rich retrieval systems.


πŸŽ“ From RAG prototypes to production

Prompt to Production - my full course on building software with AI the way professionals do: the methods and paradigms behind reliable, efficient, modular production systems, taught systematically. 17 modules, each pairing a video lecture with a hands-on lab, from your first structured prompt to a working production system.

🎁 Try a full module, free

🎬
7-minute
video lecture
πŸ› οΈ
Hands-on
tutorial
πŸ€–
AI assistant
inside Claude Code

One npm install adds the module's AI assistant to your Claude Code, and it guides you through the tutorial as you build.

Sponsors ❀️

We gratefully acknowledge the organizations and individuals who have made significant contributions to this project.

Company Sponsors

Individual Sponsors

πŸ“« Stay Updated!

πŸš€
Cutting-edge
Updates
πŸ’‘
Expert
Insights
🎯
Top 0.1%
Content

Join over 50,000 AI enthusiasts getting unique cutting-edge insights and free tutorials! Plus, subscribers get exclusive early access and special 33% discounts to my book and the upcoming RAG Techniques course!

🎬 Prefer video?

I break these ideas down into short, one-idea-per-episode explainers on YouTube.


RAG Explained: Why AI Gets Your Own Documents Wrong

why chunks overlap, what "meaning space" is, and where simple RAG breaks down

How Do You Search a Spreadsheet by Meaning?

turn each row into one labelled line and search the table by meaning

How Do You Know Your RAG Answer Isn't Made Up?

three checkpoints that catch a bad chunk on the way in and an unsupported claim on the way out

Why Does RAG Return a Paragraph When You Asked for One Fact?

why a paragraph's embedding is a blend that points at nothing in particular

Β  Browse every episode β†’

Introduction

Retrieval-Augmented Generation (RAG) is revolutionizing the way we combine information retrieval with generative AI. This repository showcases a curated collection of advanced techniques designed to supercharge your RAG systems, enabling them to deliver more accurate, contextually relevant, and comprehensive responses.

Our goal is to provide a valuable resource for researchers and practitioners looking to push the boundaries of what's possible with RAG. By fostering a collaborative environment, we aim to accelerate innovation in this exciting field.

πŸ“– Go deeper: the book

RAG Made Simple - the 400-page visual companion to this repo. Amazon Bestseller in Generative AI · 1,500+ readers · ⭐ 4.6

Get it - 33% off with code RAGKING β†’ Β· Read Chapter 1 free

Related Projects

πŸš€ Agents Towards Production - code-first tutorials for shipping production-grade GenAI agents, prototype to scale.

πŸ€– GenAI Agents - a broad collection of AI agent implementations and tutorials.

πŸ–‹οΈ Prompt Engineering Techniques - prompting strategies from basics to advanced.

🧠 Agent Memory Techniques - 30 notebooks on agent memory: vector stores, knowledge graphs, Mem0, MemGPT, Zep, Graphiti.

Join the community

Contributions make this better - propose ideas, share techniques, or give feedback via CONTRIBUTING.md.

r/EducationalAI Β· Discord Β· LinkedIn

Key Features

  • 🧠 State-of-the-art RAG enhancements
  • πŸ“š Comprehensive documentation for each technique
  • πŸ› οΈ Practical implementation guidelines
  • 🌟 Regular updates with the latest advancements

Advanced Techniques

Explore our extensive list of cutting-edge RAG techniques:

Recently added: MemoRAG (memory-augmented retrieval), End-to-End RAG Evaluation, Open-RAG-Eval, JSON RAG. 42 notebooks and growing.

# Category Technique View
1 Foundational 🌱 Basic RAG
2 Foundational 🌱 RAG with CSV Files
3 Foundational 🌱 Reliable RAG
4 Foundational 🌱 Optimizing Chunk Sizes
5 Foundational 🌱 Proposition Chunking
6 Query Enhancement πŸ” Query Transformations
7 Query Enhancement πŸ” HyDE (Hypothetical Document Embedding)
8 Query Enhancement πŸ” HyPE (Hypothetical Prompt Embedding)
9 Context Enrichment πŸ“š Contextual Chunk Headers
10 Context Enrichment πŸ“š Relevant Segment Extraction
11 Context Enrichment πŸ“š Context Window Enhancement
12 Context Enrichment πŸ“š Semantic Chunking
13 Context Enrichment πŸ“š Contextual Compression
14 Context Enrichment πŸ“š Document Augmentation
15 Advanced Retrieval πŸš€ Fusion Retrieval
16 Advanced Retrieval πŸš€ Reranking
17 Advanced Retrieval πŸš€ Multi-faceted Filtering Described below (no notebook yet)
18 Advanced Retrieval πŸš€ Hierarchical Indices
19 Advanced Retrieval πŸš€ Dartboard Retrieval
20 Advanced Retrieval πŸš€ Multi-modal RAG with Captioning
21 Iterative Techniques πŸ” Retrieval with Feedback Loop
22 Iterative Techniques πŸ” Adaptive Retrieval
23 Evaluation πŸ“Š DeepEval
24 Evaluation πŸ“Š GroUSE
25 Explainability πŸ”¬ Explainable Retrieval
26 Advanced Architecture πŸ—οΈ Graph RAG with LangChain
27 Advanced Architecture πŸ—οΈ Microsoft GraphRAG
28 Advanced Architecture πŸ—οΈ RAPTOR
29 Advanced Architecture πŸ—οΈ Agentic RAG with Contextual AI
30 Advanced Architecture πŸ—οΈ Self-RAG
31 Advanced Architecture πŸ—οΈ Corrective RAG (CRAG)
32 Advanced Architecture πŸ—οΈ Local Graph RAG with Verifiable Attribution
33 Evaluation πŸ“Š End-to-End RAG Evaluation
34 Evaluation πŸ“Š Open-RAG-Eval
35 Advanced πŸ”¬ MemoRAG
36 Special Technique 🌟 Sophisticated Controllable Agent

🌱 Foundational RAG Techniques

  1. Simple RAG 🌱

    Overview πŸ”Ž

    Introducing basic RAG techniques ideal for newcomers.

    Implementation πŸ› οΈ

    Start with basic retrieval queries and integrate incremental learning mechanisms.

  2. Simple RAG using a CSV file 🧩

    • 🎬 Watch it explained: How Do You Search a Spreadsheet by Meaning? β€” turn each row into one labelled line and search the table by meaning; ask which customers are "in South American countries" and the Chile record comes back even though those words never appear.
    • LangChain:
    • LlamaIndex:

    Overview πŸ”Ž

    Introducing basic RAG using CSV files.

    Implementation πŸ› οΈ

    This uses CSV files to create basic retrieval and integrates with openai to create question and answering system.

  3. Reliable RAG 🏷️:

    • 🎬 Watch it explained: How Do You Know Your RAG Answer Isn't Made Up? β€” the three checkpoints that catch a bad chunk on the way in and an unsupported claim on the way out, plus the source highlighting that lets a skeptical reader verify the answer themselves.

    Overview πŸ”Ž

    Enhances the Simple RAG by adding validation and refinement to ensure the accuracy and relevance of retrieved information.

    Implementation πŸ› οΈ

    Check for retrieved document relevancy and highlight the segment of docs used for answering.

  4. Choose Chunk Size πŸ“

    Overview πŸ”Ž

    Selecting an appropriate fixed size for text chunks to balance context preservation and retrieval efficiency.

    Implementation πŸ› οΈ

    Experiment with different chunk sizes to find the optimal balance between preserving context and maintaining retrieval speed for your specific use case.

  5. Proposition Chunking ⛓️‍πŸ’₯:

    Overview πŸ”Ž

    Breaking down the text into concise, complete, meaningful sentences allowing for better control and handling of specific queries (especially extracting knowledge).

    Implementation πŸ› οΈ

    • πŸ’ͺ Proposition Generation: The LLM is used in conjunction with a custom prompt to generate factual statements from the document chunks.
    • βœ… Quality Checking: The generated propositions are passed through a grading system that evaluates accuracy, clarity, completeness, and conciseness.
  6. Simple RAG with JSON

    Overview πŸ”Ž

    RAG with JSON documents is a method of using JSON files to create a retrieval and question answering system.

    Implementation πŸ› οΈ

    • πŸ“„ Data Loading & Extraction: JSON data with multiple fields per entry is loaded, and most relevant text fields are combined to generate an embedding.
    • πŸ” Retrieval: The system retrieves the most relevant JSON entries based on the user's query.

Additional Resources πŸ“š

πŸ” Query Enhancement

  1. Query Transformations πŸ”„

    Overview πŸ”Ž

    Modifying and expanding queries to improve retrieval effectiveness.

    Implementation πŸ› οΈ

    • ✍️ Query Rewriting: Reformulate queries to improve retrieval.
    • πŸ”™ Step-back Prompting: Generate broader queries for better context retrieval.
    • 🧩 Sub-query Decomposition: Break complex queries into simpler sub-queries.
  2. Hypothetical Questions (HyDE Approach) ❓

    Overview πŸ”Ž

    Generating hypothetical questions to improve alignment between queries and data.

    Implementation πŸ› οΈ

    Create hypothetical questions that point to relevant locations in the data, enhancing query-data matching.

    Additional Resources πŸ“š

πŸ“š Context and Content Enrichment

  1. Hypothetical Prompt Embeddings (HyPE) β“πŸš€

    Overview πŸ”Ž

    HyPE (Hypothetical Prompt Embeddings) is an enhancement to traditional RAG retrieval that precomputes hypothetical prompts at the indexing stage, but inseting the chunk in their place. This transforms retrieval into a question-question matching task. This avoids the need for runtime synthetic answer generation, reducing inference-time computational overhead while improving retrieval alignment.

    Implementation πŸ› οΈ

    • πŸ“– Precomputed Questions: Instead of embedding document chunks, HyPE generates multiple hypothetical queries per chunk at indexing time.
    • πŸ” Question-Question Matching: User queries are matched against stored hypothetical questions, leading to better retrieval alignment.
    • ⚑ No Runtime Overhead: Unlike HyDE, HyPE does not require LLM calls at query time, making retrieval faster and cheaper.
    • πŸ“ˆ Higher Precision & Recall: Improves retrieval context precision by up to 42 percentage points and claim recall by up to 45 percentage points.

    Additional Resources πŸ“š

  2. Contextual Chunk Headers :label::

    Overview πŸ”Ž

    Contextual chunk headers (CCH) is a method of creating document-level and section-level context, and prepending those chunk headers to the chunks prior to embedding them.

    Implementation πŸ› οΈ

    Create a chunk header that includes context about the document and/or section of the document, and prepend that to each chunk in order to improve the retrieval accuracy.

    Additional Resources πŸ“š

    dsRAG: open-source retrieval engine that implements this technique (and a few other advanced RAG techniques)

  3. Relevant Segment Extraction 🧩:

    Overview πŸ”Ž

    Relevant segment extraction (RSE) is a method of dynamically constructing multi-chunk segments of text that are relevant to a given query.

    Implementation πŸ› οΈ

    Perform a retrieval post-processing step that analyzes the most relevant chunks and identifies longer multi-chunk segments to provide more complete context to the LLM.

  4. Context Enrichment Techniques πŸ“

Overview πŸ”Ž

Enhancing retrieval accuracy by embedding individual sentences and extending context to neighboring sentences.

Implementation πŸ› οΈ

Retrieve the most relevant sentence while also accessing the sentences before and after it in the original text.

  1. Semantic Chunking 🧠

Overview πŸ”Ž

Dividing documents based on semantic coherence rather than fixed sizes.

Implementation πŸ› οΈ

Use NLP techniques to identify topic boundaries or coherent sections within documents for more meaningful retrieval units.

Additional Resources πŸ“š

  1. Contextual Compression πŸ—œοΈ

Overview πŸ”Ž

Compressing retrieved information while preserving query-relevant content.

Implementation πŸ› οΈ

Use an LLM to compress or summarize retrieved chunks, preserving key information relevant to the query.

  1. Document Augmentation through Question Generation for Enhanced Retrieval

Overview πŸ”Ž

This implementation demonstrates a text augmentation technique that leverages additional question generation to improve document retrieval within a vector database. By generating and incorporating various questions related to each text fragment, the system enhances the standard retrieval process, thus increasing the likelihood of finding relevant documents that can be utilized as context for generative question answering.

Implementation πŸ› οΈ

Use an LLM to augment text dataset with all possible questions that can be asked to each document.

πŸš€ Advanced Retrieval Methods

  1. Fusion Retrieval πŸ”—

    Overview πŸ”Ž

    Optimizing search results by combining different retrieval methods.

    Implementation πŸ› οΈ

    Combine keyword-based search with vector-based search for more comprehensive and accurate retrieval.

  2. Intelligent Reranking πŸ“ˆ

    Overview πŸ”Ž

    Applying advanced scoring mechanisms to improve the relevance ranking of retrieved results.

    Implementation πŸ› οΈ

    • 🧠 LLM-based Scoring: Use a language model to score the relevance of each retrieved chunk.
    • πŸ”€ Cross-Encoder Models: Re-encode both the query and retrieved documents jointly for similarity scoring.
    • πŸ† Metadata-enhanced Ranking: Incorporate metadata into the scoring process for more nuanced ranking.

    Additional Resources πŸ“š

  3. Multi-faceted Filtering πŸ”

    Overview πŸ”Ž

    Applying various filtering techniques to refine and improve the quality of retrieved results.

    Implementation πŸ› οΈ

    • 🏷️ Metadata Filtering: Apply filters based on attributes like date, source, author, or document type.
    • πŸ“Š Similarity Thresholds: Set thresholds for relevance scores to keep only the most pertinent results.
    • πŸ“„ Content Filtering: Remove results that don't match specific content criteria or essential keywords.
    • 🌈 Diversity Filtering: Ensure result diversity by filtering out near-duplicate entries.
  4. Hierarchical Indices πŸ—‚οΈ

    Overview πŸ”Ž

    Creating a multi-tiered system for efficient information navigation and retrieval.

    Implementation πŸ› οΈ

    Implement a two-tiered system for document summaries and detailed chunks, both containing metadata pointing to the same location in the data.

    Additional Resources πŸ“š

  5. Dartboard Retrieval 🎯

    • LangChain:

    Overview πŸ”Ž

    Optimizing over Relevant Information Gain in Retrieval

    Implementation πŸ› οΈ

    • Combine both relevance and diversity into a single scoring function and directly optimize for it.
    • POC showing plain simple RAG underperforming when the database is dense, and the dartboard retrieval outperforming it.
  6. Multi-modal Retrieval πŸ“½οΈ

    Overview πŸ”Ž

    Extending RAG capabilities to handle diverse data types for richer responses.

    Implementation πŸ› οΈ

    • Multi-model RAG with Multimedia Captioning: - Caption and store all the other multimedia data like pdfs, ppts, etc., with text data in vector store and retrieve them together.
    • Multi-model RAG with Colpali: - Instead of captioning convert all the data into image, then find the most relevant images and pass them to a vision large language model.

πŸ” Iterative and Adaptive Techniques

  1. Retrieval with Feedback Loops πŸ”

    Overview πŸ”Ž

    Implementing mechanisms to learn from user interactions and improve future retrievals.

    Implementation πŸ› οΈ

    Collect and utilize user feedback on the relevance and quality of retrieved documents and generated responses to fine-tune retrieval and ranking models.

  2. Adaptive Retrieval 🎯

    Overview πŸ”Ž

    Dynamically adjusting retrieval strategies based on query types and user contexts.

    Implementation πŸ› οΈ

    Classify queries into different categories and use tailored retrieval strategies for each, considering user context and preferences.

πŸ“Š Evaluation

  1. DeepEval Evaluation: | Comprehensive RAG system evaluation |

    Overview πŸ”Ž

    Performing evaluations Retrieval-Augmented Generation systems, by covering several metrics and creating test cases.

    Implementation πŸ› οΈ

    Use the deepeval library to conduct test cases on correctness, faithfulness and contextual relevancy of RAG systems.

  2. GroUSE Evaluation: | Contextually-grounded LLM evaluation |

    Overview πŸ”Ž

    Evaluate the final stage of Retrieval-Augmented Generation using metrics of the GroUSE framework and meta-evaluate your custom LLM judge on GroUSE unit tests.

    Implementation πŸ› οΈ

    Use the grouse package to evaluate contextually-grounded LLM generations with GPT-4 on the 6 metrics of the GroUSE framework and use unit tests to evaluate a custom Llama 3.1 405B evaluator.

  3. End-to-End RAG Evaluation: | Complete evaluation pipeline |

    Overview πŸ”Ž

    A comprehensive tutorial covering evaluation criteria selection, LLM-as-a-judge metrics, RAGAS integration, and full evaluation pipeline assembly.

    Implementation πŸ› οΈ

    • Build custom metrics for completeness, relevance, and hallucination detection using the RAG-12000 dataset.
  4. Open-RAG-Eval: | Open-source RAG evaluation |

    Overview πŸ”Ž

    Demonstrates the open-rag-eval library for evaluation using UMBRELA scoring, AutoNuggetizer, and citation/hallucination detection.

    Implementation πŸ› οΈ

    • Evaluate RAG pipelines using multiple open-source metrics against the FIQA financial dataset.

🧠 Memory-Augmented Retrieval

  1. MemoRAG: | Memory-augmented retrieval |

    Overview πŸ”Ž

    A from-scratch implementation of MemoRAG - a memory-augmented RAG system with key-value pair extraction, surrogate query generation, and multi-query retrieval.

    Implementation πŸ› οΈ

    • Build a complete MemoryStore with FAISS-based retrieval, surrogate queries, and comparison evaluation against standard RAG.

πŸ”¬ Explainability and Transparency

  1. Explainable Retrieval πŸ”

This HTML preview is truncated for page performance. The canonical Markdown file contains the complete snapshot.

MARKDOWN METRICS
5338words
32headings
222links
2code blocks
MDRSS ASSESSMENT
Scam / risk5/100low
Evidence100/100high confidence
Why MDRSS assigned this score
  • evidence comes from multiple domains
  • some evidence URLs look like primary-source hosts
Evidence (4)
concept:rag-and-knowledge-systemsorg:collider-club

Discussion 0

Sign in to join the discussion.