SlideShare a Scribd company logo
1 of 33
Unleashing the power of
rag retrieval augmented
generation with cosmos
db and LLM’s
Usama Wahab Khan
MVP
, MCT, AI Champ award winner
CTO @ Evolution Technologies
#TechdayPakistan | @TechDayP | TechDayPakistan.com
Usama Wahab Khan
 Father, data Scientist, Developer/Nerd, Traveler
Twitter : @usamawahabkhan
LinkedIn : Usamawahabkhan
Introduction to AI
Introduction to Generative AI
Image or Video generation Code generation
Generative AI refers to a type of artificial intelligence that has the ability
to generate content that is, in many cases, indistinguishable from content
created by humans. This AI can produce text, images, audio, or even
video, often in response to a given input or prompt.
Generative AI operates by learning patterns and structures from large
datasets and then using that knowledge to produce new content that fits
within those learned patterns. It's a type of machine learning where the AI
model learns to understand and mimic the characteristics of the data it
has been trained on.
Generative AI
capabilities
Limitless generation with a
few lines of input
Essay
outlines
Summarizi
ng text
Virtual
Assistants
Extracting
insights
Classifying
text
Language
Translation
Poem
creation
Code
refactoring
Writing
assistance
Code
generation
Answering
questions
Creative
Ideation
Subject
Research Dialog
agents
Comments
from code
Semantic
search
Image
Generation
What are
large
language
models?
Large Language Models (i.e., “language calculators”)
Large: More data than can be manually labeled
Language: Match context and words (e.g., word prediction, creative writing)
Model: Semi-supervised learning
A large language model (LLM) is a type of AI that can
process and produce natural language text. It learns from
a massive amount of data gathered from sources like
books, articles, webpages, and images to discover
patterns and rules of language.
Foundation Models
Data
Text
Images
Speech
Structured Data
3d Signals
Tasks
Question and
Answering
Sentiment Analysis
Information
Extraction
Image Captioning
Object Recognition
Training Adaptation
Foundation
Model
Instruction Follow
Transformer Model
Transformers Models
Model History and Size of LLM
How to use LLM
Understanding
prompts,
completions, and
tokens
Like a person writing an essay, an AI
model takes a prompt and continues
writing based on the text in the prompt.
The new text that the model outputs is
called the completion. An example task
might be to write a Python program to
add two numbers. If you write out the
task as a Python comment like so:
Prompt engineering
What is OpenAI?
OpenAI is a private research laboratory that aims to
develop and direct artificial intelligence (AI) in ways that
benefit humanity as a whole. The company was founded
by Elon Musk, Sam Altman and others in 2015 and is
headquartered in San Francisco.
Introduction to OpenAI
Hallucinations
While the LLM’s like ChatGPT model has proven to have extensive knowledge, it
can still be wrong at times. It’s important to understand this limitation and apply
mitigations for your scenario.
Fine-Tuning is Expensive
Enhanced Contextual Relevance
No Realtime Knowledge
LLM’s
Fine Tuning
 This is the process of taking a
