Choose a greedy continuation with given scores
Watch the spaces around tokens and probability values. · 152 words
A language model estimates how plausible each possible next token is after the words already written. A token can be a word, part of a word, or punctuation. For greedy decoding, choose the token with the largest model score. This maximum-score rule is called the argmax choice. The score is local: it predicts only the next token, not whether the entire sentence will sound best after later words are added.
Suppose the context is "The museum cafe is". The model gives four candidate continuations these compatibility scores: open 4.2, closed 3.1, busy 2.4, and full 1.8. Because 4.2 is the largest score, the greedy continuation is "The museum cafe is open." The model does not compare complete endings such as "open tomorrow" with "open." It commits to "open" now. Greedy decoding is easy to check and often produces fluent text, but a slightly lower-scoring token could lead to a better final sentence.
Check your recall
For the museum cafe example, which token does greedy decoding select, and why?
Check your answer
It selects "open" because its score, 4.2, is higher than 3.1, 2.4, and 1.8.
Sources and credits
Original KeyTouch lesson. Background reading · Hugging Face · LLM Course.