How a language model writes,
one word at a time
The model reads the sentence so far, gives every possible next word a probability, picks one, and repeats. Step through a real example — and drag the temperature to see how creative it gets.
The sentence
Logits
For every word in its vocabulary the model outputs a raw number called a logit — a score, not a percentage. Here are the six highest for the current step.
Softmax
Softmax turns scores into probabilities: p = es/T ÷ Σ es/T. The temperature T divides every score first. Small T sharpens the peak, large T flattens the bars.
Top-k & sampling
In practice, models keep only the top k words, renormalize, and sample one from the distribution — that is the pick you see fly into the sentence.