pre-trained LLM such as Llama
OR OpenAI’s GPT Models and
further training it on a smaller,
specific dataset to adapt it for a
particular task or to improve its
performance. By finetuning, we
are adjusting the model’s
weights based on our data,
making it more tailored to our
application’s unique needs.
#TechdayPakistan | @TechDayP | TechDayPakistan.com
3/4/2024
19
What is RAG?
RAG, or retrieval augmented generation, is a method
introduced by Meta AI researchers that combines an
information retrieval component with a text generator
model to address knowledge-intensive tasks
Large language models (LLMs) like ChatGPT are trained
on public internet data which was available at the point in
time when they were trained. They can answer questions
related to the data they were trained on. This public data
might not be sufficient to meet all your needs. You might
want questions answered based on your private data. Or,
the public data might simply have gotten out of date. The
solution to this problem is Retrieval Augmented
Generation (RAG), a pattern used in AI which uses an
LLM to generate answers with your own data
User Question
LLM Workflow
Query My Data
Add Results to Prompt
Query Model
Send Results
Why use RAG?
• Fine-tuning is suitable for continuous domain adaptation, enabling significant improvements in
model quality but often incurring higher costs. Conversely, RAG offers an alternative approach,
allowing the use of the same model as a reasoning engine over new data provided in a prompt.
This technique enables in-context learning without the need for expensive fine-tuning,
empowering businesses to use LLMs more efficiently.
• RAG allows businesses to achieve customized solutions while maintaining data relevance and
optimizing costs. By adopting RAG, companies can use the reasoning capabilities of LLMs, utilizing
their existing models to process and generate responses based on new data. RAG facilitates
periodic data updates without the need for fine-tuning, thereby streamlining the integration of
LLMs into businesses.
1. Provide supplemental data as a directive or a prompt to the LLM
2. Adds a fact checking component on your existing models
3. Train your model on up-to-date data without incurring the extra time and costs associated with
fine-tuning
4. Train on your business specific data
3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com
22
RAG
Process
RAG Process
3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com 24
Anatomy of a RAG app
App UX Orchestrator
Retriever over Knowledge Base
Query 
Knowledge
Prompt + Knowledge 
Response
Large Language Model
Build your own experience
UX, orchestration, calls to retriever and LLM
e.g., Copilots, in-app chat
Extend other app experiences
Plugins for retrieval, symbolic math,
app integration, etc.
e.g., plugins for OpenAI ChatGPT
RAG Components
 Data-Sources ( unstructured and structure or Cloud
storage)
 Indexing pipeline
– Data Cleaning or OCR
– Data Chunking
– Indexing
 Embedding Model
 Vector Database
 Vector Index
 Vector retrieval query
 Application AI orchestrator
 LLM to Response
3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com 26
Embedding Model
• “Embeddings are vectors or arrays of numbers
that represent the meaning and context of the
tokens processed by the model. They are used to
encode and decode input and output texts, and
can vary in size and dimension. Embeddings can
help the model understand the relationships
between tokens, and generate relevant and
coherent texts.”
• LLM embedding models?
• text-embedding-ada-002 by Azure Open AI
• Hugging face Leadership board for embedding
models
https://huggingface.co/spaces/mteb/leaderboard
3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com 27
3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com
28
Vector databases or store
 Vector databases or stores: are used in numerous domains and
situations across analytical and generative AI, including
natural language processing, video and image recognition,
recommendation systems, search, etc. Most popular options
for RAG. Vector database is used to store Text embeddings.
The outcomes of Embedding models into the quarriable
database.
3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com
29
Vector databases or store
 Poplar Vector Database / Stores
 There are several vector databases and stores available for AI-native embedding. Here
are some examples:
 Pinecone: A cloud-native vector database that offers a seamless API and hassle-free
infrastructure. It is now available on Azure Marketplace.
 Chroma DB: An open-source vector database tailored for AI-native embedding.
 Faiss: An open-source library developed by Facebook AI Research for fast, dense vector
similarity search and grouping.
 Azure Cosmos DB: A globally distributed, multi-model database service that supports
document, key-value, graph, and column-family data models. It also supports vector
database extensions. Use the native vector search feature in Azure Cosmos DB for
MongoDB vCore, which offers an efficient way to store, index, and search high-
dimensional vector data directly alongside other application data. Use the native vector
search feature in Azure Cosmos DB for PostgreSQL, which offers an efficient way to
store, index, and search high-dimensional vector data directly alongside other
application data
3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com
30
Azure Cosmos DB Vector store Options
 Azure Cosmos DB for Mongo DB vCore Store your application
data and vector embeddings together in a single MongoDB-
compatible service featuring native support for vector search.
 Azure Cosmos DB for PostgreSQL Store your data and vectors
together in a scalable PostgreSQL offering with native support
for vector search.
 Azure Cosmos DB for NoSQL with Azure AI Search Augment
