SlideShare a Scribd company logo
Customizing LLMs
TechFrontiers AI Meetup, Nov 2, 2023
Jim Steele
Customizing Large Language Models
LLMs allow humans to efficiently interact and
generate content with basically “all” annotated
publicly available human knowledge.
But what about incorporating proprietary, domain
specific, or private data into these models? 2
Custom
knowledge
?
Corpus of Human
Knowledge
(“The Internet”)
Three custom options for LLMs
3
Custom
knowledge
Corpus of Human
Knowledge
(“The Internet”)
Train a custom
LLM
Tune general
purpose LLM
Prompt general
purpose LLM
Custom options for LLMs (1 of 3)
4
Corpus of Human
Knowledge
(“The Internet”)
Train a custom
LLM
Tune general
purpose LLM
Prompt general
purpose LLM
Training requires immense resources only available to the few such
as Open AI, Google, and Meta. (Named “Foundation Models”)
Closed models: ChatGPT/GPT-4 (Open AI), Bard/PaLM2 (Google), …
Open models: LLaMA 2 (Meta), Claude 2 (Anthropic), …
Custom options for LLMs (2 of 3)
5
Corpus of Human
Knowledge
(“The Internet”)
Train a custom
LLM
Tune general
purpose LLM
Prompt general
purpose LLM
Fine-tuning can be done post-training to incorporate or
emphasize custom knowledge.
These techniques are used in foundation models already!
Fine-tuning for LLMs (1 of 2)
Prompt: “Write an essay about Alexander Hamilton.”
LLM: “Your essay should be at least five pages, double-spaced, and include at
least two citations.”
source 6
Supervised Fine-Tuning (SFT): correct gross errors to be
more in line with expected use-cases. Prioritization of
quality examples over quantity, as numerous reports show
that the use of high-quality data results in improved final
model performance.
Without tuning, LLMs would produce wrong intended responses, e.g.:
Fine-tuning for LLMs (2 of 2)
7
Prompt: What is Yann LeCun an expert in?
LLM possible results:
● Yann has many publications in artificial intelligence, computer
vision, and mobile robotics.
● Yann has worked in artificial intelligence, machine learning, and
mobile robotics.
● Yann has researched artificial intelligence, computer vision, and
computational neuroscience.
Reinforcement Learning with Human Feedback (RLHF):
corrects nuanced errors to be more in line with expected
responses. Examples are collected and annotators select
their preferred model outputs. This data is used to train a
reward model, where the focus is on helpfulness and safety.
source
Ways for the Rest of Us to
Customize Pre-trained LLMs
Parameter-efficient fine-tuning (PEFT): e.g. adapter
modules, prompt tuning, sparse update methods, provides
better accuracy with lower compute costs
Few-shot In-context Learning (ICL): feed a small number of
training examples as part of the input (computationally
intensive)
8
Custom Fine-tuning with LoRA
Observe that customization often changes a
small subset of the original LLM parameters.
LoRA = Low-Rank Adaptation of Large
Language Models
Fine-tune on a lower rank subset of parameters
before adding to the pretrained weights
Example to the left: Results showing LLaMA-2
can learn ViGGO (Video Game vernacular)
Source
9
← From
original
LoRA
research
paper
Parameter-efficient fine-tuning example
LLM can modify its behavior
based on previous prompts
Exhibiting chain-of-thought, or
reasoning, in prompts produces
better responses.
10
Few-shot In-context Learning example
Custom options for LLMs (3 of 3)
11
Corpus of Human
Knowledge
(“The Internet”)
Train a custom
LLM
Tune general
purpose LLM
Prompt general
purpose LLM
Modify prompts to incorporate or emphasize custom
knowledge.
These techniques are used in foundation models already too!
How do LLMs have a conversation?
Research on LLM long term memory not implemented yet.
Currently Chat LLM programs feed the previous queries and
responses into each new prompt to provide a sense of
conversation. Note:
● LLM input token limit: means earlier parts of the
conversation are eventually forgotten
● Transformers do not “change their minds”: responses are
auto-regressive (errors accumulate).
● Self-attention helps: More information in prompt leads to
more specialized responses.
12
LLM input token limit
ChatGPT allows ~4k words,
GPT-4 allows ~32k words,
Claude 2 allows ~75k words
Prompt expansion with Retrieval
Augmented Generation (RAG)
Rather than pass costly text with each prompt,
RAG adds an information retrieval mechanism to
augment the user prompt with relevant context
info otherwise not available to the LLM, e.g.:
● real-time context (weather, location, etc.)
● user-specific information (website orders,
status, etc.)
● relevant factual information (docs not in LLM
training data - either private or updated after
the LLM was trained).
13
This is accomplished by building a vector
embedding index around input data using
e.g., Langchain or Llama Index
source
Summary
Beyond an all-out retraining, there are two
main techniques to improve LLM output
relevance summarized as [ref]:
● Fine-tune model for form (e.g., LoRA)
● Prompt expansion for fact (e.g., RAG)
Also, more LLMs are providing tools for
custom data (see demo: NotebookLM)
14
Source
Additional
References
Personal LLAMA
Getting started with LlamaIndex
LlamaIndex Origin
15
Appendix
16
Example of Vector Embeddings
with LlamaIndex
from llama_index import VectorStoreIndex, SimpleDirectoryReader
documents = SimpleDirectoryReader('my-directory-of-docs').load_data()
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
results = query_engine.query("What is DeepHaiku? Be brief")
print(results)
17
source
Ad

