AI Glossary
Sampling
What is Sampling?
The process of selecting the next token in an LLM's output based on probability distributions. Sampling strategies include greedy (always pick the highest-probability token), top-k, top-p (nucleus), and temperature scaling. The right sampling strategy depends on the use case — high temperature for creative tasks, low temperature for factual or consistent outputs.
Example in practice
An AI product team building a code generation feature would configure low-temperature greedy sampling to ensure deterministic, reproducible code outputs — while a creative writing tool would use nucleus sampling for stylistic variety.
Learn more
See Sampling applied in a professional context through this free course.
Prompt Engineering for Business →