Foundations
What is a language model, really?
A language model is a probability machine for sequences, not a database of sentences or a person hiding inside a computer.
Updated
1
Concept
A language model assigns probabilities to sequences of language. That compact definition is more useful than saying it is “an AI that talks,” because it tells us what the system actually computes. Given some context, a causal language model estimates which token is likely to come next. If the context is “The capital of France is”, the distribution may give a large share of probability to “Paris,” smaller shares to punctuation or other city names, and tiny shares to unrelated tokens.
The word token matters. Models do not usually read letters or words exactly as people see them. A tokenizer first converts text into a sequence of discrete IDs. Depending on the tokenizer, one token might represent a whole common word, part of a word, punctuation, or even a byte. The model receives those IDs and transforms them into vectors. We will unpack that process later; for now, treat a token as one selectable unit in the model’s vocabulary.
At one generation step, the model produces one score for every vocabulary item. A mathematical function called softmax turns those scores into a probability distribution whose values add to one. A decoding rule chooses a token from that distribution. The chosen token is appended to the context, and the whole process repeats. A paragraph therefore emerges one decision at a time:
- Encode the current text as tokens.
- Predict probabilities for the next token.
- Select one token.
- Append it and predict again.
This simple training objective has surprising reach because predicting the next token requires sensitivity to many structures at once. Grammar affects which word forms can follow. Topic affects which concepts are relevant. A quotation mark creates an expectation that it may later close. A name introduced several sentences ago can constrain a pronoun now. Factual regularities in the training data can make one completion much more probable than another. The objective is narrow, but the patterns useful for doing it well are broad.
Training and generation are different phases. During training, the model sees many text sequences and adjusts billions of numerical parameters so that observed next tokens receive higher probability. The adjustment is performed by optimization: measure prediction error, compute how each parameter contributed to that error, and nudge the parameters in a direction that tends to reduce future error. During inference, those parameters are fixed. The model applies the learned transformations to a new prompt and generates probabilities.
This is not the same as storing a giant table of prompts and answers. Exact memorization can happen, especially for repeated or distinctive training passages, and it is an important privacy and evaluation concern. But a useful model also generalizes: it can continue combinations of ideas and wording that never appeared verbatim in training. Its learned knowledge is distributed across numerical weights rather than organized as a clean library of source documents. That is why asking “which webpage did this answer come from?” often has no single answer.
The probability view also explains why fluent output is not automatically true. Training rewards predicting text that resembles the data, not consulting reality or proving claims. A false statement can be linguistically likely. A model can reproduce a common misconception, blend incompatible patterns, or confidently continue an incorrect premise. Tools such as retrieval, calculators, code execution, and verification systems can improve reliability, but they add processes around the language model; they do not change its basic next-token operation.
Nor does this definition settle whether a model “understands.” That word carries philosophical and cognitive claims beyond the computation we can observe. We can say precisely that a model builds context-sensitive internal representations and can use them to perform many tasks. We can also say precisely that its outputs are generated from learned statistical structure and may fail in ways a confident human speaker would not. Keeping those two facts together is a better foundation than either mysticism or dismissal.
The key mental model is therefore modest but powerful: a language model is a learned probability engine over token sequences. Conversation, translation, summarization, code generation, and question answering are behaviors constructed through repeated conditional prediction, shaped by the training data, architecture, post-training, prompt, and decoding method.
2
Explain it like I am five
Imagine a musician who has listened carefully to millions of songs but has no filing cabinet of recordings. Give the musician the first few notes of a new melody and they can suggest several plausible next notes. The suggestion comes from patterns learned across music: rhythm, harmony, genre, and what usually resolves a phrase. A language model does the same kind of continuation with tokens. It does not fetch one stored sentence; it assigns scores to many possible continuations and chooses from them.
3
Teach it back
Explain to a curious friend what a language model predicts, and why that is different from looking up a sentence in a database.
Minimum: 80 characters and 15 words. Your text stays only in this browser.
Saved only on this device.
Show a model answer
A language model receives a sequence of tokens and estimates a probability for every token that could come next. Repeating this prediction can produce a passage. Its output is not normally a stored sentence retrieved by an exact key: it is a new continuation assembled from statistical patterns learned during training. The probabilities can reflect grammar, facts, style, and context without implying that the model understands or remembers them as a person would.
4
Check your understanding
Complete the teach-back and answer the quiz correctly to finish this lesson.
Sources
- Yoshua Bengio, Réjean Ducharme, Pascal Vincent, and Christian Jauvin (2003). A Neural Probabilistic Language Model.
- Tom B. Brown et al. (2020). Language Models are Few-Shot Learners.