Overview

rag-pipeline Based on my expertise and experience with Retrieval Augmented Generation (RAG) from past few years, I have created a GitHub repo with different Retrieval-augmented generation (RAG) implementations to share my learnings. The repo consists of the following RAG techniques:
RAG TechniqueSimple DefinitionWhen to Use
Simple RAGRetrieves relevant documents based on the query and uses them to generate an answerBasic question-answering tasks where context is needed
Simple RAG with MemoryExtends Simple RAG by maintaining context from previous interactionsConversational AI where continuity between queries is important
Branched RAGPerforms multiple retrieval steps, refining the search based on intermediate resultsComplex queries requiring multi-step reasoning or information synthesis
HyDE (Hypothetical Document Embedding)Generates a hypothetical ideal document before retrieval to improve search relevanceWhen dealing with queries that might not have exact matches in the knowledge base
Adaptive RAGDynamically adjusts retrieval and generation strategies based on the query type or difficultyVaried query types or when dealing with a diverse knowledge base
Corrective RAG (CRAG)Iteratively refines generated responses by fact-checking against retrieved informationHigh-stakes scenarios requiring increased accuracy and fact verification
Self-RAGThe model critiques and improves its own responses using self-reflection and retrievalTasks requiring high accuracy and when there’s time for multiple refinement steps
Agentic RAGCombines RAG with agentic behavior, allowing for more complex, multi-step problem-solvingComplex tasks requiring planning, decision-making, and external tool use

Skills picked up

  • Embeddings
  • Sentence Transformer
  • Vector stores
  • Branched RAG