More Related Content

What's hot (20)

Transformers, LLMs, and the Possibility of AGI
Transformers, LLMs, and the Possibility of AGITransformers, LLMs, and the Possibility of AGI
Transformers, LLMs, and the Possibility of AGI
SynaptonIncorporated
 
Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in...
Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in...Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in...
Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in...
David Talby
 
Large Language Models Bootcamp
Large Language Models BootcampLarge Language Models Bootcamp
Large Language Models Bootcamp
Data Science Dojo
 
A brief primer on OpenAI's GPT-3
A brief primer on OpenAI's GPT-3A brief primer on OpenAI's GPT-3
A brief primer on OpenAI's GPT-3
Ishan Jain
 
Mother of Language`s Langchain
Mother of Language`s LangchainMother of Language`s Langchain
Mother of Language`s Langchain
Jun-hang Lee
 
Automate your Job and Business with ChatGPT #3 - Fundamentals of LLM/GPT
Automate your Job and Business with ChatGPT #3 - Fundamentals of LLM/GPTAutomate your Job and Business with ChatGPT #3 - Fundamentals of LLM/GPT
Automate your Job and Business with ChatGPT #3 - Fundamentals of LLM/GPT
Anant Corporation
 
Intro to LLMs
Intro to LLMsIntro to LLMs
Intro to LLMs
Loic Merckel
 
Generative Models and ChatGPT
Generative Models and ChatGPTGenerative Models and ChatGPT
Generative Models and ChatGPT
Loic Merckel
 
Let's talk about GPT: A crash course in Generative AI for researchers
Let's talk about GPT: A crash course in Generative AI for researchersLet's talk about GPT: A crash course in Generative AI for researchers
Let's talk about GPT: A crash course in Generative AI for researchers
Steven Van Vaerenbergh
 
Presentation-Open AI Chat GPT-4 3.pptx
Presentation-Open AI Chat GPT-4 3.pptxPresentation-Open AI Chat GPT-4 3.pptx
Presentation-Open AI Chat GPT-4 3.pptx
NitinKhandelwal71
 
LLMs Bootcamp
LLMs BootcampLLMs Bootcamp
LLMs Bootcamp
Fiza987241
 
Large Language Models - Chat AI.pdf
Large Language Models - Chat AI.pdfLarge Language Models - Chat AI.pdf
Large Language Models - Chat AI.pdf
David Rostcheck
 
The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT!
The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT!The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT!
The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT!
taozen
 
presentation.pdf
presentation.pdfpresentation.pdf
presentation.pdf
caa28steve
 
