Generative A.I.
with Large Language Models
jonkrohn.com/talks
github.com/jonkrohn
Jon Krohn, Ph.D.
Co-Founder & Chief Data Scientist
March 21st, 2024
Click to edit Master title style
Generative A.I.
with Large Language Models
Slides: jonkrohn.com/talks
Code: github.com/jonkrohn
Stay in Touch:
jonkrohn.com to sign up for email newsletter
linkedin.com/in/jonkrohn
jonkrohn.com/youtube
twitter.com/JonKrohnLearns
Generative A.I. with LLMs and RLHF
Click to edit Master title style
Generative A.I. with LLMs and RLHF
Click to edit Master title style
Brief History of NLP
Human tech-era analogy inspired by Rongyao Huang:
Click to edit Master title style
Transformer (Vaswani et al., 2017)
Click to edit Master title style
Transformer in a Nutshell
Vaswani et al. (2017; Google Brain) was NMT
Hello world!
Bonjour le monde!
Great resources:
Click to edit Master title style
Subword Tokenization
Token: in NLP, basic unit of text
Code: NLP-with-LLMs/code/GPT.ipynb
Click to edit Master title style
Language Models
Autoregressive Models
Predict future token, e.g.:
The joke was funny. She couldn’t stop ___.
NL generation (NLG)
E.g.: GPT architectures
Autoencoding Models
Predict token based on past and future context, e.g.,:
He ate the entire ___ of pizza.
NL understanding (NLU)
E.g.: BERT architectures
Click to edit Master title style
Large Language Models
Click to edit Master title style
ELMo (Peters et al., 2018)
Click to edit Master title style
BERT (Devlin et al., 2018)
Click to edit Master title style
T5 (Raffel et al., 2019)
Hands-on
code demo:
T5.ipynb
Click to edit Master title style
OpenAI’s GPT
Etymology:
Click to edit Master title style
The OpenAI GPT Family
*includes RLHF: Reinforcement Learning from Human Feedback
Version | Release Year | Parameters | n Tokens |
GPT | 2018 | 117 m | 1024 |
GPT-2 | 2019 | 1.5 b | 2048 |
GPT-3 | 2020 | 175 b | 4096 |
GPT-3.5* | 2022 | 175 b | 4096 |
GPT-4* | 2023 (Mar) | ? | 8k or 32k |
GPT-4.5* | 2023 (Nov) | ? | 128k |
More on these in the next section…
Click to edit Master title style
Three Major Ways to Use LLMs
Click to edit Master title style
Section Summary
Click to edit Master title style
Generative A.I. with LLMs and RLHF
Click to edit Master title style
LLM Capabilities
Without fine-tuning, pre-trained transformer-based LLMs can, e.g.:
…
Click to edit Master title style
…more, provided by GPT-4:
Click to edit Master title style
LLM Playgrounds
Hands-on
GPT-4.5 turbo demo
Click to edit Master title style
Staggering GPT-Family Progress
Click to edit Master title style
Key Updates with GPT-4
Hands-on
code demo:
GPT4-API.ipynb
Click to edit Master title style
Section Summary
Click to edit Master title style
Generative A.I. with LLMs and RLHF
Click to edit Master title style
Training and Deploying LLMs
In this section:
Click to edit Master title style
Hardware
Click to edit Master title style
🤗 Transformers
Hands-on code demo:
GPyT-code-completion.ipynb
Click to edit Master title style
Efficient Training
Hands-on code demo:
IMDB-GPU-demo.ipynb
Click to edit Master title style
Gradient Accumulation
Source: MosaicML
Click to edit Master title style
Gradient Checkpointing
Model Size (N)
O(√N)
Click to edit Master title style
Automatic Mixed-Precision
Click to edit Master title style
Dynamic Padding & Uniform-Length Batching
Source: Sajjad Ayoubi
Click to edit Master title style
Single-GPU Open-Source “ChatGPT” LLMs
Hands-on skim: Sinan’s “Dolly Lite” NB
Click to edit Master title style
PyTorch Lightning
Hands-on code demo:
Finetune-T5-on-GPU.ipynb
Click to edit Master title style
Multi-GPU Training
Click to edit Master title style
LLM Deployment Options
Lightning makes deployment easy. Options include:
LLMs are, however, shrinking through:
Click to edit Master title style
Monitoring ML Models in Production
Click to edit Master title style
Major LLM Challenges
Click to edit Master title style
Section Summary
Click to edit Master title style
Extended Lecture is on YouTube
Click to edit Master title style
35% off orders:
bit.ly/iTkrohn
(use code KROHN during checkout)
Click to edit Master title style
Stay in Touch
jonkrohn.com to sign up for email newsletter
linkedin.com/in/jonkrohn
youtube.com/c/JonKrohnLearns
twitter.com/JonKrohnLearns