labdmitriy/llm-rag

Jupyter Notebook

312

14 commits

updated Apr 28, 2025

See the code

README

LLM RAG

Configuration

Environment

  • Copy .env.example file to .env
  • Fill in the required values

Installation

Using pip

  • Create and activate new Python virtual environment
  • pip install -r requirements.txt
  • pip install -e . (basic packages)
    or
    pip install -e .[ragatouille] (with ragatouille for ColBERT)

Using uv

  • uv sync --group dev (basic packages)
    or
    uv sync --group dev --extra ragatouille (with ragatouille for ColBERT)
  • uv pip install -e .

RAG From Scratch

Author of original series - Lance Martin

Original Sources

Video

YouTube Playlist

Code

Main Repository
Corrective RAG (CRAG)
Self-RAG

Table of Contents

PartNameVideoSlidesJupyter NotebookPython ScriptLangGraph Studio
1OverviewWatchView01-overview.ipynb--
2IndexingWatchView02-indexing.ipynb--
3RetrievalWatchView03-retrieval.ipynb--
4GenerationWatchView04-generation.ipynb--
5Query Translation - Multi-QueryWatchView05-multi-query.ipynbmulti_query.pyQuery Translation - Multi-Query
6Query Translation - RAG-FusionWatchView06-rag-fusion.ipynbrag_fusion.pyQuery Translation - RAG-Fusion
7Query Translation - DecompositionWatchView07-01-decomposition-recursive.ipynb
07-02-decomposition-parallel.ipynb
recursive.py
parallel.py
Query Translation - Decomposition (Recursive)
Query Translation - Decomposition (Parallel)
8Query Translation - Step-Back PromptingWatchView08-step-back.ipynbstep_back.pyQuery Translation - Step-Back Prompting
9Query Translation - HyDEWatchView09-hyde.ipynbhyde.pyQuery Translation - HyDE
10RoutingWatchView10-01-logical-routing.ipynblogical.py
semantic.py
Routing - Logical Routing
Routing - Semantic Routing
11Query ConstructionWatchView11-query-construction.ipynbself_query.pyQuery Construction - Self-Query
12Indexing - Multi-Representation IndexingWatchView12-01-multi-vector-summary.ipynb
12-02-multi-vector-chunks.ipynb
12-03-multi-vector-hypothetical-questions.ipynb
summary.py
chunks.py
hypothetical_questions.py
Indexing - Multi-Vector - Summary
Indexing - Multi-Vector - Chunks
Indexing - Multi-Vector - Hypothetical Questions
13Indexing - RAPTORWatchView13-raptor.ipynbraptor.py-
14Indexing - ColBERTWatchView14-colbert.ipynbcolbert_model.py-
15Retrieval - CRAGWatch-15-crag.ipynbcrag.pyRetrieval - CRAG
16Generation - Self-RAGWatch-16-self-rag.ipynbself_rag.pyGeneration - Self-RAG

Query Translation

RAG Fusion

Forget RAG, the Future is RAG-Fusion
RAG-Fusion: The Next Frontier of Search Technology
Reciprocal Rank Fusion outperforms Condorcet and individual Rank Learning Methods
Implementing Reciprocal Rank Fusion (RRF) in Python

Decomposition (Recursive)

Least-to-Most Prompting Enables Complex Reasoning in Large Language Models
Interleaving Retrieval with Chain-of-Thought Reasoning for Knowledge-Intensive Multi-Step Questions

Step-Back Prompting

Take a Step Back: Evoking Reasoning via Abstraction in Large Language Models

HyDE

Precise Zero-Shot Dense Retrieval without Relevance Labels

Routing

Semantic Router

Query Construction

Langchain Self Query With Dates

Indexing

Multi-Representation Indexing

Dense X Retrieval: What Retrieval Granularity Should We Use?

RAPTOR

RAPTOR: Recursive Abstractive Processing for Tre-Organized Retrieval Building long context RAG with RAPTOR from scratch

ColBERT

ColBERT: Efficient and Effective Passage Search via Contextualized Late Interaction over BERT
ColBERTv2: Effective and Efficient Retrieval via Lightweight Late Interaction
RAGatouille
[Paper review] ColBERT, ColBERTv2
Overcoming the Limits of RAG with ColBERT
ColBERT Inference in the Browser

Agentic RAG

Self-Reflective RAG with LangGraph

CRAG

Corrective Retrieval Augmented Generation

Self-RAG

Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection

Contributors

labdmitriy

14 commits

labdmitriy/llm-rag

