What it is
A language model does not write a whole answer at once. It produces one token at a time, and at each step it scores every possible next token. A decoding method is the rule for choosing among those scores. Greedy decoding uses the simplest rule: take the highest-scoring token, every time.
How it works
Say a model has read "The capital of France is". It assigns the highest probability to " Paris", so greedy decoding writes " Paris", adds it to the text, and repeats the process for the next token. It never looks ahead and never reconsiders.
Because there is no randomness, the same prompt gives the same answer each time, provided the model and software are the same. Small numerical differences in hardware can still cause rare variation.
Greedy versus sampling
Most chat products do not decode greedily. They sample, which means they sometimes pick a lower-ranked token so answers feel more natural and varied. Two settings control this:
- Temperature reshapes the probabilities. Setting it to zero is, in practice, close to greedy decoding.
- Top-p sampling limits the choice to a pool of the most likely tokens.
Greedy decoding is the extreme case where the pool holds exactly one token.
Strengths and weaknesses
Greedy decoding is fast, simple and repeatable, which makes it useful for tests, structured output and anything where you need the same result twice. It also makes results easier to verify and compare.
The weakness is that the best token now does not guarantee the best answer overall. Greedy output can drift into repetitive loops, and it can miss a better sentence that begins with a slightly less likely word. Creative writing usually suffers.
Why it matters for you
If you need consistent results, such as running an evals suite, set temperature to zero or choose a greedy option when the provider offers one. If you want variety, leave sampling on. Some verification and testing techniques also rely on greedy choices because they are deterministic and therefore checkable.