Give a language model some words and it produces one thing: a probability for every word that could come next. Here the prompt is "the café was", and the model thinks busy is most likely, then quiet, and so on down a long tail. That chart is the entire output. Everything else is built on top of it.
This toy model simply counted. In its little pile of sentences about the café, "café was" is followed by busy several times, by quiet a few, by full and empty once each. Counts become probabilities. A real model replaces the counting with a network of embeddings and bends, trained by gradient descent, but what comes out is this same object: a distribution over the next word.
To write, the model picks a word from the chart, sticks it on the end of the prompt, and asks the question again with the longer prompt. Word by word, the sentence grows out of a chain of charts. Nothing is planned ahead; each choice only sees the words already on the page.
Before picking, you can reshape the chart. Divide the scores by a *temperature* T. Low T sharpens: the top word takes nearly everything and the model becomes predictable. High T flattens: rare words get a real chance and the model becomes surprising, then incoherent. The model is unchanged; only the dice are loaded differently.
Same prompt, same dice, three temperatures. Cold and the model repeats its safest phrases; warm and it varies; hot and the sentences fall apart, because the flattened chart hands probability to words that never followed that context. There is no right T, only a trade between safe and interesting.
One detail from the real thing. Models do not use words; they use *tokens*, pieces that can be a whole word, part of one, or punctuation. A rare word is spelled out from common pieces, so the vocabulary stays a few tens of thousands long and nothing is ever unknown. The chart is over tokens, and "next word" throughout has really meant "next token".
A *language model* is a next-token distribution, and training it is the loop you already know. Show it real text, look at the chart it produced before the true next token, and nudge every weight so that token's bar would have been taller. Repeat across trillions of tokens. The loss is just how surprised the model was by what actually came next.
Turn the temperature all the way down.
With no randomness, every context maps to one fixed choice. As soon as the text returns to a context it has seen before, it makes the same choice again, and a loop can begin. Greedy decoding is safe word by word and dull, or stuck, sentence by sentence.