A transformer's very last step turns one hidden state into a single next word. Watch the model score every token in its dictionary, squash the scores into probabilities, and pick one — with every knob live to play with.
After the last transformer block, the model holds one vector — the hidden state. The final step scores every token in the dictionary against it.
Raw scores are awkward — some negative, no ceiling, they don't add up to anything. Softmax turns them into clean probabilities.
e to each score, then divide by the total — so every value is positive and they all add up to 100%.Now a single token has to come out. There are two ways to choose from the probabilities.
One token is out. Now the model glues it onto the end of the prompt and runs the whole thing again — and again. Token by token, that loop is how a whole sentence appears. Next: the autoregressive loop.