際際滷

際際滷Share a Scribd company logo
Session
ChatGPT Box
LED BY
SCOTT STEINBECK
SCOTT STEINBECK
SPEAKER AT ITB2023
 Software Engineer
 15+ Year of experience
 Father
 Hardware Tinkerer
 Coding on my free time
 Overcommitting myself
 Automating everything
 IOT Development
 Teaching Coding/Electronics
 Contributing to open source
Hobbies
BREIF HISTORY
Thanks to our sponsors
 Traditional language models (e.g., n-gram models) had limitations:
 Explosion of state space (curse of dimensionality) and sparsity led to inconsistent
output resembling gibberish.
 Inability to handle novel phrases and lack of coherence in the generated text.
Pre-2000's:
 Advancements in training neural networks by Geo鍖rey Hinton:
 Deep neural networks alleviated some language model problems.
 Nuanced arbitrary concepts were represented in a 鍖nite space, but output lacked
coherence relative to the input sequence.
Mid-2000's:
 Rise of Long Short-Term Memory (LSTM) networks:
 LSTMs enabled processing of arbitrary length sequences.
 Dynamic alteration of internal state improved language model performance
signi鍖cantly.
Early-2010's:
 Introduction of Transformer Networks with the "Attention Is All You Need" paper by
Google:
 Transformers revolutionized natural language processing, achieving tasks like
language translation at human-level or better.
 Attention mechanisms and parallel processing allowed the model to analyze the entire
input simultaneously.
Late-2010's:
 Emergence of Generative Pre-Trained (GPT) models, notably GPT-3:
 Large language models could be trained on massive data without speci鍖c agendas.
 Fine-tuning for speci鍖c tasks led to state-of-the-art results via text interaction.
2020's
1 petabyte
of training
data
DIGGING IN
Thanks to our sponsors
AI UNDER THE HOOD
AI, or Artificial Intelligence, is a broad
field that encompasses the
development of intelligent systems
capable of performing tasks that
typically require human intelligence.
This works by combining rule-based
modeling of human languagewith
statistical, machine learning, and deep
learning models
Natural Language Processing Tasks
Natural Language Understanding (NLU)
deals with the ability of computers to understand
human language.
Natural Language Generation (NLG)
 data to text - text is generated to explain or describe a
structured record or unstructured perceptual input;
 text to text - typically involves fusing information from
multiple linguistic sources into a single coherent
summary;
 dialogue - text is generated as part of an interactive
conversation with one or more human participants.
Machine Learning
 ML techniques play a key
role in AI by enabling
systems to automatically
learn from experience,
adapt to new data, and
improve their
performance over time.
 ML algorithms are used in
various AI applications,
including computer vision,
speech recognition,
recommendation systems,
and, importantly, NLP
tasks.
Machine Learning to Play Hill Climb Racing
Deep Learning
 DL has revolutionized ML
by enabling models to
automatically learn more
abstract and nuanced
features from raw data.
 DL help NLP to understand
natural language, enabling
them to capture
contextual dependencies
and learn complex
representations.
Deep Learning to car attribute classification
WHAT IS AN LLM
Practical AI
A large language model is a
prediction engine that takes a
sequence of words and tries
to predict the most likely
sequence to come after that
sequence.
It does this by assigning a
probability to likely next
sequences and then samples
from those to choose one.
The process repeats until
some stopping criteria is met.
APPLICATIONS AND INFRASTRUCTURE USING ARTIFICIAL INTELLIGENCE TODAY
HOW AI LEARNS NEW ABILITIES
Practical AI
As LLMs are scaled they hit a series of critical scales at which new abilities are suddenly unlocked. LLMs are
not directly trained to have these abilities, and they appear in rapid and unpredictable ways as if emerging out
of thin air.
Applications of Large Language Models
Practical AI
ASKING AI A
QUESTION
Thanks to our sponsors
TOKENIZATION
CHATGPT
What are some common mistakes to avoid when writing code?
Tokens can be words, subwords, or characters, depending
on the specific tokenization scheme used.
INPUT ANALYSIS
CHATGPT
1. Informational Questions:
 "What is the capital of France?"
 "Can you explain the concept of relativity?"
