Introduction GenAI EoAI
Introduction GenAI EoAI
[email protected]
1
Lecture Plan
2
Introduction to Machine
Learning
3
AI Terminology: Artificial Intelligence
• Artificial Intelligence or AI is a subfield of computer
science that enables machines to mimic human
behaviours,
Artificial Intelligence
• It creates intelligent systems that can perform tasks that
typically require human intelligence, such as visual
perception, speech recognition, decision-making, …
• AI Terminology:
• Machine Learning
• Deep Learning
• Reinforcement Learning
• Natural Language Processing
• Generative AI
• …
4
AI Terminology: Machine Learning
5
AI Terminology: Deep Learning
Deep
Learning
6
AI Terminology: Deep Learning
Examples of deep Learning
models:
- Feed Forward Neural Networks
- Convolutional Neural Networks
- Recurrent Neural Networks
- Transformers
- …
7
Machine Learning: Learning Paradigm
3. Reinforcement Learning
8
Supervised Machine Learning
Source
Source
10
Supervised Vs Unsupervised Learning
11
Semi-Supervised Machine Learning
Source
12
Discriminative Vs Generative Machine Learning
1. Discriminative
• Classify or predict
• Usually trained using labeled data
• Learns representation of features for data based on the labels
using conditional probability: 𝑷 𝒄|𝒅
2. Generative
• Generates new data
• focuses on the distribution of a dataset to return a probability for
a given example using Joint Probability.
𝑷 𝒅 ∩ 𝒄 = 𝑷 𝒅|𝒄 . 𝒑 𝒄
13
Discriminative Vs Generative Machine Learning
Source
14
Discriminative Vs Generative Machine Learning
Source
15
Source
16
Reinforcement Learning
18
Artificial Intelligence
Machine Learning
Generative AI is
subset of Deep Deep Learning
Learning
Generative
AI
19
Generative AI (GenAI)
McKinsey defines the Generative AI as:
• Generative AI refers to a branch of AI that focuses on creating or
generating new content, such as images, text, video, synthetic data, or
other forms of media, using machine learning examples.
• It does this by learning patterns from existing data, then using this
knowledge to generate new and unique outputs.
• When given a prompt, GenAI uses this statistical model to predict what
an expected response might be-and this generate new content.
• Image Generation is a process of using deep learning algorithms such as VAEs, GANs, and more
recently Stable Diffusion, to create new images that are visually similar to real-world images.
Image Generation can be used for data augmentation to improve the performance of machine
learning models, as well as in creating art, generating product images, and more.
• Application: Very successful platforms such as MidJourney and DALL-E have become a popular
choice for anyone seeking to generate realistic images through Image Generation techniques.
21
Generative AI
• Video Generation involves deep learning methods such as GANs and Video Diffusion to
generate new videos by predicting frames based on previous frames. Video Generation can be
used in various fields, such as entertainment, sports analysis, and autonomous driving.
• Application: Platforms such as DeepBrain and Synthesia utilize Video and Speech Generation to
create realistic video content, that appears as if a human was speaking on camera.
• Data augmentation is a process of generating new training data by applying various image
transformations such as flipping, cropping, rotating, and color jittering. The goal is to increase the
diversity of training data and avoid overfitting, which can lead to better performance of machine
learning models.
• Application: Synthesis AI simplifies the process of building and optimizing machine learning models
by providing a platform for creating AI models using automated machine learning techniques.
22
Why GenAI Now?
24
Natural Language Processing
• Natural Language Processing (NLP) is a field at
the intersection of:
• Computer Science
Artificial Intelligence
• Artificial Intelligence (ML, DL, GenAI)
• And Linguistics. Machine Learning
26
Why is NLP hard?
• Ambiguity
• Scale
• Variation
• Expressivity
• Unknown representation
27
Ambiguity
Ø Ambiguity at multiple levels:
• Referential ambiguity: Alice invited Maya for dinner but she cooked
her own food (she = Alice or Maya ?)
28
Scale and
Variation
• ~7K languages
• Thousands of language
varieties
• Variation of domains
(news, biomedical,
historical, …)
29
Expressivity
• Not only can one form have different meanings (ambiguity) but the same
meaning can be expressed with different forms:
• She gave the book to Aria vs. She gave Aria the book
• Is that door still open? vs. Please close the door
30
Unknown Representation
• Very difficult to capture what is the representation of the text or speech,
since we don’t even know how to represent the knowledge a human needs:
31
Large Language Models
(LLMs)
32
Large Language Models (LLMs)
Large, general-purpose
language models can be pre- LLMs
trained and then fine-tuned
for specific purposes
33
Large Language Models – Architecture
• Encoder
• Decoder
• Encoder-decoder
https://arxiv.org/abs/1706.03762 34
Timeline of Language Models Evolution: 2018-2023
https://arxiv.org/abs/2304.13712
35
Large Language Models – Characteristic
https://arxiv.org/abs/2304.13712
36
How do Transformer-based LLMs Work?
A simplified version of LLM training process
Je suis étudiant
Input
Output
I am a student
https://www.youtube.com/watch?v=t45S_MwAcOw
37
How do Transformer-based LLMs Work?
A simplified version of LLM training process
https://www.youtube.com/watch?v=t45S_MwAcOw
38
Generative Pre-trained Transformer (GPT) --
Architecture (Decoder-Only)
39
Large Language Models - Training
40
Training a dog
police dog
hunting dog
Source
42
Similar idea applied to Large Language
Models (LLMs)
43
Pre-training or Self-supervised Learning
• Model at the start:
• Zero knowledge about the world
• Can't form English words (doesn’t have language skills)
• Learning objective: Next token prediction
• Giant corpus of text data
• Often scraped from the internet "unlabeled”
• Self-supervised learning
• After training
• Learns language
• Learns knowledge
Source 44
Two Types of Large Language Models (LLMs)
Source 45
How to use LLMs?
46
Why Fine-tuning?
Source
49
What does fine-tuning do for your model?
51
Prompting is revolutionizing AI Application Development
Get
Train AI Deploy
Supervised Learning Labeled
Model the Model
(Fine-Tuning) Data
1 month 3 months 3 months
Specify Deploy
Prompt-based AI prompt the Model
Minutes/Hours Hours/Days
52
WHAT IS PROMPT
ENGINEERING
- Prompt engineering is the practice of
designing and refining specific text
prompts to guide generative AI
models, such as Large Language
Models (LLMs), in generating desired
outputs.
54
Text-to-Text Foundation Models since GPT3
*only LLMs with >1B parameters & EN as the main training language are shown.
*Comprehensive list: https://crfm.stanford.edu/helm/v1.0/?models=1
55
Models Access
All model components are publicly available: Only research paper or blog is available and
• Limited access falls somewhere
• Open source code in between open and closed. may include overview of
• Training data
•Training data
• Sources and their distribution • The access can be via API or •Architecture and training details (including
• Data pre-processing and curation steps through a review process of call infrastructure)
•Model weights for research proposals and then •Evaluation results
•Paper or blog summarizing granting approved proposals •Adaptation to the model
• Architecture and training details limited model access. • Safety filters
• Evaluation results
• Training with human feedback
• Adaptation to the model
• Safety filters
• Training with human feedback
https://crfm.stanford.edu/helm/v1.0/?models=1 56
Text-to-Text Foundation Models since GPT3
* Hugging Face has become the defacto hub for open source ML.
https://crfm.stanford.edu/helm/v1.0/?models=1
57
To recap
58
How LLMs are
Built?
https://arxiv.org/pdf/2402.06196
Web-based vs Software application use of LLMs
60
Benefits of using Large Language Models
1. A single model can be used for different tasks
61
LLM Development vs. Traditional Development
62
Large Language Models – Capabilities
https://arxiv.org/pdf/2402.06196
Some Limitations of LLMs
64
Hallucinations
65
To conclude
66
Source 67
Source 68
Questions Everyone Asks
69
Reading
• https://www.cloudskillsboost.google/journeys/118/course_templates/536
• https://cloud.google.com/ai/generative-ai
• https://smlbook.org/book/sml-book-draft-latest.pdf?fbclid=IwAR2ztL1GkSuhYJHJJeWACwRFEnAtqZshuq6l-S-
0Z6_MHT9o90Qzoy6eMgA
• https://www.simplilearn.com/tutorials/artificial-intelligence-tutorial/what-is-generative-ai
70
Thank You!