Practiced one out loud? Paste your answer into the free self-check and get a score in 30 seconds
What the interviewer is testing
Whether you understand sampling mechanically and can pick settings for a task, and whether you know the practical caveat that low temperature does not give strict determinism.
Answer framework
- Temperature: divide the logits by T before softmax; low T sharpens the distribution, high T flattens it.
- Top-p (nucleus sampling): sample only from the smallest set of tokens whose cumulative probability reaches p.
- Choosing: low temperature (0 to 0.3) for extraction, classification and code; moderate (around 0.7 to 1.0) for brainstorming and creative text.
- Tune one knob at a time; changing both makes behavior hard to reason about.
- Caveat: even at temperature 0 outputs can differ across runs because of batching and floating-point effects.
Sample answer
Both settings control how the next token is sampled from the model's probability distribution. Temperature rescales the logits before the softmax. With a temperature near zero the most likely token almost always wins, so output is focused and repeatable; with a higher temperature lower-probability tokens get more chance, so output becomes more varied and also more error-prone.
Top-p trims the distribution instead of reshaping it. With top-p of 0.9 the model keeps the smallest group of tokens that together cover 90% of the probability and samples only from those, which cuts off the long tail of unlikely tokens.
In practice I set temperature by task: close to zero for extraction, classification, SQL or code where there is one right answer, and higher for brainstorming or marketing copy. I usually adjust either temperature or top-p, not both. I also do not promise strict determinism at temperature 0, because batching and floating-point differences can still change outputs slightly; if I need exact repeatability I cache results.
Likely follow-ups
Common mistakes
- Saying temperature changes what the model knows; it only changes how it samples.
- Using high temperature for structured output or code.
- Assuming temperature 0 means identical outputs every time.
- Tuning temperature and top-p together without a reason.
The 0 to 1 AI Engineer Interview Playbook covers the answer frameworks, system-design walkthroughs and an 8-week plan.
Get the playbook 40% off with code EARLYBF until Nov 3, 11:59 PM PTEARLYBF: 40% off until Nov 3Smaller start: Score your answers against 50 rubrics, $9. 50 AI engineer questions, one rubric each, PDF on Gumroad.
Interviewing for PM or TPM? See the full PM package, $59 on Gumroad: a resume system, a PM, TPM and PGM interview handbook, a 1:1 cheat sheet and a PM playbook. PM and TPM content, not AI engineer prep.
Related questions
Based on question #8 in the full question bank.