AppliedAIPrep logoAppliedAI/Prep
🧠 Foundations of LLMs & GenAI
Core

Temperature and Sampling

At each step a model outputs a probability distribution over the next token; how you pick from it is decoding. Temperature reshapes the distribution (low sharpens toward the most likely token, high flattens it), while top-k and top-p (nucleus) truncate the tail before sampling. The choice sets the trade-off between deterministic, focused output and diverse, creative output. Applied-AI interviews probe it because the right decoding settings differ sharply between factual/extraction tasks and creative ones, and because reproducibility depends on them.

a free account unlocks the core curriculum tier · no card
RELATED CONCEPTS
PRACTICE THIS IN REAL QUESTIONS
COMPANIES THAT ASSUME THIS
NEXT IN FOUNDATIONS OF LLMS & GENAIConstrained and Structured Decoding