How language models work
A practical mental model of tokens, training, context, and why fluent answers can still be wrong.
A language model is a system that predicts what text is likely to come next. It does this one small piece at a time, using patterns learned from a large training corpus. That simple objective produces surprisingly broad capabilities, but it also explains many of the technology’s limits.
Text becomes tokens
Models do not read words exactly as people do. They process tokens: common pieces of words, punctuation, and other text fragments. A short word may be one token, while an unusual name may be split into several. The model turns these tokens into numbers and processes the relationships between them.
Tokenization matters because context limits, response length, and API billing are usually measured in tokens rather than pages or words.
Training builds a map of patterns
During training, the model repeatedly tries to predict a missing or next token. Each mistake slightly adjusts a large set of numerical parameters. After enough examples, those parameters capture useful regularities: grammar, style, common facts, code structures, and relationships between ideas.
The model does not store a searchable copy of every training document. It learns a compressed statistical representation. This is why it can combine patterns in new ways, and also why recalling a precise fact is less reliable than looking it up in a database.
Context is working memory
When you send a prompt, the model receives a context window containing your instructions, relevant conversation history, and any documents supplied by a tool. It uses that context to produce the next response. Information outside the window is not available unless the application retrieves it again.
Longer context can help, but more text is not automatically better. Relevant, well-organized context usually beats a large dump of loosely related material.
Generation is not verification
The model chooses a plausible continuation based on its training and context. It does not automatically check every claim against a source. A response can be clear, confident, and wrong at the same time.
The useful mental model is: a language model generates candidates; a reliable workflow verifies them. Use tools, sources, tests, and human review whenever an answer has meaningful consequences.