2. Procedural Questions:
 "What are the steps to install a software program?"
3. Comparison Questions:
 "Compare the advantages of iOS and Android."
4. Opinion Questions:
 Do you think technology is making us more connected or disconnected?"
5. Problem-Solving Questions:
 "How can I optimize my website's loading speed?"
6. Request for Advice:
 "Which programming language should I learn as a beginner?"
7. Request for Explanation:
 "What is the significance of the Pythagorean theorem?"
What are some common mistakes to avoid when writing code?
Understanding the Question
CHATGPT
1. Neural Networks turn
tokens into dense vectors
(word embeddings)
 This adds context and
captures complex
relationships between
words
What are some common mistakes to avoid when writing code?
Vectors with shorter distances between them usually share common contexts in
the corpus. This allows us to find distances between words
|cat - dog| = 1.20
|cat - cow| = 1.48
"cat" is closer to "dog" than it is to the "cow".
Monday Vector What Vector
Retrieval/Integration of Knowledge
CHATGPT
_ _ _ _ mistakes _ avoid _ writing code?
Generating the Answer
CHATGPT
_ _ _ _ mistakes _ avoid _ writing code?
Common mistakes to avoid when writing code include:
 Poor code organization and lack of proper indentation.
 Inefficient algorithms or data structures that result in slow performance.
 Lack of proper error handling and exception management.
 Insufficient comments and documentation, making the code difficult to understand and maintain.
 Failure to validate input data, leading to potential security vulnerabilities.
 Hardcoding values instead of using constants or configuration files.
 Ignoring code style conventions, making the codebase inconsistent and harder to read.
 Neglecting to handle edge cases and unexpected scenarios.
 Not using version control, resulting in difficulties in tracking changes and collaborating with
others.
 Overcomplicating solutions instead of keeping the code simple and maintainable.
PROMPT
ENGINEERING
Thanks to our sponsors
WHAT IS A PROMPT
CHATGPT
A prompt, sometimes referred to as context, is the text provided to a model before it begins
generating output. It guides the model to explore a particular area of what it has learned so that the
output is relevant to your goals.
Prompts are the secret sauce of chat agents
MORE DETAILED PROMPTS
CHATGPT
Responses are only as detailed as
focused as the question that is asked.
You can see we explain to the bot the
various roles we get a more concise
answer:
 Give the bot a role
 Give some context on the user
 Give some dynamic data we want
the bot to have access to
 and then guidance on how the bot
should respond.
CHAT GPT IS EXCEPTIONALLY
GOOD AT UNDERSTANDING
MARKDOWN & JSON
GIVING CHATGPT JSON AND ASKING QUESTIONS
CHATGPT
CRAFTING YOUR OWN PROMPTS
CHATGPT
if you were helping a user book
a trip, you could:
 Ask the user their dates and
destination.
 Behind the scenes, search for
flights and hotels.
 Embed the flight and hotel
search results in the hidden
context.
 Also embed the companys
travel policy in the hidden
context.
CONTEXT PROMPTING https://prompts.chat/
CHATGPT
ONE SHOT PROMPTING
CHATGPT
These types of prompts provide the AI model with one example of what you expect the output
to be. The basic steps are:
Give a quick explanation of what you need,
add a question-answer pair or a template as an example
FEW SHOT PROMPTING
CHATGPT
Large language models are
few-shot learners, meaning that
they can learn a new task by
being provided just a few
examples.
The basic steps are:
Give a quick explanation of
what you need,
add a few question-answer
pairs or templates as an
example.
FEW SHOT PROMPTING
CHATGPT
Large language models are
few-shot learners, meaning that
they can learn a new task by
being provided just a few
examples.
The basic steps are:
Give a quick explanation of
what you need,
add a few question-answer
pairs or templates as an
example.
CHAIN OF THOUGHT PROMPTING
CHATGPT
AUGMENTING
LARGE LANGUAGE
MODELS
Thanks to our sponsors
EXPANDING LLM FUNCTIONALITY
CHATGPT
PROMPT TEMPLATES
CHATGPT
DOCUMENT LOADERS
CHATGPT
VECTOR DATABASES
CHATGPT
Full-text search VS Semantic search
AGENTS
CHATGPT
Build your own chat that
pulls in other services
attach calculator tool for
questions regarding
calculations
TOOLS/UTILS
CHATGPT https://muze.one/
https://www.dailybot.com/
CHATGPT
THANK YOU

