Greedy decoding
LLM sampling strategy: always pick the token with the highest probability. Equivalent to temperature=0 + top_k=1. Deterministic; shortest path from prompt to answer. Standard for factual or code-generation tasks.
Trade-off: greedy is "locally optimal" but can miss globally better sequences — in the middle of a sentence picking a common token can lower probability for subsequent tokens. Beam search alternative: keep top-N candidates in parallel, expand all, keep best total prob. Better quality, 3-5x more expensive compute. Sampling with temperature>0 gives more variance + diversity (for creative writing). Modern LLM output is often a mix: greedy for code blocks, sampling for "introduction" and "explanation" text. JSON mode combines greedy with grammar constraint.