A visual tour · modern language models

How does an LLM work?

From text → attention → the next token.

The whole idea

Predict what comes next

Theskyisblue
blue
72%
clear
18%
falling
4%
Pre-training

Practice on enormous amounts of text

adjust
weights
stories & prose
code </>
articles & facts
conversations
Tokens become numbers

Text enters as vectors

“bank”token
[ .2, −.7, .9, … ]embedding + position
Self-attention

Each token looks for useful context

Idepositedmoneyatthebanktoday
Target word
bankWhat does it mean here?
Useful context
deposited + moneyAttention gives these clues more weight
Contextual meaning
financial bankNot a river bank
The “transform” in transformer

Context transforms the representation

bank
general token
+ context
bank
financial institution, in this sentence
Many transformer blocks

Refine context, layer after layer

token vectors
+ position
attention
what matters?
mix & refine
neural network
repeat × N
richer context
next-token odds
softmax
GPT, in one picture

Three ideas working together

G
Generativeproduce the next token
P
Pre-trainedlearn patterns beforehand
T
Transformermake tokens context-aware