your Azure Cosmos DB data with semantic and vector search
capabilities of Azure AI Search.
3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com
31
Speaker Slides
#TechdayPakistan | @TechDayP | TechDayPakistan.com
Optional Slides
The slides that follow this slide are optional
#TechdayPakistan | @TechDayP | TechDayPakistan.com
Note: This slide is just for Informational Purposes

More Related Content

Similar to TechDayPakistan-Slides RAG with Cosmos DB.pptx

TechEvent 2019: Artificial Intelligence in Dev & Ops; Martin Luckow - Trivadis
TechEvent 2019: Artificial Intelligence in Dev & Ops; Martin Luckow - TrivadisTechEvent 2019: Artificial Intelligence in Dev & Ops; Martin Luckow - Trivadis
TechEvent 2019: Artificial Intelligence in Dev & Ops; Martin Luckow - TrivadisTrivadis
 
Insider's introduction to microsoft azure machine learning: 201411 Seattle Bu...
Insider's introduction to microsoft azure machine learning: 201411 Seattle Bu...Insider's introduction to microsoft azure machine learning: 201411 Seattle Bu...
Insider's introduction to microsoft azure machine learning: 201411 Seattle Bu...Mark Tabladillo
 
Microsoft Build 2020: Data Science Recap
Microsoft Build 2020: Data Science RecapMicrosoft Build 2020: Data Science Recap
Microsoft Build 2020: Data Science RecapMark Tabladillo
 
Designing a Generative AI QnA solution with Proprietary Enterprise Business K...
Designing a Generative AI QnA solution with Proprietary Enterprise Business K...Designing a Generative AI QnA solution with Proprietary Enterprise Business K...
Designing a Generative AI QnA solution with Proprietary Enterprise Business K...IRJET Journal
 
Global AI Bootcamp Madrid - Azure Databricks
Global AI Bootcamp Madrid - Azure DatabricksGlobal AI Bootcamp Madrid - Azure Databricks
Global AI Bootcamp Madrid - Azure DatabricksAlberto Diaz Martin
 
What are the Unique Challenges and Opportunities in Systems for ML?
What are the Unique Challenges and Opportunities in Systems for ML?What are the Unique Challenges and Opportunities in Systems for ML?
What are the Unique Challenges and Opportunities in Systems for ML?Matei Zaharia
 
Cloud based Machine Learning Platforms, a review - Sagar Khashu
Cloud based Machine Learning Platforms, a review - Sagar KhashuCloud based Machine Learning Platforms, a review - Sagar Khashu
Cloud based Machine Learning Platforms, a review - Sagar KhashuSagar Khashu
 
Build, Train, and Deploy ML Models at Scale
Build, Train, and Deploy ML Models at ScaleBuild, Train, and Deploy ML Models at Scale
Build, Train, and Deploy ML Models at ScaleAmazon Web Services
 
IBM Meetup on November 1, 2018: Machine Learning made easy with Watson Studio
IBM Meetup on November 1, 2018: Machine Learning made easy with Watson StudioIBM Meetup on November 1, 2018: Machine Learning made easy with Watson Studio
IBM Meetup on November 1, 2018: Machine Learning made easy with Watson StudioSvetlana Levitan, PhD
 
Integrate Machine Learning into Your Spring Application in Less than an Hour
Integrate Machine Learning into Your Spring Application in Less than an HourIntegrate Machine Learning into Your Spring Application in Less than an Hour
Integrate Machine Learning into Your Spring Application in Less than an HourVMware Tanzu
 
Norman Sasono - Incorporating AI/ML into Your Application Architecture
Norman Sasono - Incorporating AI/ML into Your Application ArchitectureNorman Sasono - Incorporating AI/ML into Your Application Architecture
Norman Sasono - Incorporating AI/ML into Your Application ArchitectureAgile Impact Conference
 
Norman Sasono - Incorporating AI/ML into Your Application Architecture
Norman Sasono - Incorporating AI/ML into Your Application ArchitectureNorman Sasono - Incorporating AI/ML into Your Application Architecture
Norman Sasono - Incorporating AI/ML into Your Application ArchitectureAgile Impact
 
