Introduction to Retrieval
Key Takeaways
Introduction to Retrieval in RAG systems, covering the standard retrieval workflow and key components such as document loaders, embedding models, and vector databases, using tools like LangChain, OpenAI, and Hugging Face
Full Transcript
Welcome back. In this video, we will go through an introduction to building retrieval systems, which will be the key theme of this entire module. The key topics we'll be covering include understanding a standard retrieval system workflow, document loaders, document splitters and chunkers, embedding models, vector databases, and building retrievers on top of vector databases. Let's get started. So this is a standard retrieval workflow which is typically the first step of building a retrieval augmented generation a rag system. Here we will be focusing on the retrieval aspect of the rag system. Now in a typical retrieval workflow you typically connect to a certain data source that could include the internet, a database. You source the data which could be PDFs, text documents, JSON documents and so on. You use a relevant data loader to load the data from these data sources and convert it into relevant text data. Now once you have these really large text documents or could be small documents depending on your source, we transform them into small chunks or paragraphs and once we transform by breaking them into smaller chunks, we will typically pass them through an embedding model to convert it into embeddings. convert each document chunk into relevant embeddings and then we would store these small chunks and embeddings into a vector database and then build a retrieval strategy on top of this vector database so that we can retrieve similar documents or relevant documents based on an input question by the user and this entire workflow consists of these key components which is what we will be covering in detail throughout this module. So let's understand what are document loaders. Document loaders are typically used to import or load up data from various sources by langchain as document objects. Now typically that means if you have PDFs, word documents, PowerPoint presentations, the idea is to use document loaders to extract typically the text content from these documents and load them up as a line chain document object. A document object typically includes the text content along with relevant metadata which could be like the name of the file from which we got the data, a page number, the author and so on. Now, Langchain is integrated with over 100 document loader tools and libraries which includes third party tools and libraries to load documents of various formats. Now, what do we do after we extract and load up the documents as text? The next step is typically we might need to transform them for optimal use with large language models. So a common transformation step includes splitting a large document into smaller segments or chunks as you see here so that we can fit the large language models context window because in many cases let's say if your LLM's context window is maybe 4,000 tokens or 32,000 tokens and your documents are larger than that context window size then you will easily end up getting a token limit exceeded error. So the idea is to chunk the documents into smaller, more manageable chunks so that you can retrieve the most relevant chunks based on your question, your task and so on. Langen provides several built-in document transformers to typically facilitate the splitting and chunking so that you can split these larger documents into smaller chunks. The next step after breaking your documents into more manageable chunks is to convert these chunks into some kind of a numeric representation because at the end of the day machines understand only numbers and we can use something like a document vector similarity to find out how close are certain documents, how relevant is a document to a question and so on. So typically what we do is we use embedding models to create a vector representation for any document which is known as an embedding because the meaning of the document chunk is embedded into a fixedsized vector of numbers. Typically these are floatingoint numbers as you can see here. Now in lang chain there is a base embeddings class which provides two methods. One is for embedding documents and one is for embedding a question or a query and lang has integrations with all popular embedding model providers which includes open AI as well as open source or open models from hugging face. So the key idea of using embedding models is to transform these document chunks the text into an embedding vector which can then be used to look up and see okay which documents are similar to the embedding of a given question by the user. What do we do once we have the embeddings? So once we have the embeddings the idea is to store these document chunks and embeddings into a vector database so that we can do very fast querying and lookup in the future. So that's what a vector database tries to do. It manages document storage embeddings and helps in performing semantic vector search. It supports common operations including creating, updating, deleting and querying. And lang has integrations with all popular vector database providers like Chroma, Pine Cone, VV8, Milvas and many more. So the key functionality of a vector database is to store your document chunks and its corresponding embeddings so that in the future whenever you're asking questions it can retrieve the most relevant documents to your given question based on embedding similarity. Next step is typically retrievers which is where you build a retrieval strategy on top of your vector database. So the idea is a retriever is basically an interface which accepts a string query as an input and it returns a list of relevant documents as output which are closest to the question in terms of embedding similarity. So what happens as you can see in this workflow is you will have uh some kind of a question. The question will go into the vector database. The vector database will use its embedding model to transform the question into an embedding vector. It will then look up and see which embedding vectors are most close to that questions embedding and then it will return the corresponding document chunks whose embeddings were closest to the questions embedding back to the user. So the idea is to query the vector store and retrieve the most similar documents based on your input question. Now retrievers are typically created from vector databases or other search APIs. Langchain enables us to use retrievers with a variety of retrieval strategies like cosign similarity, maximal marginal relevance, multi-query retrieval and other kind of strategies which includes using things like reancher models and so on. We will see all of this in the relevant units in the future videos. Thank you. And that's it for this video.
Original Description
Description
How do you turn a massive pile of documents into a searchable AI brain? In this video, we move into the core technical module of our "RAG System Essentials" course to explore the Retrieval Pipeline.
Building a RAG system starts long before the LLM generates an answer. It begins with sourcing, loading, and transforming your data so an AI can understand it. We break down the standard retrieval workflow and the five key components you need to master.
What we cover in this lesson:
The Standard Retrieval Workflow: The end-to-end journey from a data source to a retrieved document.
Document Loaders: How LangChain connects to 100+ sources (PDFs, Word, JSON, Web) to extract text.
Document Splitters & Chunking: Why we break data into smaller segments to respect LLM context windows and prevent "Token Limit" errors.
Embedding Models: The math behind the magic—converting text into numeric vectors using OpenAI or Hugging Face.
Vector Databases: An overview of high-speed storage solutions like Chroma, Pinecone, and Milvus.
The Retriever Interface: Creating a strategy to fetch the most relevant data using Cosine Similarity or MMR (Maximal Marginal Relevance).
By the end of this video, you’ll understand the "indexing" side of RAG and be ready to start implementing these components in Python.
🛠️ Featured Tools:
Orchestration: LangChain
Embeddings: OpenAI & Hugging Face
Vector DBs: Chroma, Pinecone, Milvus, Weaviate
Next Lesson: We will dive even deeper into specific chunking strategies to optimize your retrieval accuracy!
#rag #LangChain #VectorDatabase #AI #GenerativeAI #MachineLearning #Embeddings #Python #SemanticSearch #LLM
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Analytics Vidhya · Analytics Vidhya · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
The DataHour: Data Science in Retail
Analytics Vidhya
The DataHour: Anomaly detection using NLP and Predictive Modeling
Analytics Vidhya
The DataHour: Energy Data Science Project from Scratch
Analytics Vidhya
The DataHour: Explainable AI Need and Implementation
Analytics Vidhya
The DataHour: Google Cloud AI/ML
Analytics Vidhya
Prediction to Production in Machine Learning #machinelearning #prediction
Analytics Vidhya
Practical Applications of Data science in Ecommerce
Analytics Vidhya
How to tackle Overfitting?#machinelearning #overfitting
Analytics Vidhya
Building Data Pipelines on GCP #googlecloud #datapipelines #data
Analytics Vidhya
Hands-on with A/B Testing #abtesting #datascience
Analytics Vidhya
Efficient Implementations of Transformers #transformers #cnn #machinelearning
Analytics Vidhya
Modern Deep Learning Architecture #deeplearning #architecture #deeplearningtutorial
Analytics Vidhya
Key steps for Designing Artificial Neural Network (ANN) for Image classification #machinelearning
Analytics Vidhya
5 things you should know about Azure SQL #azure #sql #datahour #datascience
Analytics Vidhya
AI & ML in the Automotive Industry #machinelearning #ai
Analytics Vidhya
Building Machine Learning Models in BigQuery
Analytics Vidhya
NLP aspects in Telecommunication Industry
Analytics Vidhya
Practical Time Series Analysis
Analytics Vidhya
Fundamentals of Quantum Computing
Analytics Vidhya
A DAY IN THE LIFE of a Data Scientist (From waking up to working on algorithms)
Analytics Vidhya
Classification Machine Learning Model from Scratch
Analytics Vidhya
Knowledge Graph Solutions using Neo4j
Analytics Vidhya
Model Guesstimation (MLOps)
Analytics Vidhya
ETL Pipelines in Google Cloud Platform
Analytics Vidhya
Key steps for Designing Convolutional Neural Network(CNN) for Image Classification
Analytics Vidhya
Getting Started with AWS EC2 #amazon #aws
Analytics Vidhya
How to Use Azure NLP and Graph Databases for Intelligent Knowledge Mining
Analytics Vidhya
Certified AI & ML BlackBelt Plus Program #shorts
Analytics Vidhya
Visualizing Data using Python #machinelearning #visualization #python
Analytics Vidhya
DCNN for Machine RUL Prediction using Time-series Data #timeseries #machinelearning #datascience
Analytics Vidhya
M in ML stands for Math & Magic
Analytics Vidhya
An Unsupervised ML approach using Clustering
Analytics Vidhya
Customizing Large Language Models GPT3 for Real-life Use Cases #gpt3 #datascience
Analytics Vidhya
Model Parameters vs Hyperparameters - Techniques in ML Engineering #machinelearning
Analytics Vidhya
Practical MLOps #mlops #datascience
Analytics Vidhya
Data Engineering with Databricks #dataengineering #databricks
Analytics Vidhya
Multi-Objective Optimisation
Analytics Vidhya
When Airflow Meets Kubernetes
Analytics Vidhya
AI in Banking
Analytics Vidhya
Learn Convolutional Neural Network for Image Recognition
Analytics Vidhya
Extracting Value from Data
Analytics Vidhya
How to measure Marketing Channel Effectiveness
Analytics Vidhya
Transforming Lives | Data Science Immersive Bootcamp
Analytics Vidhya
Stock Market Analysis - AI driven approach
Analytics Vidhya
Become a Data Engineering Professional in 2022 | Future Trends + Skills Required
Analytics Vidhya
Ensemble Techniques in Machine Learning #machinelearning #ensemble #datascience
Analytics Vidhya
The Power of Visualization | Tableau Full Course | Analytics Vidhya
Analytics Vidhya
Demand for Data Engineers is on the Rise | Data Engineer | Analytics Vidhya
Analytics Vidhya
Data Visualization in Data Science | DataHour | Analytics Vidhya
Analytics Vidhya
Role of Optimization in Machine Learning & Deep Learning | DataHour | Analytics Vidhya
Analytics Vidhya
Solving any Machine Learning Problem | Approach and Steps Involved
Analytics Vidhya
Topic Modeling Explained with Implementation | Using LDA in Python | DataHour by Arpendu Ganguly
Analytics Vidhya
Data Engineering in E-Commerce | The Best Case Study
Analytics Vidhya
Introduction to Classification using Azure Machine Learning | DataHour | Analytics Vidhya
Analytics Vidhya
Introduction to Federated Learning | DataHour | Analytics Vidhya
Analytics Vidhya
Diffusion Models for Generative Arts | DataHour | Analytics Vidhya
Analytics Vidhya
Master Google Analytics in 1 Hour | DataHour | Analytics Vidhya
Analytics Vidhya
Learn Hypothesis Testing | DataHour | Analytics Vidhya
Analytics Vidhya
A Practical Approach to Kaggle Competition | DataHour | Analytics Vidhya
Analytics Vidhya
Making AI work for Business | DataHour | Analytics Vidhya
Analytics Vidhya
More on: RAG Basics
View skill →Related Reads
📰
📰
📰
📰
Optimizing RAG at Scale: Chunking, Retrieval, and the Bayesian Search That Cut Latency 40%
Dev.to · Imus
Add a Freshness Gate Before Your RAG Model Call
Dev.to AI
Optimizing RAG at Scale: Chunking, Retrieval, and the Bayesian Search That Cut Latency 40%
Dev.to AI
Optimizing RAG at Scale: Chunking, Retrieval, and the Bayesian Search That Cut Latency 40%
Dev.to AI
🎓
Tutor Explanation
DeepCamp AI