What do temperature and top-p control, and how do you set them?
Quick-fire answer from the Awesome Generative AI Guide (MIT)
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Both shape how the next token is sampled from the model's probability distribution. Temperature scales the distribution: low values (0 to 0.3) make output more deterministic and focused, high values increase diversity and risk. Top-p (nucleus sampling) restricts sampling to the smallest set of tokens whose probabilities sum to p, cutting the long tail of unlikely tokens. For extraction, classification, or tool-calling you want low temperature for reliability; for brainstorming or creative copy you raise it. Set one deliberately and leave the other at its default rather than tuning both blindly.
Full worked answer
Both shape how the next token is sampled from the model's probability distribution. Temperature scales the distribution: low values (0 to 0.3) make output more deterministic and focused, high values increase diversity and risk. Top-p (nucleus sampling) restricts sampling to the smallest set of tokens whose probabilities sum to p, cutting the long tail of unlikely tokens. For extraction, classification, or tool-calling you want low temperature for reliability; for brainstorming or creative copy you raise it. Set one deliberately and leave the other at its default rather than tuning both blindly.
Learn more: Foundations topic
What a good answer covers
- Both shape how the next token is sampled from the model's probability distribution
- Temperature scales the distribution
- Top-p (nucleus sampling) restricts sampling to the smallest set of tokens whose probabilities sum to p,…
- For extraction, classification, or tool-calling you want low temperature for reliability; for…
- Set one deliberately and leave the other at its default rather than tuning both blindly
Key terms: Learn more
In the glossary: Temperature · Nucleus sampling (top-p)
Quick-fire answer from the Awesome Generative AI Guide (MIT) · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep