LeetLLM
LearnFeaturesPricingBlog
Menu
LearnFeaturesPricingBlog
LeetLLM

Your go-to resource for mastering AI & LLM systems.

Product

  • Learn
  • Features
  • Pricing
  • Blog

Legal

  • Terms of Service
  • Privacy Policy

© 2026 LeetLLM. All rights reserved.

Back to Topics
📝HardNLP FundamentalsPREMIUM

Decoding Strategies: Greedy to Nucleus

Master decoding strategies for text generation: compare greedy, beam search, top-k, nucleus (top-p), and min-p sampling, with temperature scaling and repetition penalty.

What you'll master
Greedy decoding as argmax: deterministic but degenerate
Beam search with length penalty: structured tasks only
Temperature scaling: controls distribution sharpness mathematically
Top-k sampling: fixed vocabulary truncation
Top-p (nucleus) sampling: dynamic cumulative probability threshold
Min-p sampling: confidence-scaled threshold, robust at high temperature
Top-p failure at high temperatures (long tail problem)
Repetition and frequency/presence penalties
Production pipeline order: repetition penalty → temperature → truncation
Human text has high perplexity: maximum likelihood is un-human
Hard30 min readIncludes code examples, architecture diagrams, and expert-level follow-up questions.

Premium Content

Unlock the full breakdown with architecture diagrams, model answers, rubric scoring, and follow-up analysis.

Code examplesArchitecture diagramsModel answersScoring rubricCommon pitfallsFollow-up Q&A

Want the Full Breakdown?

Premium includes detailed model answers, architecture diagrams, scoring rubrics, and 66 additional articles.