Data Science at Speed. At Scale.
Data Science at Speed. At Scale.Data Science at Speed. At Scale.
Data Science at Speed. At Scale.DataWorks Summit
 
AIM102-S_Cognizant_CognizantCognitive
AIM102-S_Cognizant_CognizantCognitiveAIM102-S_Cognizant_CognizantCognitive
AIM102-S_Cognizant_CognizantCognitivePhilipBasford
 
Introduction to Machine learning and Deep Learning
Introduction to Machine learning and Deep LearningIntroduction to Machine learning and Deep Learning
Introduction to Machine learning and Deep LearningNishan Aryal
 
From Notebook to production with Amazon SageMaker
From Notebook to production with Amazon SageMakerFrom Notebook to production with Amazon SageMaker
From Notebook to production with Amazon SageMakerAmazon Web Services
 
The implementation of Big Data and AI on Digital Marketing
The implementation of Big Data and AI on Digital MarketingThe implementation of Big Data and AI on Digital Marketing
The implementation of Big Data and AI on Digital MarketingMohamed Hanafy
 
Amazon SageMaker (December 2018)
Amazon SageMaker (December 2018)Amazon SageMaker (December 2018)
Amazon SageMaker (December 2018)Julien SIMON
 
Julien Simon, Principal Technical Evangelist at Amazon - Machine Learning: Fr...
Julien Simon, Principal Technical Evangelist at Amazon - Machine Learning: Fr...Julien Simon, Principal Technical Evangelist at Amazon - Machine Learning: Fr...
Julien Simon, Principal Technical Evangelist at Amazon - Machine Learning: Fr...Codiax
 
Unlocking the Power of Generative AI An Executive's Guide.pdf
Unlocking the Power of Generative AI An Executive's Guide.pdfUnlocking the Power of Generative AI An Executive's Guide.pdf
Unlocking the Power of Generative AI An Executive's Guide.pdfPremNaraindas1
 

Similar to TechDayPakistan-Slides RAG with Cosmos DB.pptx (20)

TechEvent 2019: Artificial Intelligence in Dev & Ops; Martin Luckow - Trivadis
TechEvent 2019: Artificial Intelligence in Dev & Ops; Martin Luckow - TrivadisTechEvent 2019: Artificial Intelligence in Dev & Ops; Martin Luckow - Trivadis
TechEvent 2019: Artificial Intelligence in Dev & Ops; Martin Luckow - Trivadis
 
Insider's introduction to microsoft azure machine learning: 201411 Seattle Bu...
Insider's introduction to microsoft azure machine learning: 201411 Seattle Bu...Insider's introduction to microsoft azure machine learning: 201411 Seattle Bu...
Insider's introduction to microsoft azure machine learning: 201411 Seattle Bu...
 
Microsoft Build 2020: Data Science Recap
Microsoft Build 2020: Data Science RecapMicrosoft Build 2020: Data Science Recap
Microsoft Build 2020: Data Science Recap
 
Designing a Generative AI QnA solution with Proprietary Enterprise Business K...
Designing a Generative AI QnA solution with Proprietary Enterprise Business K...Designing a Generative AI QnA solution with Proprietary Enterprise Business K...
Designing a Generative AI QnA solution with Proprietary Enterprise Business K...
 
Global AI Bootcamp Madrid - Azure Databricks
Global AI Bootcamp Madrid - Azure DatabricksGlobal AI Bootcamp Madrid - Azure Databricks
Global AI Bootcamp Madrid - Azure Databricks
 
What are the Unique Challenges and Opportunities in Systems for ML?
What are the Unique Challenges and Opportunities in Systems for ML?What are the Unique Challenges and Opportunities in Systems for ML?
What are the Unique Challenges and Opportunities in Systems for ML?
 
Cloud based Machine Learning Platforms, a review - Sagar Khashu
Cloud based Machine Learning Platforms, a review - Sagar KhashuCloud based Machine Learning Platforms, a review - Sagar Khashu
Cloud based Machine Learning Platforms, a review - Sagar Khashu
 
