liveBook · Manning

Greedy algorithm

As explained in Effective Conversational AI

Greedy decoding is a language-generation strategy that selects the highest-scoring next token at each step.

When an LLM needs to produce the same response for the same input, greedy decoding offers a simple rule: choose the most probable next token at each step. The resulting output is repeatable rather than randomized. section 7.2.1 section 12.3

This is useful when generating candidate phrases for chatbot intent data or summaries that should stay consistent. Sampling decoding instead produces randomized responses, which can help when exploring a variety of outputs. section 7.4 section 12.3

Generating chatbot phrases

For a chatbot helping someone who forgot a password, an LLM can generate phrases such as “I lost my password” and “I cannot remember my password.” Greedy decoding makes the output repeatable for the same prompt. section 7.2.1

How Effective Conversational AI covers it

How deep it goes
Defines next-token selection as choosing the most probable word and notes repeatability, without detailing decoding internals.
Examples
Illustrates password-phrase generation, repeatable conversation summaries, and recipe-response debugging.
What you can do after
Operate generation with greedy decoding to obtain repeatable outputs for a given input.
How it connects
Connects LLM generation with intent-data augmentation, conversational summarization, and sampling decoding.

Also explained in

Compare how 12 books explain greedy algorithm →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Conversational AI. The section links point to the parts of the book it draws on.