Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
158 views
4 pages
RAG Notes
Notes for RAG
Uploaded by
sanjaych333
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save RAG notes For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
158 views
4 pages
RAG Notes
Notes for RAG
Uploaded by
sanjaych333
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save RAG notes For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 4
Search
Fullscreen
Retrievalaugmented generation (RAG) combines large language models (LLMs) with retrieval 2-1 Explain the main parts of a RAG system and how they work. ‘Ans. A RAG (retrieval-augmented generation) system has two main components: the retriever and the generator. The retriever searches for and collects relevant information from extemal sources, like databases, documents, or websites. ‘The generator, usually an advanced language model, uses this information to create clear and accurate text. ‘The retriever makes sure the system gets the most up-to-date information, while the generator combines this with its own knowledge to produce better answers, Together, they provide more accurate responses than the generator could on its own. Q.2 What are the main benefits of using RAG instead of just relying on an LLM's internal knowledge? Ans. If you rely only on an LLM’s builtin knowledge, the system is limited to what it was trained ‘on, which could be outdated or lacking detail. roving ame say nae emt tm tr on, This approach also reduces “hallucinations"—errors where the model makes up facts—because the answers are based on real data. RAG is especially helpful for specific fields like law, medicine, or tech, where up-to-date, specialized knowledge is needed. Q.3 What types of external knowledge sources can RAG use? ‘Ans. RAG systems can gather information from both structured and unstructured external sources: © Structured sources include databases, APIs, or knowledge graphs, where data is organized and easy to search. ¢ Unstructured sources consist of large collections of text, such as documents, websites, oF archives, where the information needs to be processed using natural language understanding.This flexibility allows RAG systems to be tailored to different fields, such as legal or medical use, by pulling from case law databases, research journals, or clinical trial data. 2.4 Does prompt engineering matter in RAG? ‘Ans. Prompt engineering helps language models provide high-quality responses using the retrieved information. How you design a prompt can affect the relevance and clarity of the ‘output. '* Specific system prompt templates help guide the model. For example, instead of having a simple out-of-the-box system prompt like “Answer the question,” you might have, “Answer the question based only on the context provided.” This gives the model explicit instructions to only use the context provided to answer the question, which can reduce the probability of hallucinations. ‘¢ Few-shot prompting involves giving the model a few example responses before asking it to generate its own, so it knows the type of response you're looking for. ¢ Chain-of-thought prompting helps break down complex questions by encouraging the ‘model to explain its reasoning step-by-step before answering. Q.5 How does the retriever work in a RAG system? What are common retrieval methods? ‘Ans. In a RAG system, the retriever gathers relevant information from extemal sources for the generator to use. There are different ways to retrieve information. ‘One method is sparse retrieval, which matches keywords (e.g., TF-IDF or BM25). This is simple but may not capture the deeper meaning behind the words. Another approach is dense retrieval. which uses neural embeddings to understand the meaning of documents and queries. Methods like BERT or Dense Passage Retrieval (DPR) represent documents as vectors in a shared space, making retrieval more accurate. ‘The choice between these methods can greatly affect how well the RAG system works, (Q.6 What are the challenges of combining retrieved Information with LLM generation? ‘Ans, Combining retrieved information with an LLM’s generation presents some challenges. For instance, the retrieved data must be highly relevant to the query as irrelevant data can confuse the model and reduce the quality of the response. Additionally, if the retrieved information conflicts with the model's internal knowledge, it can create confusing or inaccurate answers. As such, resolving these conflicts without confusing the user is crucial.Fal th syle an format of reeved data may not lays match the mod's usual wring ot lormating, making i ard forthe modelo agate he nlomation smh 27 Whats the role ofa vector database in RAG? [Ans @ RAG systom,a vector database helps manage and store dense embeddings of ox ‘These embedcngs are numancal representations that capture te meaning of words and traces, created by models ke BERT or Open nen a query is made, is ambeddng is compared othe stored ones inthe database o fad ‘amar document. Th makes faster and more accurate to reteve the ight infrmaton. The [process heb the system quekly locate and pul up the most relevant infomation, improving ‘bom he speed and accuracy of retioval {8 what are some common ways to evaluate RAG systems? [Ans To evalusle @ RAG system, you need 10 look at both the retieval and generation Metis tke precaion (now many reeved documents ere rlevet) and recall how any of he toll relevant documents wee found) can be vaed ere. 1+ For the generator, matics Ike BLEU and ROUGE can be used Yo compare the erected isto huran-wrten examples o 9098 quay. For dowirean aah ike ueston-answerng, matics ike Ft score, pecislon, ar recs ‘so be used to evaluate the overat RAG sytem, 12.9 How do you handle ambiguous or incompleto quer telovant results? Ina RAG system to ensure [Ana. Handing ambiguous or incomplete queries in a RAG system roquies strategies to ensure ‘hat reevant an accurate nfermaton s etveved despite the lack of Gary 9 he user's mp (One approach i 1 iglament query raoament technique, where th system automaticaly ‘suggests ications or aformutates the ambiguous gry nto a more prise ono Dasa’ O0 Known pattems or previous ilerctona. Tha can svelve taking folowup questons of ‘roning te ser wih multe optns 6 narrow down thew nent Another method is 10 rtieve 4 diverse set of documents that cover mute possible Interpretations of he quer. By retiving a range of ess te system ensures that even fhe ‘ers vague, some relevant nlomatin i kayo be coed,Intermediate RAG Interview Questions 2.10 How do you choose the right retriever for a RAG application? ‘Ans. Choosing the right retriever depends on the type of data you're working with, the nature of the queries, and how much computing power you have. For complex queries that need a deep understanding of the meaning behind words, dense retrieval methods like BERT or DPR are better. These methods capture context and are ideal for tasks like customer support or research, where understanding the underlying meanings matter. if the task is simpler and revolves around keyword matching, or if you have limited computational resources, sparse retrieval methods such as BM25 or TF-IDF might be more suitable. These methods are quicker and easier to set up but might not find documents that don't match exact keywords. The main trade-off between dense and sparse retrieval methods is accuracy versus ‘computational cost. Sometimes, combining both approaches in a hybrid retrieval system can help balance accuracy with computational efficiency. This way, you get the benefits of both dense and sparse methods depending on your needs. Q.11 Describe what a hybrid search Is. ‘Ans. Hybrid search combines the strengths of both dense and sparse retrieval methods. For instance, you can start with a sparse method like BM25 to quickly find documents based on keywords. Then, a dense method like BERT re-ranks those documents by understanding their context and meaning. This gives you the speed of sparse search with the accuracy of dense methods, which is great for complex queries and large datasets. Q.12 Do you need a vector database to implement RAG? If not, what are the alternatives? Ans. A vector database is great for managing dense embeddings, but it's not always necessary. Alternatives include: © Traditional databases: If you're using sparse methods or structured data, regular relational or NoSQL databases can be enough. They work well for keyword searches. Databases like MongoDB or Elasticsearch are good for handling unstructured data and full-text searches, but they lack deep semantic search. © Inverted indices: These map keywords to documents for fast searches, but they don't capture the meaning behind the words.
You might also like
Developing Retrieval Augmented Generation (RAG) Based LLM Systems From Pdfs - An Expert Report
PDF
No ratings yet
Developing Retrieval Augmented Generation (RAG) Based LLM Systems From Pdfs - An Expert Report
36 pages
Agentforce Partner Guidebook SI Partners
PDF
No ratings yet
Agentforce Partner Guidebook SI Partners
19 pages
salesforce_spring25_release_notes
PDF
No ratings yet
salesforce_spring25_release_notes
685 pages
Generative AI
PDF
No ratings yet
Generative AI
14 pages
AI Privacy Risks and Mitigations in Large Language Models
PDF
No ratings yet
AI Privacy Risks and Mitigations in Large Language Models
102 pages
Advanced RAG Techniques - What They Are & How To Use Them
PDF
No ratings yet
Advanced RAG Techniques - What They Are & How To Use Them
16 pages
Slide Deck Data Analysis With Databricks
PDF
No ratings yet
Slide Deck Data Analysis With Databricks
115 pages
Salesforce-AI-Specialist-2
PDF
No ratings yet
Salesforce-AI-Specialist-2
61 pages
Exploring GPT 4 and LangChain - PDF 2
PDF
No ratings yet
Exploring GPT 4 and LangChain - PDF 2
7 pages
Generative AI
PDF
No ratings yet
Generative AI
25 pages
LangChain & RAG
PDF
No ratings yet
LangChain & RAG
62 pages
Neo4j - GraphRAG - 2024
PDF
100% (1)
Neo4j - GraphRAG - 2024
23 pages
Salesforce Developer (100 Questions)
PDF
No ratings yet
Salesforce Developer (100 Questions)
19 pages
Git and GitHub For Beginners
PDF
No ratings yet
Git and GitHub For Beginners
19 pages
1. Application Of Large Language
PDF
No ratings yet
1. Application Of Large Language
75 pages
Machine Learning GenAI Roadma
PDF
No ratings yet
Machine Learning GenAI Roadma
36 pages
Bias-Variance Tradeoff Presentation
PDF
No ratings yet
Bias-Variance Tradeoff Presentation
11 pages
Hugging Face
PDF
100% (1)
Hugging Face
11 pages
Building a Smarter RAG_ Implementing Graph-based RAG with Neo4j _ by Vinay Jain _ Nov, 2024 _ Medium
PDF
No ratings yet
Building a Smarter RAG_ Implementing Graph-based RAG with Neo4j _ by Vinay Jain _ Nov, 2024 _ Medium
13 pages
Gen Ai Solutions
PDF
No ratings yet
Gen Ai Solutions
14 pages
Building A Talking AI With LLAMA + RAG - by Stefanoz - Oct, 2024 - Medium
PDF
No ratings yet
Building A Talking AI With LLAMA + RAG - by Stefanoz - Oct, 2024 - Medium
23 pages
Sinan Ozdemir - Quick Start Guide to Large Language Models, Second Edition-Addison-Wesley (2024)
PDF
No ratings yet
Sinan Ozdemir - Quick Start Guide to Large Language Models, Second Edition-Addison-Wesley (2024)
279 pages
Knowledge Graphs v Vector Databases and when not to use them!
PDF
No ratings yet
Knowledge Graphs v Vector Databases and when not to use them!
3 pages
1GitHub - Modelcontextprotocol_python-sdk_ the Official Python SDK for Model Context Protocol Servers and Clients
PDF
No ratings yet
1GitHub - Modelcontextprotocol_python-sdk_ the Official Python SDK for Model Context Protocol Servers and Clients
9 pages
Generative AI
PDF
No ratings yet
Generative AI
11 pages
Interview Questions on RAG
PDF
No ratings yet
Interview Questions on RAG
6 pages
WEEK - 5 SOLID Principles
PDF
No ratings yet
WEEK - 5 SOLID Principles
23 pages
10 Salesforce Einstein Features
PDF
No ratings yet
10 Salesforce Einstein Features
13 pages
02 - Hands-On - Prompt Engineering
PDF
No ratings yet
02 - Hands-On - Prompt Engineering
58 pages
Agent Based Models Are Here and Disrupting GPT RAG 1717410571
PDF
No ratings yet
Agent Based Models Are Here and Disrupting GPT RAG 1717410571
12 pages
Deeplearning - Ai Deeplearning - Ai
PDF
No ratings yet
Deeplearning - Ai Deeplearning - Ai
115 pages
AI Institutes
PDF
No ratings yet
AI Institutes
98 pages
10 Evani Generative AI Champion
PDF
No ratings yet
10 Evani Generative AI Champion
39 pages
LLM Paper
PDF
No ratings yet
LLM Paper
26 pages
ML Questions
PDF
No ratings yet
ML Questions
56 pages
LangChain_Academy_-_Introduction_to_LangGraph_-_Motivation
PDF
No ratings yet
LangChain_Academy_-_Introduction_to_LangGraph_-_Motivation
17 pages
MongoDB Sales Presentation
PDF
No ratings yet
MongoDB Sales Presentation
35 pages
Generalist Fellowship Brochure
PDF
No ratings yet
Generalist Fellowship Brochure
13 pages
SFDC Lightning Training Basic 01
PDF
No ratings yet
SFDC Lightning Training Basic 01
79 pages
GenAI POC - Training
PDF
100% (1)
GenAI POC - Training
43 pages
10 Most Asked LLM Interview Questions
PDF
No ratings yet
10 Most Asked LLM Interview Questions
12 pages
Introduction - Hugging Face NLP Course
PDF
No ratings yet
Introduction - Hugging Face NLP Course
8 pages
Visualisation For Data Science Predict Overview 3267
PDF
No ratings yet
Visualisation For Data Science Predict Overview 3267
15 pages
Building a Streamlit Chatbot with LangChain and Llama 3.1_ Exploring LLMs — 3 _ by Abou Zuhayr _ Sep, 2024 _ GoPenAI
PDF
No ratings yet
Building a Streamlit Chatbot with LangChain and Llama 3.1_ Exploring LLMs — 3 _ by Abou Zuhayr _ Sep, 2024 _ GoPenAI
15 pages
Multi-Agent Agentic RAG Systems - Prashant Sahu
PDF
No ratings yet
Multi-Agent Agentic RAG Systems - Prashant Sahu
10 pages
Hands-On Lab With LLMs and Gen AI Within IDC
PDF
No ratings yet
Hands-On Lab With LLMs and Gen AI Within IDC
57 pages
RAG - The Future of LLMs - LinkedIn
PDF
No ratings yet
RAG - The Future of LLMs - LinkedIn
7 pages
Hugging Face Case Study 112023
PDF
No ratings yet
Hugging Face Case Study 112023
2 pages
De Mod 5 Deploy Workloads With Databricks Workflows
PDF
No ratings yet
De Mod 5 Deploy Workloads With Databricks Workflows
19 pages
Hemanshu Kumar Saraf - Resume New
PDF
No ratings yet
Hemanshu Kumar Saraf - Resume New
1 page
Diploma in AI and ML Brochure
PDF
No ratings yet
Diploma in AI and ML Brochure
14 pages
2023 Intro To Generative Ai
PDF
No ratings yet
2023 Intro To Generative Ai
15 pages
Donald Ngandeu 1
PDF
No ratings yet
Donald Ngandeu 1
6 pages
What Is Natural Language Processing?
PDF
No ratings yet
What Is Natural Language Processing?
5 pages
Pytorch: Tensors and Datasets
PDF
No ratings yet
Pytorch: Tensors and Datasets
9 pages
Seminar 7 Introduction To Databases
PDF
No ratings yet
Seminar 7 Introduction To Databases
41 pages
Ai Notes
PDF
No ratings yet
Ai Notes
2 pages
Excel Adv Formulae & Functions
PDF
No ratings yet
Excel Adv Formulae & Functions
26 pages