Understand AI models
What a language model does
Understand a language model as a system that predicts likely continuations from patterns learned during training.
8 minute lesson
A large language model learns patterns from a huge collection of text, code, and other data. During training, it repeatedly tries to predict missing or next pieces of data. Each mistake slightly adjusts billions of numerical values called parameters.
Training is the expensive learning phase. When you send a prompt later, the model runs inference: it uses those learned parameters to produce a response.
Generation happens one token at a time
The model does not retrieve one complete answer from a database. It calculates which token could plausibly come next. After choosing a token, it adds that token to the sequence and predicts again.
Suppose the prompt ends with:
The capital of Italy is
The model will give a high probability to Rome. After producing Rome, it predicts what could follow that word. The same mechanism continues until the response ends.
A coding answer works the same way. The model predicts a likely function name, then a parameter, then the next symbol. It can produce a coherent program because it learned many relationships between code, documentation, errors, and explanations.
Prediction is more powerful than it sounds
Next-token prediction is not autocomplete with a larger dictionary. To predict well, a model needs useful internal representations of language, code, structure, and relationships. Those representations let it combine patterns in ways that were not copied from one source.
But prediction still has an important consequence: the model produces what fits the context, not what it has independently proved. A false package name can fit a programming answer. An invented quote can fit an article. The sentence can sound right while the claim is wrong.
Your prompt changes the probabilities
When you add an example, a constraint, or a file, you change the context used for every next-token prediction. This is why a precise prompt and relevant context can improve the result without changing the model itself.
It also explains why the same prompt can produce different answers. Several next tokens may be plausible. A different early choice changes the sequence that follows.
The model has no direct access to your intention, the current state of your project, or the outside world unless that information is in its training, your context, or a tool result.
Lesson completed