Jupyter Notebook

312

14 commits

updated Apr 28, 2025

See the code

README

LLM RAG

Configuration

Environment

  • Copy .env.example file to .env
  • Fill in the required values

Installation

Using pip

  • Create and activate new Python virtual environment
  • pip install -r requirements.txt
  • pip install -e . (basic packages)
    or
    pip install -e .[ragatouille] (with ragatouille for ColBERT)

Using uv

  • uv sync --group dev (basic packages)
    or
    uv sync --group dev --extra ragatouille (with ragatouille for ColBERT)
  • uv pip install -e .

RAG From Scratch

Author of original series - Lance Martin

Original Sources

Video

YouTube Playlist

Code

Main Repository
Corrective RAG (CRAG)
Self-RAG

Table of Contents

PartNameVideoSlidesJupyter NotebookPython ScriptLangGraph Studio
1OverviewWatchView01-overview.ipynb--
2IndexingWatchView02-indexing.ipynb--
3RetrievalWatchView03-retrieval.ipynb--
4GenerationWatchView04-generation.ipynb--
5Query Translation - Multi-QueryWatchView05-multi-query.ipynbmulti_query.pyQuery Translation - Multi-Query
6Query Translation - RAG-FusionWatchView06-rag-fusion.ipynbrag_fusion.pyQuery Translation - RAG-Fusion
7Query Translation - DecompositionWatchView07-01-decomposition-recursive.ipynb
07-02-decomposition-parallel.ipynb
recursive.py
parallel.py
Query Translation - Decomposition (Recursive)
Query Translation - Decomposition (Parallel)
8Query Translation - Step-Back PromptingWatchView08-step-back.ipynbstep_back.pyQuery Translation - Step-Back Prompting
9Query Translation - HyDEWatchView09-hyde.ipynbhyde.pyQuery Translation - HyDE
10RoutingWatchView10-01-logical-routing.ipynblogical.py
semantic.py
Routing - Logical Routing
Routing - Semantic Routing
11Query ConstructionWatchView11-query-construction.ipynbself_query.pyQuery Construction - Self-Query
12Indexing - Multi-Representation IndexingWatchView12-01-multi-vector-summary.ipynb
12-02-multi-vector-chunks.ipynb
12-03-multi-vector-hypothetical-questions.ipynb
summary.py
chunks.py
hypothetical_questions.py
Indexing - Multi-Vector - Summary
Indexing - Multi-Vector - Chunks
Indexing - Multi-Vector - Hypothetical Questions
13Indexing - RAPTORWatchView13-raptor.ipynbraptor.py-
14Indexing - ColBERTWatchView14-colbert.ipynbcolbert_model.py-
15Retrieval - CRAGWatch-15-crag.ipynbcrag.pyRetrieval - CRAG
16Generation - Self-RAGWatch-16-self-rag.ipynbself_rag.pyGeneration - Self-RAG

Query Translation

RAG Fusion

Forget RAG, the Future is RAG-Fusion
RAG-Fusion: The Next Frontier of Search Technology
Reciprocal Rank Fusion outperforms Condorcet and individual Rank Learning Methods
Implementing Reciprocal Rank Fusion (RRF) in Python

Decomposition (Recursive)

Least-to-Most Prompting Enables Complex Reasoning in Large Language Models
Interleaving Retrieval with Chain-of-Thought Reasoning for Knowledge-Intensive Multi-Step Questions

Step-Back Prompting

Take a Step Back: Evoking Reasoning via Abstraction in Large Language Models

HyDE

Precise Zero-Shot Dense Retrieval without Relevance Labels

Routing

Semantic Router

Query Construction

Langchain Self Query With Dates

Indexing

Multi-Representation Indexing

Dense X Retrieval: What Retrieval Granularity Should We Use?

RAPTOR

RAPTOR: Recursive Abstractive Processing for Tre-Organized Retrieval Building long context RAG with RAPTOR from scratch

ColBERT

ColBERT: Efficient and Effective Passage Search via Contextualized Late Interaction over BERT
ColBERTv2: Effective and Efficient Retrieval via Lightweight Late Interaction
RAGatouille
[Paper review] ColBERT, ColBERTv2
Overcoming the Limits of RAG with ColBERT
ColBERT Inference in the Browser

Agentic RAG

Self-Reflective RAG with LangGraph

CRAG

Corrective Retrieval Augmented Generation

Self-RAG

Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection

Contributors

labdmitriy

14 commits

Languages

Jupyter Notebook

99.3%