๐ฌ How Large Language Models Work
The surprisingly simple trick behind ChatGPTโฑ ~2 min
When your phone suggests the next word as you type, that's a tiny language model. An LLM like ChatGPT is the same idea โ predict the next word โ but trained on a huge chunk of the internet and made enormously bigger. That's genuinely most of the secret. It's autocomplete that read a library.
Predict the Next Token, Over and Over
A Large Language Model does one thing: given some text, it predicts the next 'token' (a word or word-piece). It picks one, adds it to the text, and predicts again. Repeat, and coherent paragraphs pour out. The model isn't 'thinking' about your question โ it's computing which token most plausibly comes next, based on patterns in its training data.
The Transformer โ The Breakthrough Architecture
Modern LLMs are built on a neural network design called the Transformer, introduced by Google researchers in 2017 in a paper titled 'Attention Is All You Need.' Its key innovation, 'attention,' lets the model weigh which earlier words matter most for predicting the next one โ so it can track context across long passages. Every major model (GPT, Claude, Gemini, Llama) is a Transformer.
Key Terms for Talking About LLMs
| Term | Meaning |
|---|---|
| Token | A chunk of text the model processes โ roughly ยพ of a word in English |
| Prompt | The text you give the model as input |
| Context window | How much text the model can 'see' at once โ its short-term memory limit |
| Parameters | The model's learned weights โ more (usually) means more capable, and more expensive |
| Temperature | A setting controlling randomness โ low = predictable, high = creative/varied |
| Training vs inference | Training = the (huge) one-time learning; inference = each time you use it |
At its core, what does an LLM like ChatGPT actually do?