And then there were ... Large Language Models
And then there were ... Large Language ModelsAnd then there were ... Large Language Models
And then there were ... Large Language Models
Leon Dohmen
 
Journey of Generative AI
Journey of Generative AIJourney of Generative AI
Journey of Generative AI
thomasjvarghese49
 
LanGCHAIN Framework
LanGCHAIN FrameworkLanGCHAIN Framework
LanGCHAIN Framework
Keymate.AI
 
LLMs_talk_March23.pdf
LLMs_talk_March23.pdfLLMs_talk_March23.pdf
LLMs_talk_March23.pdf
ChaoYang81
 
OpenAI’s GPT 3 Language Model - guest Steve Omohundro
OpenAI’s GPT 3 Language Model - guest Steve OmohundroOpenAI’s GPT 3 Language Model - guest Steve Omohundro
OpenAI’s GPT 3 Language Model - guest Steve Omohundro
Numenta
 
How Does Generative AI Actually Work? (a quick semi-technical introduction to...
How Does Generative AI Actually Work? (a quick semi-technical introduction to...How Does Generative AI Actually Work? (a quick semi-technical introduction to...
How Does Generative AI Actually Work? (a quick semi-technical introduction to...
ssuser4edc93
 
Transformers, LLMs, and the Possibility of AGI
Transformers, LLMs, and the Possibility of AGITransformers, LLMs, and the Possibility of AGI
Transformers, LLMs, and the Possibility of AGI
SynaptonIncorporated
 
Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in...
Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in...Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in...
Large Language Models, No-Code, and Responsible AI - Trends in Applied NLP in...
David Talby
 
Large Language Models Bootcamp
Large Language Models BootcampLarge Language Models Bootcamp
Large Language Models Bootcamp
Data Science Dojo
 
A brief primer on OpenAI's GPT-3
A brief primer on OpenAI's GPT-3A brief primer on OpenAI's GPT-3
A brief primer on OpenAI's GPT-3
Ishan Jain
 
Mother of Language`s Langchain
Mother of Language`s LangchainMother of Language`s Langchain
Mother of Language`s Langchain
Jun-hang Lee
 
Automate your Job and Business with ChatGPT #3 - Fundamentals of LLM/GPT
Automate your Job and Business with ChatGPT #3 - Fundamentals of LLM/GPTAutomate your Job and Business with ChatGPT #3 - Fundamentals of LLM/GPT
Automate your Job and Business with ChatGPT #3 - Fundamentals of LLM/GPT
Anant Corporation
 
Generative Models and ChatGPT
Generative Models and ChatGPTGenerative Models and ChatGPT
Generative Models and ChatGPT
Loic Merckel
 
Let's talk about GPT: A crash course in Generative AI for researchers
Let's talk about GPT: A crash course in Generative AI for researchersLet's talk about GPT: A crash course in Generative AI for researchers
Let's talk about GPT: A crash course in Generative AI for researchers
Steven Van Vaerenbergh
 
Presentation-Open AI Chat GPT-4 3.pptx
Presentation-Open AI Chat GPT-4 3.pptxPresentation-Open AI Chat GPT-4 3.pptx
Presentation-Open AI Chat GPT-4 3.pptx
NitinKhandelwal71
 
Large Language Models - Chat AI.pdf
Large Language Models - Chat AI.pdfLarge Language Models - Chat AI.pdf
Large Language Models - Chat AI.pdf
David Rostcheck
 
The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT!
The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT!The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT!
The Rise of the LLMs - How I Learned to Stop Worrying & Love the GPT!
taozen
 
presentation.pdf
presentation.pdfpresentation.pdf
presentation.pdf
caa28steve
 
And then there were ... Large Language Models
And then there were ... Large Language ModelsAnd then there were ... Large Language Models
And then there were ... Large Language Models
Leon Dohmen
 
LanGCHAIN Framework
LanGCHAIN FrameworkLanGCHAIN Framework
LanGCHAIN Framework
Keymate.AI
 
LLMs_talk_March23.pdf
LLMs_talk_March23.pdfLLMs_talk_March23.pdf
LLMs_talk_March23.pdf
ChaoYang81
 
OpenAI’s GPT 3 Language Model - guest Steve Omohundro
OpenAI’s GPT 3 Language Model - guest Steve OmohundroOpenAI’s GPT 3 Language Model - guest Steve Omohundro
OpenAI’s GPT 3 Language Model - guest Steve Omohundro
Numenta
 
How Does Generative AI Actually Work? (a quick semi-technical introduction to...
How Does Generative AI Actually Work? (a quick semi-technical introduction to...How Does Generative AI Actually Work? (a quick semi-technical introduction to...
How Does Generative AI Actually Work? (a quick semi-technical introduction to...
ssuser4edc93
 

Similar to Customizing LLMs (20)

LLMs for the “GPU-Poor” - Franck Nijimbere.pdf
LLMs for the “GPU-Poor” - Franck Nijimbere.pdfLLMs for the “GPU-Poor” - Franck Nijimbere.pdf
LLMs for the “GPU-Poor” - Franck Nijimbere.pdf
GDG Bujumbura
 
GPT, LLM, RAG, and RAG in Action: Understanding the Future of AI-Powered Info...
GPT, LLM, RAG, and RAG in Action: Understanding the Future of AI-Powered Info...GPT, LLM, RAG, and RAG in Action: Understanding the Future of AI-Powered Info...
GPT, LLM, RAG, and RAG in Action: Understanding the Future of AI-Powered Info...
Muralidharan Deenathayalan
 
Roman Kyslyi: Синтетичні дані – стратегії, використання (UA)
Roman Kyslyi: Синтетичні дані – стратегії, використання (UA)Roman Kyslyi: Синтетичні дані – стратегії, використання (UA)
Roman Kyslyi: Синтетичні дані – стратегії, використання (UA)
Lviv Startup Club
 
Gen AI Applications in Different Industries.pdf
Gen AI Applications in Different Industries.pdfGen AI Applications in Different Industries.pdf
Gen AI Applications in Different Industries.pdf
pallavidhade2
 
Introduction to LLM Post-Training - MIT 6.S191 2025
Introduction to LLM Post-Training - MIT 6.S191 2025Introduction to LLM Post-Training - MIT 6.S191 2025
Introduction to LLM Post-Training - MIT 6.S191 2025
Maxime Labonne
 
Large Language Modelsjjjhhhjjjjjjbbbbbbj.pdf
Large Language Modelsjjjhhhjjjjjjbbbbbbj.pdfLarge Language Modelsjjjhhhjjjjjjbbbbbbj.pdf
Large Language Modelsjjjhhhjjjjjjbbbbbbj.pdf
BrsioftBlogger
 
What is GPT?GPT EXPLAINED IN SIMPLE WORDS
What is GPT?GPT EXPLAINED IN SIMPLE WORDSWhat is GPT?GPT EXPLAINED IN SIMPLE WORDS
What is GPT?GPT EXPLAINED IN SIMPLE WORDS
Muhammad Hashim
 
"Running Open-Source LLM models on Kubernetes", Volodymyr Tsap
"Running Open-Source LLM models on Kubernetes",  Volodymyr Tsap"Running Open-Source LLM models on Kubernetes",  Volodymyr Tsap
"Running Open-Source LLM models on Kubernetes", Volodymyr Tsap
Fwdays
 
Train foundation model for domain-specific language model
Train foundation model for domain-specific language modelTrain foundation model for domain-specific language model
Train foundation model for domain-specific language model
Benjaminlapid1
 
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
 
Applications of Generative Artificial intelligence
Applications of Generative Artificial intelligenceApplications of Generative Artificial intelligence
Applications of Generative Artificial intelligence
DrNBargavi
 
Navigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi DaparthiNavigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi Daparthi
RaviKumarDaparthi
 
LLM Cheatsheet and it's brief introduction
LLM Cheatsheet and it's brief introductionLLM Cheatsheet and it's brief introduction
LLM Cheatsheet and it's brief introduction
DarkKnight437486
 
Demystifying Ml, DL and AI
Demystifying Ml, DL and AIDemystifying Ml, DL and AI
Demystifying Ml, DL and AI
Greg Werner
 
Maximizing Network Efficiency with Large Language Models (LLM)
Maximizing Network Efficiency with Large Language Models (LLM)Maximizing Network Efficiency with Large Language Models (LLM)
Maximizing Network Efficiency with Large Language Models (LLM)
Bangladesh Network Operators Group
 
Trustworthy Generative AI_ ICML'23 Tutorial.pptx
Trustworthy Generative AI_ ICML'23 Tutorial.pptxTrustworthy Generative AI_ ICML'23 Tutorial.pptx
Trustworthy Generative AI_ ICML'23 Tutorial.pptx
sylvioneto11
 
Enterprise Trends for Gen AI - Berkeley LLM AI Agents MOOC
Enterprise Trends for Gen AI  - Berkeley LLM AI Agents MOOCEnterprise Trends for Gen AI  - Berkeley LLM AI Agents MOOC
Enterprise Trends for Gen AI - Berkeley LLM AI Agents MOOC
VincentLui15
 
Machine Learning AND Deep Learning for OpenPOWER
Machine Learning AND Deep Learning for OpenPOWERMachine Learning AND Deep Learning for OpenPOWER
Machine Learning AND Deep Learning for OpenPOWER
Ganesan Narayanasamy
 
Building intelligent applications with Large Language Models
Building intelligent applications with Large Language ModelsBuilding intelligent applications with Large Language Models
Building intelligent applications with Large Language Models
Speck&Tech
 
OutSystems User Group November 2024
OutSystems User Group November 2024OutSystems User Group November 2024
OutSystems User Group November 2024
mail496323
 
LLMs for the “GPU-Poor” - Franck Nijimbere.pdf
LLMs for the “GPU-Poor” - Franck Nijimbere.pdfLLMs for the “GPU-Poor” - Franck Nijimbere.pdf
LLMs for the “GPU-Poor” - Franck Nijimbere.pdf
GDG Bujumbura
 
GPT, LLM, RAG, and RAG in Action: Understanding the Future of AI-Powered Info...
GPT, LLM, RAG, and RAG in Action: Understanding the Future of AI-Powered Info...GPT, LLM, RAG, and RAG in Action: Understanding the Future of AI-Powered Info...
GPT, LLM, RAG, and RAG in Action: Understanding the Future of AI-Powered Info...
Muralidharan Deenathayalan
 
Roman Kyslyi: Синтетичні дані – стратегії, використання (UA)
Roman Kyslyi: Синтетичні дані – стратегії, використання (UA)Roman Kyslyi: Синтетичні дані – стратегії, використання (UA)
Roman Kyslyi: Синтетичні дані – стратегії, використання (UA)
Lviv Startup Club
 
Gen AI Applications in Different Industries.pdf
Gen AI Applications in Different Industries.pdfGen AI Applications in Different Industries.pdf
Gen AI Applications in Different Industries.pdf
pallavidhade2
 
Introduction to LLM Post-Training - MIT 6.S191 2025
Introduction to LLM Post-Training - MIT 6.S191 2025Introduction to LLM Post-Training - MIT 6.S191 2025
Introduction to LLM Post-Training - MIT 6.S191 2025
Maxime Labonne
 
Large Language Modelsjjjhhhjjjjjjbbbbbbj.pdf
Large Language Modelsjjjhhhjjjjjjbbbbbbj.pdfLarge Language Modelsjjjhhhjjjjjjbbbbbbj.pdf
Large Language Modelsjjjhhhjjjjjjbbbbbbj.pdf
BrsioftBlogger
 
What is GPT?GPT EXPLAINED IN SIMPLE WORDS
What is GPT?GPT EXPLAINED IN SIMPLE WORDSWhat is GPT?GPT EXPLAINED IN SIMPLE WORDS
What is GPT?GPT EXPLAINED IN SIMPLE WORDS
Muhammad Hashim
 
"Running Open-Source LLM models on Kubernetes", Volodymyr Tsap
"Running Open-Source LLM models on Kubernetes",  Volodymyr Tsap"Running Open-Source LLM models on Kubernetes",  Volodymyr Tsap
"Running Open-Source LLM models on Kubernetes", Volodymyr Tsap
Fwdays
 
Train foundation model for domain-specific language model
Train foundation model for domain-specific language modelTrain foundation model for domain-specific language model
Train foundation model for domain-specific language model
Benjaminlapid1
 
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
 
Applications of Generative Artificial intelligence
Applications of Generative Artificial intelligenceApplications of Generative Artificial intelligence
Applications of Generative Artificial intelligence
DrNBargavi
 
Navigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi DaparthiNavigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi Daparthi
RaviKumarDaparthi
 
LLM Cheatsheet and it's brief introduction
LLM Cheatsheet and it's brief introductionLLM Cheatsheet and it's brief introduction
LLM Cheatsheet and it's brief introduction
DarkKnight437486
 
Demystifying Ml, DL and AI
Demystifying Ml, DL and AIDemystifying Ml, DL and AI
Demystifying Ml, DL and AI
Greg Werner
 
Maximizing Network Efficiency with Large Language Models (LLM)
Maximizing Network Efficiency with Large Language Models (LLM)Maximizing Network Efficiency with Large Language Models (LLM)
Maximizing Network Efficiency with Large Language Models (LLM)
Bangladesh Network Operators Group
 
Trustworthy Generative AI_ ICML'23 Tutorial.pptx
Trustworthy Generative AI_ ICML'23 Tutorial.pptxTrustworthy Generative AI_ ICML'23 Tutorial.pptx
Trustworthy Generative AI_ ICML'23 Tutorial.pptx
sylvioneto11
 
Enterprise Trends for Gen AI - Berkeley LLM AI Agents MOOC
Enterprise Trends for Gen AI  - Berkeley LLM AI Agents MOOCEnterprise Trends for Gen AI  - Berkeley LLM AI Agents MOOC
Enterprise Trends for Gen AI - Berkeley LLM AI Agents MOOC
VincentLui15
 
Machine Learning AND Deep Learning for OpenPOWER
Machine Learning AND Deep Learning for OpenPOWERMachine Learning AND Deep Learning for OpenPOWER
Machine Learning AND Deep Learning for OpenPOWER
Ganesan Narayanasamy
 
Building intelligent applications with Large Language Models
Building intelligent applications with Large Language ModelsBuilding intelligent applications with Large Language Models
Building intelligent applications with Large Language Models
Speck&Tech
 
OutSystems User Group November 2024
OutSystems User Group November 2024OutSystems User Group November 2024
OutSystems User Group November 2024
mail496323
 
Ad

Recently uploaded (20)

WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Ad

Customizing LLMs

  • 1. Customizing LLMs TechFrontiers AI Meetup, Nov 2, 2023 Jim Steele
  • 2. Customizing Large Language Models LLMs allow humans to efficiently interact and generate content with basically “all” annotated publicly available human knowledge. But what about incorporating proprietary, domain specific, or private data into these models? 2 Custom knowledge ? Corpus of Human Knowledge (“The Internet”)
  • 3. Three custom options for LLMs 3 Custom knowledge Corpus of Human Knowledge (“The Internet”) Train a custom LLM Tune general purpose LLM Prompt general purpose LLM
  • 4. Custom options for LLMs (1 of 3) 4 Corpus of Human Knowledge (“The Internet”) Train a custom LLM Tune general purpose LLM Prompt general purpose LLM Training requires immense resources only available to the few such as Open AI, Google, and Meta. (Named “Foundation Models”) Closed models: ChatGPT/GPT-4 (Open AI), Bard/PaLM2 (Google), … Open models: LLaMA 2 (Meta), Claude 2 (Anthropic), …
  • 5. Custom options for LLMs (2 of 3) 5 Corpus of Human Knowledge (“The Internet”) Train a custom LLM Tune general purpose LLM Prompt general purpose LLM Fine-tuning can be done post-training to incorporate or emphasize custom knowledge. These techniques are used in foundation models already!
  • 6. Fine-tuning for LLMs (1 of 2) Prompt: “Write an essay about Alexander Hamilton.” LLM: “Your essay should be at least five pages, double-spaced, and include at least two citations.” source 6 Supervised Fine-Tuning (SFT): correct gross errors to be more in line with expected use-cases. Prioritization of quality examples over quantity, as numerous reports show that the use of high-quality data results in improved final model performance. Without tuning, LLMs would produce wrong intended responses, e.g.:
  • 7. Fine-tuning for LLMs (2 of 2) 7 Prompt: What is Yann LeCun an expert in? LLM possible results: ● Yann has many publications in artificial intelligence, computer vision, and mobile robotics. ● Yann has worked in artificial intelligence, machine learning, and mobile robotics. ● Yann has researched artificial intelligence, computer vision, and computational neuroscience. Reinforcement Learning with Human Feedback (RLHF): corrects nuanced errors to be more in line with expected responses. Examples are collected and annotators select their preferred model outputs. This data is used to train a reward model, where the focus is on helpfulness and safety. source
  • 8. Ways for the Rest of Us to Customize Pre-trained LLMs Parameter-efficient fine-tuning (PEFT): e.g. adapter modules, prompt tuning, sparse update methods, provides better accuracy with lower compute costs Few-shot In-context Learning (ICL): feed a small number of training examples as part of the input (computationally intensive) 8
  • 9. Custom Fine-tuning with LoRA Observe that customization often changes a small subset of the original LLM parameters. LoRA = Low-Rank Adaptation of Large Language Models Fine-tune on a lower rank subset of parameters before adding to the pretrained weights Example to the left: Results showing LLaMA-2 can learn ViGGO (Video Game vernacular) Source 9 ← From original LoRA research paper Parameter-efficient fine-tuning example
  • 10. LLM can modify its behavior based on previous prompts Exhibiting chain-of-thought, or reasoning, in prompts produces better responses. 10 Few-shot In-context Learning example
  • 11. Custom options for LLMs (3 of 3) 11 Corpus of Human Knowledge (“The Internet”) Train a custom LLM Tune general purpose LLM Prompt general purpose LLM Modify prompts to incorporate or emphasize custom knowledge. These techniques are used in foundation models already too!
  • 12. How do LLMs have a conversation? Research on LLM long term memory not implemented yet. Currently Chat LLM programs feed the previous queries and responses into each new prompt to provide a sense of conversation. Note: ● LLM input token limit: means earlier parts of the conversation are eventually forgotten ● Transformers do not “change their minds”: responses are auto-regressive (errors accumulate). ● Self-attention helps: More information in prompt leads to more specialized responses. 12 LLM input token limit ChatGPT allows ~4k words, GPT-4 allows ~32k words, Claude 2 allows ~75k words
  • 13. Prompt expansion with Retrieval Augmented Generation (RAG) Rather than pass costly text with each prompt, RAG adds an information retrieval mechanism to augment the user prompt with relevant context info otherwise not available to the LLM, e.g.: ● real-time context (weather, location, etc.) ● user-specific information (website orders, status, etc.) ● relevant factual information (docs not in LLM training data - either private or updated after the LLM was trained). 13 This is accomplished by building a vector embedding index around input data using e.g., Langchain or Llama Index source
  • 14. Summary Beyond an all-out retraining, there are two main techniques to improve LLM output relevance summarized as [ref]: ● Fine-tune model for form (e.g., LoRA) ● Prompt expansion for fact (e.g., RAG) Also, more LLMs are providing tools for custom data (see demo: NotebookLM) 14 Source
  • 15. Additional References Personal LLAMA Getting started with LlamaIndex LlamaIndex Origin 15
  • 17. Example of Vector Embeddings with LlamaIndex from llama_index import VectorStoreIndex, SimpleDirectoryReader documents = SimpleDirectoryReader('my-directory-of-docs').load_data() index = VectorStoreIndex.from_documents(documents) query_engine = index.as_query_engine() results = query_engine.query("What is DeepHaiku? Be brief") print(results) 17 source