The Model Builds a Distribution; the Decoder Chooses a Token
A language model processes the current context with a neural network and produces a logit for each vocabulary token. Softmax converts those logits into a conditional next-token distribution, and a decoding algorithm chooses a token to append.
- Run the context through the network to compute next-token logits.
- Optionally apply temperature, repetition penalties, and candidate restrictions such as top-k or top-p.
- Choose a token using greedy argmax, sampling, beam search, or another task-appropriate rule.
- Append the token to the context and run the model again.
This is the outer generation loop, not a complete explanation of inference, tool use, reasoning, or learned representations. The network computation creates the distribution; the decoder makes the final local choice.
Controls on the Distribution
- Temperature divides logits by . Values below 1 sharpen the distribution; values above 1 flatten it. Temperature 0 is normally handled as a separate greedy-selection path.
- Top-k keeps the k highest-scoring candidates and renormalizes.
- Top-p keeps the smallest highest-probability set whose cumulative probability reaches p, then renormalizes.
These controls change logits or restrict candidates, affecting diversity and stability. They do not define an entire personality. System instructions, context, model training, routing, and tool results also shape a reply.
Closing the Track
Probability is a grammar for uncertainty. It connects representative sampling, the distinction between probability and likelihood, Bayesian updating, and next-token decoding. When a system is called stochastic, ask who creates the distribution and which rule makes the selection.