RAG - retrieval-augmented generation
Presentation - Empowering GenAI with RAG
RAG is an AI framework for retrieving facts from an external knowledge base to ground large language models (LLMs) on the most accurate, up-to-date information and to give users insight into LLMs' generative process.
- RAG combines retrieval and generation processes to enhance the capabilities of LLMs
- In RAG, the model retrieves relevant information from a knowledge base or external sources
- This retrieved information is then used in conjunction with the model's internal knowledge to generate coherent and contextually relevant responses
- RAG enables LLMs to produce higher-quality and more context-aware outputs compared to traditional generation methods
- Essentially, RAG empowers LLMs to leverage external knowledge for improved performance in various natural language processing tasks
Why is Retrieval-Augmented Generation important
- You can think of the LLM as an over-enthusiastic new employee who refuses to stay informed with current events but will always answer every question with absolute confidence.
- Unfortunately, such an attitude can negatively impact user trust and is not something you want your chatbots to emulate!
- RAG is one approach to solving some of these challenges. It redirects the LLM to retrieve relevant information from authortative, pre-determined knowledge sources.
- Organizations have greater control over the generated text output, and users gain insights into how the ML generates the response.
Codes
- generative-ai/gemini/use-cases/retrieval-augmented-generation/multimodal_rag_langchain.ipynb at main · GoogleCloudPlatform/generative-ai · GitHub
- GitHub - Farzad-R/Advanced-QA-and-RAG-Series: This repository contains advanced LLM-based chatbots for Q&A using LLM agents, and Retrieval Augmented Generation (RAG) and with different databases. (VectorDB, GraphDB, SQLite, CSV, XLSX, etc.)
- example-app-langchain-rag/rag_chain.py at main · streamlit/example-app-langchain-rag · GitHub
- GitHub - langchain-ai/rag-from-scratch
- generative-ai/gemini/qa-ops/building_DIY_multimodal_qa_system_with_mRAG.ipynb at main · GoogleCloudPlatform/generative-ai · GitHub
- Building A RAG System with Gemma, MongoDB and Open Source Models - Hugging Face Open-Source AI Cookbook
Advanced
Advanced RAG Techniques
- Query Expansion (with multiple queries)
- GitHub - pdichone/advanced-rag-techniques
- Downsides
- Lots of results
- queries might not always be relevant or useful
- Results not always relevant and or useful
- Lots of results
Advanced RAG Techniques: Unlocking the Next Level | by Tarun Singh | Medium
RIG - Retrieval Interleaved Generation - DataGemma through RIG and RAG - by Bugra Akyildiz
Contextual Retrieval
Contextual Retrieval (introduced by Anthropic1) addresses a common issue in traditional Retrieval-Augmented Generation (RAG) systems: individual text chunks often lack enough context for accurate retrieval and understanding.
Contextual Retrieval enhances each chunk by adding specific, explanatory context before embedding or indexing it. This preserves the relationship between the chunk and its broader document, significantly improving the system's ability to retrieve and use the most relevant information.
GraphRAG
- Enhancing the Accuracy of RAG Applications With Knowledge Graphs | by Tomaz Bratanic | Neo4j Developer Blog | Medium
- Enhance Your RAG Applications with Knowledge Graph RAG | Build Intelligent Apps With SingleStore
- GraphRAG: Unlocking LLM discovery on narrative private data - Microsoft Research
- GraphRAG: New tool for complex data discovery now on GitHub - Microsoft Research
- Neo4j | 🦜️🔗 LangChain
- langchain cypher qa chain
Links
- What is RAG (Retrieval-Augmented Generation)?
- RAG Best Practices: Enhancing Large Language Models with Retrieval-Augmented Generation | by Juan C Olamendy | Medium
- A Gentle Introduction to Retrieval Augmented Generation (RAG)
- REALM: Integrating Retrieval into Language Representation Models
- Learn RAG Fundamentals and Advanced Techniques
- Using ChatGPT to Search Enterprise Data with Pamela Fox - YouTube
- What is retrieval-augmented generation? | IBM Research Blog
- What is Retrieval-Augmented Generation (RAG)? - YouTube
- Vector Search RAG Tutorial - Combine Your Data with LLMs with Advanced Search - YouTube
- RAG - Retrieval-Augmented Generation - Full Guide - Build a RAG System to Chat with Your Documents - YouTube
- GitHub - beaucarnes/vector-search-tutorial
- DSPy: Not Your Average Prompt Engineering
- langchain/cookbook/RAPTOR.ipynb at master · langchain-ai/langchain · GitHub
- Introduction to Retrieval Augmented Generation (RAG)
- A beginner's guide to building a Retrieval Augmented Generation (RAG) application from scratch
- Building RAG with Open-Source and Custom AI Models
- RAG - Retrieval Augmented Generation - YouTube
- How to Choose the Right Embedding Model for Your LLM Application | MongoDB
- Building Production RAG Over Complex Documents - YouTube
- Retrieval-Augmented Generation (RAG) Patterns and Best Practices - YouTube
- RAG (Retrieval Augmented Generation) - YouTube
- Exploring Hacker News by mapping and analyzing 40 million posts and comments for fun | Wilson Lin
- Mastering RAG Systems for LLMs
- Build a real-time RAG chatbot using Google Drive and Sharepoint