Build, Train, and Deploy ML Models at Scale
Build, Train, and Deploy ML Models at ScaleBuild, Train, and Deploy ML Models at Scale
Build, Train, and Deploy ML Models at Scale
 
IBM Meetup on November 1, 2018: Machine Learning made easy with Watson Studio
IBM Meetup on November 1, 2018: Machine Learning made easy with Watson StudioIBM Meetup on November 1, 2018: Machine Learning made easy with Watson Studio
IBM Meetup on November 1, 2018: Machine Learning made easy with Watson Studio
 
Integrate Machine Learning into Your Spring Application in Less than an Hour
Integrate Machine Learning into Your Spring Application in Less than an HourIntegrate Machine Learning into Your Spring Application in Less than an Hour
Integrate Machine Learning into Your Spring Application in Less than an Hour
 
Norman Sasono - Incorporating AI/ML into Your Application Architecture
Norman Sasono - Incorporating AI/ML into Your Application ArchitectureNorman Sasono - Incorporating AI/ML into Your Application Architecture
Norman Sasono - Incorporating AI/ML into Your Application Architecture
 
Norman Sasono - Incorporating AI/ML into Your Application Architecture
Norman Sasono - Incorporating AI/ML into Your Application ArchitectureNorman Sasono - Incorporating AI/ML into Your Application Architecture
Norman Sasono - Incorporating AI/ML into Your Application Architecture
 
Data Science at Speed. At Scale.
Data Science at Speed. At Scale.Data Science at Speed. At Scale.
Data Science at Speed. At Scale.
 
AIM102-S_Cognizant_CognizantCognitive
AIM102-S_Cognizant_CognizantCognitiveAIM102-S_Cognizant_CognizantCognitive
AIM102-S_Cognizant_CognizantCognitive
 
Introduction to Machine learning and Deep Learning
Introduction to Machine learning and Deep LearningIntroduction to Machine learning and Deep Learning
Introduction to Machine learning and Deep Learning
 
From Notebook to production with Amazon SageMaker
From Notebook to production with Amazon SageMakerFrom Notebook to production with Amazon SageMaker
From Notebook to production with Amazon SageMaker
 
The implementation of Big Data and AI on Digital Marketing
The implementation of Big Data and AI on Digital MarketingThe implementation of Big Data and AI on Digital Marketing
The implementation of Big Data and AI on Digital Marketing
 
Amazon SageMaker (December 2018)
Amazon SageMaker (December 2018)Amazon SageMaker (December 2018)
Amazon SageMaker (December 2018)
 
Julien Simon, Principal Technical Evangelist at Amazon - Machine Learning: Fr...
Julien Simon, Principal Technical Evangelist at Amazon - Machine Learning: Fr...Julien Simon, Principal Technical Evangelist at Amazon - Machine Learning: Fr...
Julien Simon, Principal Technical Evangelist at Amazon - Machine Learning: Fr...
 
Unlocking the Power of Generative AI An Executive's Guide.pdf
Unlocking the Power of Generative AI An Executive's Guide.pdfUnlocking the Power of Generative AI An Executive's Guide.pdf
Unlocking the Power of Generative AI An Executive's Guide.pdf
 

More from Usama Wahab Khan Cloud, Data and AI

unleshing the the Power Azure Open AI - MCT Summit middle east 2024 Riyhad.pptx
unleshing the the Power Azure Open AI - MCT Summit middle east 2024 Riyhad.pptxunleshing the the Power Azure Open AI - MCT Summit middle east 2024 Riyhad.pptx
unleshing the the Power Azure Open AI - MCT Summit middle east 2024 Riyhad.pptxUsama Wahab Khan Cloud, Data and AI
 
Introduction to development using the share point framework mv ps
Introduction to development using the share point framework mv psIntroduction to development using the share point framework mv ps
Introduction to development using the share point framework mv psUsama Wahab Khan Cloud, Data and AI
 
