05
Large language models

How an LLM Writes

ChatGPT, Claude and Gemini all run the same core loop: predict one token, append it, repeat.

Next-token prediction

The only job

Output a probability for every token in the vocabulary, pick one, go again.

Attention

Context at every step

Each token weighs every other token to work out meaning. The heart of the 2017 Transformer.

Training stages

Pretrain → fine-tune → RLHF

Read trillions of tokens, learn to follow instructions, then learn human preferences.