More Related Content

ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf

  • 2. SCOTT STEINBECK SPEAKER AT ITB2023 Software Engineer 15+ Year of experience Father Hardware Tinkerer Coding on my free time Overcommitting myself Automating everything IOT Development Teaching Coding/Electronics Contributing to open source Hobbies
  • 3. BREIF HISTORY Thanks to our sponsors
  • 4. Traditional language models (e.g., n-gram models) had limitations: Explosion of state space (curse of dimensionality) and sparsity led to inconsistent output resembling gibberish. Inability to handle novel phrases and lack of coherence in the generated text. Pre-2000's:
  • 5. Advancements in training neural networks by Geo鍖rey Hinton: Deep neural networks alleviated some language model problems. Nuanced arbitrary concepts were represented in a 鍖nite space, but output lacked coherence relative to the input sequence. Mid-2000's:
  • 6. Rise of Long Short-Term Memory (LSTM) networks: LSTMs enabled processing of arbitrary length sequences. Dynamic alteration of internal state improved language model performance signi鍖cantly. Early-2010's:
  • 7. Introduction of Transformer Networks with the "Attention Is All You Need" paper by Google: Transformers revolutionized natural language processing, achieving tasks like language translation at human-level or better. Attention mechanisms and parallel processing allowed the model to analyze the entire input simultaneously. Late-2010's:
  • 8. Emergence of Generative Pre-Trained (GPT) models, notably GPT-3: Large language models could be trained on massive data without speci鍖c agendas. Fine-tuning for speci鍖c tasks led to state-of-the-art results via text interaction. 2020's 1 petabyte of training data
  • 9. DIGGING IN Thanks to our sponsors
  • 10. AI UNDER THE HOOD AI, or Artificial Intelligence, is a broad field that encompasses the development of intelligent systems capable of performing tasks that typically require human intelligence. This works by combining rule-based modeling of human languagewith statistical, machine learning, and deep learning models
  • 11. Natural Language Processing Tasks Natural Language Understanding (NLU) deals with the ability of computers to understand human language. Natural Language Generation (NLG) data to text - text is generated to explain or describe a structured record or unstructured perceptual input; text to text - typically involves fusing information from multiple linguistic sources into a single coherent summary; dialogue - text is generated as part of an interactive conversation with one or more human participants.
  • 12. Machine Learning ML techniques play a key role in AI by enabling systems to automatically learn from experience, adapt to new data, and improve their performance over time. ML algorithms are used in various AI applications, including computer vision, speech recognition, recommendation systems, and, importantly, NLP tasks. Machine Learning to Play Hill Climb Racing
  • 13. Deep Learning DL has revolutionized ML by enabling models to automatically learn more abstract and nuanced features from raw data. DL help NLP to understand natural language, enabling them to capture contextual dependencies and learn complex representations. Deep Learning to car attribute classification
  • 14. WHAT IS AN LLM Practical AI A large language model is a prediction engine that takes a sequence of words and tries to predict the most likely sequence to come after that sequence. It does this by assigning a probability to likely next sequences and then samples from those to choose one. The process repeats until some stopping criteria is met. APPLICATIONS AND INFRASTRUCTURE USING ARTIFICIAL INTELLIGENCE TODAY
  • 15. HOW AI LEARNS NEW ABILITIES Practical AI As LLMs are scaled they hit a series of critical scales at which new abilities are suddenly unlocked. LLMs are not directly trained to have these abilities, and they appear in rapid and unpredictable ways as if emerging out of thin air.
  • 16. Applications of Large Language Models Practical AI
  • 17. ASKING AI A QUESTION Thanks to our sponsors
  • 18. TOKENIZATION CHATGPT What are some common mistakes to avoid when writing code? Tokens can be words, subwords, or characters, depending on the specific tokenization scheme used.
  • 19. INPUT ANALYSIS CHATGPT 1. Informational Questions: "What is the capital of France?" "Can you explain the concept of relativity?" 2. Procedural Questions: "What are the steps to install a software program?" 3. Comparison Questions: "Compare the advantages of iOS and Android." 4. Opinion Questions: Do you think technology is making us more connected or disconnected?" 5. Problem-Solving Questions: "How can I optimize my website's loading speed?" 6. Request for Advice: "Which programming language should I learn as a beginner?" 7. Request for Explanation: "What is the significance of the Pythagorean theorem?" What are some common mistakes to avoid when writing code?
  • 20. Understanding the Question CHATGPT 1. Neural Networks turn tokens into dense vectors (word embeddings) This adds context and captures complex relationships between words What are some common mistakes to avoid when writing code? Vectors with shorter distances between them usually share common contexts in the corpus. This allows us to find distances between words |cat - dog| = 1.20 |cat - cow| = 1.48 "cat" is closer to "dog" than it is to the "cow". Monday Vector What Vector
  • 21. Retrieval/Integration of Knowledge CHATGPT _ _ _ _ mistakes _ avoid _ writing code?
  • 22. Generating the Answer CHATGPT _ _ _ _ mistakes _ avoid _ writing code? Common mistakes to avoid when writing code include: Poor code organization and lack of proper indentation. Inefficient algorithms or data structures that result in slow performance. Lack of proper error handling and exception management. Insufficient comments and documentation, making the code difficult to understand and maintain. Failure to validate input data, leading to potential security vulnerabilities. Hardcoding values instead of using constants or configuration files. Ignoring code style conventions, making the codebase inconsistent and harder to read. Neglecting to handle edge cases and unexpected scenarios. Not using version control, resulting in difficulties in tracking changes and collaborating with others. Overcomplicating solutions instead of keeping the code simple and maintainable.
  • 24. WHAT IS A PROMPT CHATGPT A prompt, sometimes referred to as context, is the text provided to a model before it begins generating output. It guides the model to explore a particular area of what it has learned so that the output is relevant to your goals. Prompts are the secret sauce of chat agents
  • 25. MORE DETAILED PROMPTS CHATGPT Responses are only as detailed as focused as the question that is asked. You can see we explain to the bot the various roles we get a more concise answer: Give the bot a role Give some context on the user Give some dynamic data we want the bot to have access to and then guidance on how the bot should respond. CHAT GPT IS EXCEPTIONALLY GOOD AT UNDERSTANDING MARKDOWN & JSON
  • 26. GIVING CHATGPT JSON AND ASKING QUESTIONS CHATGPT
  • 27. CRAFTING YOUR OWN PROMPTS CHATGPT if you were helping a user book a trip, you could: Ask the user their dates and destination. Behind the scenes, search for flights and hotels. Embed the flight and hotel search results in the hidden context. Also embed the companys travel policy in the hidden context.
  • 29. ONE SHOT PROMPTING CHATGPT These types of prompts provide the AI model with one example of what you expect the output to be. The basic steps are: Give a quick explanation of what you need, add a question-answer pair or a template as an example
  • 30. FEW SHOT PROMPTING CHATGPT Large language models are few-shot learners, meaning that they can learn a new task by being provided just a few examples. The basic steps are: Give a quick explanation of what you need, add a few question-answer pairs or templates as an example.
  • 31. FEW SHOT PROMPTING CHATGPT Large language models are few-shot learners, meaning that they can learn a new task by being provided just a few examples. The basic steps are: Give a quick explanation of what you need, add a few question-answer pairs or templates as an example.
  • 32. CHAIN OF THOUGHT PROMPTING CHATGPT
  • 38. AGENTS CHATGPT Build your own chat that pulls in other services attach calculator tool for questions regarding calculations