Build with Serverless Applications with azure functions By usama wahab Khan
Build with Serverless Applications with azure functions By usama wahab KhanBuild with Serverless Applications with azure functions By usama wahab Khan
Build with Serverless Applications with azure functions By usama wahab KhanUsama Wahab Khan Cloud, Data and AI
 

More from Usama Wahab Khan Cloud, Data and AI (15)

unleshing the the Power Azure Open AI - MCT Summit middle east 2024 Riyhad.pptx
unleshing the the Power Azure Open AI - MCT Summit middle east 2024 Riyhad.pptxunleshing the the Power Azure Open AI - MCT Summit middle east 2024 Riyhad.pptx
unleshing the the Power Azure Open AI - MCT Summit middle east 2024 Riyhad.pptx
 
ServerLess by usama Azure fuctions.pptx
ServerLess by usama Azure fuctions.pptxServerLess by usama Azure fuctions.pptx
ServerLess by usama Azure fuctions.pptx
 
Azure synapse by usama whaba khan
Azure synapse by usama whaba khanAzure synapse by usama whaba khan
Azure synapse by usama whaba khan
 
MCT Summit Azure automated Machine Learning
MCT Summit Azure automated Machine Learning MCT Summit Azure automated Machine Learning
MCT Summit Azure automated Machine Learning
 
Azure databricks by usama whaba khan
Azure databricks by usama whaba khanAzure databricks by usama whaba khan
Azure databricks by usama whaba khan
 
Introduction to development using the share point framework mv ps
Introduction to development using the share point framework mv psIntroduction to development using the share point framework mv ps
Introduction to development using the share point framework mv ps
 
GIS Into to Cloud Microsoft Azure
GIS  Into  to Cloud Microsoft Azure GIS  Into  to Cloud Microsoft Azure
GIS Into to Cloud Microsoft Azure
 
Build with Serverless Applications with azure functions By usama wahab Khan
Build with Serverless Applications with azure functions By usama wahab KhanBuild with Serverless Applications with azure functions By usama wahab Khan
Build with Serverless Applications with azure functions By usama wahab Khan
 
Elearning usama
Elearning usamaElearning usama
Elearning usama
 
Microsoft PowerApps Introduction by Usama Wahab Khan MVP
Microsoft PowerApps Introduction by Usama Wahab Khan MVP Microsoft PowerApps Introduction by Usama Wahab Khan MVP
Microsoft PowerApps Introduction by Usama Wahab Khan MVP
 
SharePoint on Azure
SharePoint on Azure SharePoint on Azure
SharePoint on Azure
 
Windows azure overview for SharePoint Pros
Windows azure overview for SharePoint Pros Windows azure overview for SharePoint Pros
Windows azure overview for SharePoint Pros
 
Developing apps for share point 2013
Developing apps for share point 2013Developing apps for share point 2013
Developing apps for share point 2013
 
SPS Gulf : SharePoint 2013 Cloud Business App
SPS Gulf : SharePoint 2013 Cloud Business AppSPS Gulf : SharePoint 2013 Cloud Business App
SPS Gulf : SharePoint 2013 Cloud Business App
 
SharePoint 2013 REST and CSOM
SharePoint 2013 REST  and CSOMSharePoint 2013 REST  and CSOM
SharePoint 2013 REST and CSOM
 

