Lecture 23
Cornell University
INFO 5001 - Fall 2024
November 19, 2024
A language model estimates the probability of a token or sequence of tokens occurring within a longer sequence of tokens.
When I hear rain on my roof, I _______ in my kitchen.
Probability | Token(s) |
---|---|
9.4% | cook soup |
5.2% | warm up a kettle |
3.6% | cower |
2.5% | nap |
2.2% | relax |
More information: Large language models
Context is helpful information before or after the target token.
A transformer is a deep learning model that uses attention to weigh the influence of different parts of the input sequence on each other.
Image credit: Google Developers
Self-attention is a mechanism that allows each position in the input sequence to attend to all positions in the input sequence.
How much does each other token of input affect the interpretation of this token?
Self-attention is learned through the training of the encoder and decoder. These models typically contain hundreds of billions or trillions of parameters (weights).
LLMs are functionally similar to auto-complete mechanisms.
Given the current token, what is the next most likely token?
My dog, Max, knows how to perform many traditional dog tricks.
___ (masked sentence)
Probability | Word(s) |
---|---|
3.1% | For example, he can sit, stay, and roll over. |
2.9% | For example, he knows how to sit, stay, and roll over. |
LLMs trained on enough inputs to generate a wide range of outputs across many domains.
Aka base LLMs or pre-trained LLMs.
LLM | Developer | Inputs | Outputs | Access |
---|---|---|---|---|
GPT | OpenAI | Text, image, data | Text | Proprietary |
DALL·E | OpenAI | Text | Image | Proprietary |
Gemini | Text, image, audio, video | Text, image | Proprietary | |
Gemma | Text | Text | Open | |
Llama | Meta | Text | Text | Open |
Claude | Anthropic | Text, audio, image, data | Text, computer control | Proprietary |
Ministral | Mistral | Text, image | Text | Proprietary/open |
Phi | Microsoft | Text | Text | Open |
BERT | Text | Text | Open |
Use an application programming interface!
ae-20
ae-20
(repo name will be suffixed with your GitHub name).renv::restore()
to install the required packages, open the Quarto document in the repo, and follow along and complete the exercises.