NEW
Methods for generating sequences from probabilistic models, trading off quality, diversity, coherence, and computational cost.
DESCRIPTION
Decoding strategies determine how tokens are selected from a model’s output distribution during sequence generation. Greedy search chooses the highest-probability token; beam search explores multiple paths to improve coherence. Top-k sampling restricts choices to the k most likely tokens, while nucleus (top-p) sampling selects from a cumulative probability mass. Temperature scales logits to adjust randomness. The choice affects fluency, factuality, repetition, and creativity. Proper tuning balances diversity with faithfulness to inputs, especially in LLMs.
ALTERNATIVE DEFINITIONS
Hugging Face
Common decoding methods include greedy search, beam search, top-k sampling, and nucleus (top-p) sampling, each trading off quality, diversity, and speed.
Catalogs mainstream strategies and emphasizes practical trade-offs.
ArXiv
We show that likelihood-trained language models often degenerate with greedy or beam search, and propose nucleus sampling to better balance quality and diversity.
Highlights pitfalls of deterministic decoding and introduces nucleus sampling.
RELATED TERMS
Top-k Sampling Nucleus Sampling Temperature Language Model Tokenization Perplexity Sampling Diversity Penalty
COMPETING TERMS
RELATIONS
- Narrower: Best-of-N Sampling
KNOWLEDGE AREAS
TARGET AUDIENCE
AI Engineer Data Scientist MLOps Engineer AI Product Manager
EXTERNAL SOURCES
- Wikipedia - Beam search
- Hugging Face - LLM text generation guide
- ArXiv - Nucleus sampling paper
- Papers with Code - Methods and benchmarks
TOP QUESTIONS
Why do Decoding Strategies matter for LLMs?
They shape fluency, creativity, and faithfulness. Choosing the right strategy avoids repetition or nonsense and aligns outputs with task requirements.
Category: Relevancy
What is a hot topic around Decoding Strategies?
Self-consistency and reranking improve reasoning and factuality by sampling multiple chains and selecting better answers.
Category: Topic
When should I use greedy versus beam search for Decoding Strategies?
Greedy is fast but can be myopic. Beam search improves coherence at higher compute cost; use it for structured tasks.
Category: Opinion
How does temperature affect Decoding Strategies?
Temperature scales logits to adjust randomness. Lower values produce deterministic outputs; higher values increase diversity.
Category: Requirements
What are common mistakes with Decoding Strategies?
Using high temperature with small context windows or high top-k can cause incoherent outputs. Not tuning per task leads to poor results.
Category: Mistakes
What risks come with sampling-based Decoding Strategies?
They may increase hallucinations or inconsistencies. Applying constraints or reranking mitigates risks.
Category: Risks
What alternatives compete within Decoding Strategies?
Greedy and beam search are deterministic, while top-k and nucleus sampling are stochastic alternatives prioritizing diversity.
Category: Alternatives
How do I apply Decoding Strategies practically?
Start with nucleus sampling and moderate temperature for creative tasks; use beam search for structured generation like summaries or programs.
Category: Example
Where can I learn more about Decoding Strategies?
Read Hugging Face generation docs and the nucleus sampling paper. Experiment with metrics like repetition and perplexity.
Category: Requirements