Recently uploaded

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Recently uploaded (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

TechDayPakistan-Slides RAG with Cosmos DB.pptx

  • 1. Unleashing the power of rag retrieval augmented generation with cosmos db and LLM’s Usama Wahab Khan MVP , MCT, AI Champ award winner CTO @ Evolution Technologies #TechdayPakistan | @TechDayP | TechDayPakistan.com
  • 2. Usama Wahab Khan  Father, data Scientist, Developer/Nerd, Traveler Twitter : @usamawahabkhan LinkedIn : Usamawahabkhan
  • 3.
  • 5. Introduction to Generative AI Image or Video generation Code generation Generative AI refers to a type of artificial intelligence that has the ability to generate content that is, in many cases, indistinguishable from content created by humans. This AI can produce text, images, audio, or even video, often in response to a given input or prompt. Generative AI operates by learning patterns and structures from large datasets and then using that knowledge to produce new content that fits within those learned patterns. It's a type of machine learning where the AI model learns to understand and mimic the characteristics of the data it has been trained on.
  • 6. Generative AI capabilities Limitless generation with a few lines of input Essay outlines Summarizi ng text Virtual Assistants Extracting insights Classifying text Language Translation Poem creation Code refactoring Writing assistance Code generation Answering questions Creative Ideation Subject Research Dialog agents Comments from code Semantic search Image Generation
  • 7. What are large language models? Large Language Models (i.e., “language calculators”) Large: More data than can be manually labeled Language: Match context and words (e.g., word prediction, creative writing) Model: Semi-supervised learning A large language model (LLM) is a type of AI that can process and produce natural language text. It learns from a massive amount of data gathered from sources like books, articles, webpages, and images to discover patterns and rules of language.
  • 8. Foundation Models Data Text Images Speech Structured Data 3d Signals Tasks Question and Answering Sentiment Analysis Information Extraction Image Captioning Object Recognition Training Adaptation Foundation Model Instruction Follow Transformer Model
  • 10. Model History and Size of LLM
  • 11.
  • 12. How to use LLM
  • 13. Understanding prompts, completions, and tokens Like a person writing an essay, an AI model takes a prompt and continues writing based on the text in the prompt. The new text that the model outputs is called the completion. An example task might be to write a Python program to add two numbers. If you write out the task as a Python comment like so: Prompt engineering
  • 14.
  • 15.
  • 16. What is OpenAI? OpenAI is a private research laboratory that aims to develop and direct artificial intelligence (AI) in ways that benefit humanity as a whole. The company was founded by Elon Musk, Sam Altman and others in 2015 and is headquartered in San Francisco. Introduction to OpenAI
  • 17.
  • 18. Hallucinations While the LLM’s like ChatGPT model has proven to have extensive knowledge, it can still be wrong at times. It’s important to understand this limitation and apply mitigations for your scenario. Fine-Tuning is Expensive Enhanced Contextual Relevance No Realtime Knowledge LLM’s
  • 19. Fine Tuning  This is the process of taking a pre-trained LLM such as Llama OR OpenAI’s GPT Models and further training it on a smaller, specific dataset to adapt it for a particular task or to improve its performance. By finetuning, we are adjusting the model’s weights based on our data, making it more tailored to our application’s unique needs. #TechdayPakistan | @TechDayP | TechDayPakistan.com 3/4/2024 19
  • 20. What is RAG? RAG, or retrieval augmented generation, is a method introduced by Meta AI researchers that combines an information retrieval component with a text generator model to address knowledge-intensive tasks Large language models (LLMs) like ChatGPT are trained on public internet data which was available at the point in time when they were trained. They can answer questions related to the data they were trained on. This public data might not be sufficient to meet all your needs. You might want questions answered based on your private data. Or, the public data might simply have gotten out of date. The solution to this problem is Retrieval Augmented Generation (RAG), a pattern used in AI which uses an LLM to generate answers with your own data
  • 21. User Question LLM Workflow Query My Data Add Results to Prompt Query Model Send Results
  • 22. Why use RAG? • Fine-tuning is suitable for continuous domain adaptation, enabling significant improvements in model quality but often incurring higher costs. Conversely, RAG offers an alternative approach, allowing the use of the same model as a reasoning engine over new data provided in a prompt. This technique enables in-context learning without the need for expensive fine-tuning, empowering businesses to use LLMs more efficiently. • RAG allows businesses to achieve customized solutions while maintaining data relevance and optimizing costs. By adopting RAG, companies can use the reasoning capabilities of LLMs, utilizing their existing models to process and generate responses based on new data. RAG facilitates periodic data updates without the need for fine-tuning, thereby streamlining the integration of LLMs into businesses. 1. Provide supplemental data as a directive or a prompt to the LLM 2. Adds a fact checking component on your existing models 3. Train your model on up-to-date data without incurring the extra time and costs associated with fine-tuning 4. Train on your business specific data 3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com 22
  • 24. RAG Process 3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com 24
  • 25. Anatomy of a RAG app App UX Orchestrator Retriever over Knowledge Base Query  Knowledge Prompt + Knowledge  Response Large Language Model Build your own experience UX, orchestration, calls to retriever and LLM e.g., Copilots, in-app chat Extend other app experiences Plugins for retrieval, symbolic math, app integration, etc. e.g., plugins for OpenAI ChatGPT
  • 26. RAG Components  Data-Sources ( unstructured and structure or Cloud storage)  Indexing pipeline – Data Cleaning or OCR – Data Chunking – Indexing  Embedding Model  Vector Database  Vector Index  Vector retrieval query  Application AI orchestrator  LLM to Response 3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com 26
  • 27. Embedding Model • “Embeddings are vectors or arrays of numbers that represent the meaning and context of the tokens processed by the model. They are used to encode and decode input and output texts, and can vary in size and dimension. Embeddings can help the model understand the relationships between tokens, and generate relevant and coherent texts.” • LLM embedding models? • text-embedding-ada-002 by Azure Open AI • Hugging face Leadership board for embedding models https://huggingface.co/spaces/mteb/leaderboard 3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com 27
  • 28. 3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com 28
  • 29. Vector databases or store  Vector databases or stores: are used in numerous domains and situations across analytical and generative AI, including natural language processing, video and image recognition, recommendation systems, search, etc. Most popular options for RAG. Vector database is used to store Text embeddings. The outcomes of Embedding models into the quarriable database. 3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com 29
  • 30. Vector databases or store  Poplar Vector Database / Stores  There are several vector databases and stores available for AI-native embedding. Here are some examples:  Pinecone: A cloud-native vector database that offers a seamless API and hassle-free infrastructure. It is now available on Azure Marketplace.  Chroma DB: An open-source vector database tailored for AI-native embedding.  Faiss: An open-source library developed by Facebook AI Research for fast, dense vector similarity search and grouping.  Azure Cosmos DB: A globally distributed, multi-model database service that supports document, key-value, graph, and column-family data models. It also supports vector database extensions. Use the native vector search feature in Azure Cosmos DB for MongoDB vCore, which offers an efficient way to store, index, and search high- dimensional vector data directly alongside other application data. Use the native vector search feature in Azure Cosmos DB for PostgreSQL, which offers an efficient way to store, index, and search high-dimensional vector data directly alongside other application data 3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com 30
  • 31. Azure Cosmos DB Vector store Options  Azure Cosmos DB for Mongo DB vCore Store your application data and vector embeddings together in a single MongoDB- compatible service featuring native support for vector search.  Azure Cosmos DB for PostgreSQL Store your data and vectors together in a scalable PostgreSQL offering with native support for vector search.  Azure Cosmos DB for NoSQL with Azure AI Search Augment your Azure Cosmos DB data with semantic and vector search capabilities of Azure AI Search. 3/4/2024 #TechdayPakistan | @TechDayP | TechDayPakistan.com 31
  • 32. Speaker Slides #TechdayPakistan | @TechDayP | TechDayPakistan.com
  • 33. Optional Slides The slides that follow this slide are optional #TechdayPakistan | @TechDayP | TechDayPakistan.com Note: This slide is just for Informational Purposes

Editor's Notes

  1. Overview of generative AI capabilities for inspiration.
  2. This technique uses a large language model (LLM) to generate text based on information retrieved from external sources. The process involves the following steps: Getting data: The data can be any text-based document or database that contains relevant facts or knowledge for the task. Splitting it into small chunks: The data is divided into smaller pieces of text, such as sentences or paragraphs, that can be easily processed by the LLM. Using a specific type of LLM embedding model: The embedding model is a component of the LLM that converts each text chunk into a numerical vector in a high-dimensional space. The vector represents the meaning and context of the text chunk.