0% found this document useful (0 votes)
30 views69 pages

Introduction GenAI EoAI

The document provides an introduction to Generative AI, covering its definition, applications, and the underlying technologies such as machine learning and natural language processing. It discusses the architecture and training processes of large language models (LLMs), including their capabilities and limitations. The content also highlights the significance of prompt engineering and the advancements in AI that have made Generative AI more accessible and effective.

Uploaded by

syed.shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views69 pages

Introduction GenAI EoAI

The document provides an introduction to Generative AI, covering its definition, applications, and the underlying technologies such as machine learning and natural language processing. It discusses the architecture and training processes of large language models (LLMs), including their capabilities and limitations. The content also highlights the significance of prompt engineering and the advancements in AI that have made Generative AI more accessible and effective.

Uploaded by

syed.shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

Introduction to Generative AI

SALIMA LAMSIYAH, UNIVERSITY OF LUXEMBOURG

[email protected]
1
Lecture Plan

1. Introduction to Machine Learning


2. Generative AI Definition
3. Introduction to Natural Language Processing
4. Large Language Models
• Architecture
• Training Process
• Usage
• Capabilties
• Limitations

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

[Authur Samuel 1959]: Machine learning is a subfield of


Artificial Intelligence that gives Computers the Ability to Artificial Intelligence
Learn from Data, without being explicitly programmed.
Machine Learning
Machine Learning algorithms construct predictive models
by learning from a large number of training examples.

By using machine learning, the computer can learn to


recognize patterns and make decisions based on data,
without requiring explicit programming instructions for
every possible scenario.

5
AI Terminology: Deep Learning

Deep learning (DL) is a subfield of ML that uses Artificial Intelligence


Artificial Neural Networks to learn complex
patterns from data.
Machine 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

1. Supervised Machine Learning

2. Unsupervised Machine Learning

3. Semi-Supervised Machine Learning

3. Reinforcement Learning

4. Self-Supervised Machine Learning

8
Supervised Machine Learning

Source

• Conventional Machine Learning (Linear Regression, Logistic Regression, Support


Vector Machines, Decision Trees, Naïve Bayes, …)
• Deep Learning models (e.g., Feed-Forward NNs, Recurrent NNs, Convolutional NNs,
…) 9
Unsupervised Machine Learning

Source

• Clustering algorithms (e.g., k-means clustering, hierarchical clustering),


• Deep Learning models (e.g., autoencoders, variational autoencoders, generative
adversarial networks).

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

• Examples of RL applications include:


• Game playing: Chess, Go, Atari, Tic-Tac-Toes games
• Robotics, Autonomous vehicles, …
17
Generative AI Definition

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.

• The process of learning from existing content is called training and


results in the creation of a statistical model.

• When given a prompt, GenAI uses this statistical model to predict what
an expected response might be-and this generate new content.

• Recent breakthroughs in the field, such as GPT (Generative Pre-trained


Transformer) and Midjourney, have significantly advanced the
capabilities of GenAI.
Source
20
Generative AI
• Text Generation involves using machine learning models to generate new text based on patterns
learned from existing text data. The models used for text generation can be Markov Chains,
Recurrent Neural Networks (RNNs), and more recently, Transformers, which have
revolutionized the field due to their extended attention span. Text generation has numerous
applications in the realm of natural language processing, chatbots, and content creation.
• Application: ChatGPT, developed by OpenAI, is a successful platform that uses Text Generation to
generate human-like responses in chat conversations.

• 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?

• Availability of large • Advancements in • Generative Adversarial


and diverse datasets hardware; GPUs Networks (GANs)
• AI models learn • Access to cloud • Transformers
patters, correlations, computing Architecture
and characteristics of • Open-source software, • Reinforcement
large datasets Hugging Face Learning from human
• Pre-trained state-of- feedback (RLHF)
the-art models
23
Introduction to Natural
Language Processing

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

• Goal: for computers to process or “Understand” Deep


natural language in order to perform tasks: Learning
• Translation, Question Answering, Siri, Google
Assistant, … Generative Natural
AI Language
• Fully understanding and representating the Processing
meaning of a language is a difficult goal.
• Perfect language understanding is AI-complete
(AI-hard) 25
Why NLP is hard

• Language consists of many levels of


linguistic knowledge.

• Humans fluently integrate all of


these to produce and understand
language

• Ideally, so would a computer!

26
Why is NLP hard?

• Ambiguity
• Scale
• Variation
• Expressivity
• Unknown representation

27
Ambiguity
Ø Ambiguity at multiple levels:

• Lexical Ambiguity: The fisherman go the bank (finance or river?)

• Syntactic ambiguity: I can see a man with a telescop

• Semantic ambiguity: I gave a present to the children or The chicken is


ready to eat

• 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:

• What is the “meaning” of a word or sentence?


• How to model context?
• Other general knowledge?

31
Large Language Models
(LLMs)

32
Large Language Models (LLMs)

Large Language Models is Deep Learning


subset of Generative AI
Generative AI

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

1. Pretraining using Self-supervised learning

2. Supervised fine-tuning (Instruction Tuning)

3. Reinforcement learning from human feedback (Alignment


with human values)
• nudging the LLM towards values you desire

40
Training a dog

A good canine citizen


Source 41
Training a dog for Special Services

police dog

+ special trainings guide 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?

1. Fine-Tuning the LLMs (Supervised Learning)

2. LLMs Prompt Engineering

46
Why Fine-tuning?

Source
49
What does fine-tuning do for your model?

• Steers the model to more consistent outputs


• Reduces hallucinations
50
• Customizes the model to a specific use case
How to use LLMs?

1. Fine-Tuning the LLMs

2. LLMs Prompt Engineering

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.

- It involves crafting clear and specific


instructions and allowing the model
sufficient time to process information.

"Prompt engineering is more about communicating than


Picture generated by DALLE-3
coding."
53
Prompting Techniques

• Many advanced prompting techniques have been designed to improve performance on


complex tasks
1. In-Context Learning (ICL)
2. Chain-of-thought (CoT) prompting
3. Self-Consistency
4. Knowledge Generation Prompting
5. ReAct
6. …

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

2. The fine-tuning process requires minimal field data (Transfer Learning,


Domain Adaptation)

3. The performance is continuously growing with more data and parameters

61
LLM Development vs. Traditional Development

62
Large Language Models – Capabilities

https://arxiv.org/pdf/2402.06196
Some Limitations of LLMs

• They sometimes write plausible-sounding but incorrect or nonsensical


answers
• Lack of common sense
• Inability to handle complex tasks
• Limited knowledge base
• Lack of emotional intelligence
• Biases in the training data

64
Hallucinations

Hallucination are words or


phrases that are generated by
the model that are often
nonsensical or grammatically
incorrect.

65
To conclude

66
Source 67
Source 68
Questions Everyone Asks

How Exactly can


Is Generative AI How can I use
I use Generative
a threat of an my data securely
AI to gain a
opportunity for with Generative
competitive
my business? AI?
advantage?

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

• GenAI studio: https://cloud.google.com/generative-ai-studio?hl=fr

• Survey on Large Language Models https://arxiv.org/pdf/2303.18223.pdf

70
Thank You!

You might also like