Intro To Large Language Models
Intro To Large Language Models
LLMs
Andrej
Karpath
Large Language Model
(LLM)
MacBook
~140GB file
cat
sat
mat (97%)
on
a
<ASSISTANT>
"Monopsony" refers to a market structure where there is only
one buyer for a particular good or service. In economics, this
term is particularly relevant in the labor market, where a
monopsony employer has significant power over the wages and
working conditions of their employees. The presence of a
monopsony can result in lower wages and reduced employment
opportunities for workers, as the employer has little incentive to
increase wages or provide better working conditions…
~100K
conversations
After finetuning you have an Assistant:
<USER>
Can you help me with this code? It seems like there is a
bug. print(“hello world)
<ASSISTANT>
It looks like you forgot to close the string passed to the
function print. You have to add a closing quote to properly
terminate the string. Here is the corrected function:
print(“hello world”)
Stage 1: Pretraining
1. Download ~10TB of text.
2. Get a3.Compress
cluster of ~6,000
the GPUs.
text into a neural network,
pay
~$2M, wait ~12 days.
4. Obtain base model.
Stage 2: Finetuning
5. Write labeling instructions
6.Hire people (or use scale.ai!), collect 100K
high
quality ideal Q&A responses, and/or comparisons. every
3. Finetune base model on this data, wait ~1 day.
~week 4. Obtain assistant model.
5. Run a lot of evaluations.
6. Deploy.
7. Monitor, collect misbehaviors, go to step 1.
The second kind of label:
comparisons
It is often much easier to compare Answers instead of writing
Answers.
Simple example: it’s much easier to spot a good haiku than it is to generate one:
Labeling
instructions
[InstructGPT paper]
Increasingly, labeling is a human-machine
collaboration…
- LLMs can reference and follow the labeling instructions just as humans can.
- => LLMs can create drafts, for humans to slice together into a final label.
- => LLMs can review and critique labels based on the instructions.
-…
LLM Leaderboard from “Chatbot Arena”
Now about the future…
DALL-E: “Automation”
LLM Scaling Laws
Performance of LLMs is a smooth, well-behaved, predictable function of:
- N, the number of parameters in the network
- D, the amount of text we train on
And the trends do not show signs of “topping out”
[Sparks of Artificial General Intelligence: Early experiments with GPT-4, Bubuck et al.
Demo
2+2= 17 x 24 =
System 2
mat
words
System 2
Like tree search in Chess, but in language.
[Tree of Thoughts: Deliberate Problem Solving with Large Language Models, Yao et al. 2023]
Self-improvement
[Mastering the game of Go with deep neural networks and tree search]
Custom LLMs
GPTs app Create a custom GPT:
store:
Disk LLM
File system RAM Other LLMs
(+embeddings) context
window
Sonoma
14.1 GPT- Claude-2
4
LLM Security
Jailbreak
Universal
Transferable
Suffix
https://twitter.com/goodside/status/17130 5
Prompt injection
[Not what you’ve signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection]
Prompt injection
4. The attacker controls the server and gets the data via the GET request
5. Problem: Google now has a “Content Security Policy” that blocks loading images from arbitrary locations
6. Solution: use “Google Apps Scripts”
7. Use Apps Script to export the data to a Google Doc (that the attacker has access to)
Prompt injection
4. The attacker controls the server and gets the data via the GET request
5. Problem: Google now has a “Content Security Policy” that blocks loading images from arbitrary locations
6. Solution: use “Google Apps Scripts”
7. Use Apps Script to export the data to a Google Doc (that the attacker has access to)
Data poisoning / Backdoor attacks
“Sleeper agent” attack
Jailbreaking
Prompt injection
Backdoors & data poisoning
Adversarial inputs
Insecure output handling
Data extraction & privacy
Data reconstruction
Denial of service
Escalation
Watermarking &
evasion Model theft
…
Software 1.0
tools CPU Ethernet
“classical computer”
Calculator Browser
Python interpreter
Terminal
….
Disk LLM
File system RAM Other LLMs
(+embeddings) context
window