Flashcard: what does the temperature parameter do during LLM generation and how should you set it?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Temperature scales the next-token logits before softmax; low T sharpens toward the most likely tokens (deterministic), high T flattens the distribution (diverse), and T = 0 forces greedy decoding.
Imagine the model has a big spinner with one slot per possible next word, and the slot sizes are proportional to how likely each word is. Temperature is a knob that warps the spinner. Turning the knob down (low temperature) makes the most likely slot huge and the rest tiny: the spinner almost always lands on the obvious word. Turning the knob up (high temperature) flattens the slots so even unusual words have a real chance of being picked. Turn it all the way to zero and the spinner stops spinning; you just pick the biggest slot every time. Choose low temperature when you want safe, predictable answers like extracting a fact; choose higher temperature when you want creative variety like brainstorming.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: define temperature as the softmax scaler, write the formula, map T values to tasks, distinguish from top-p, and call out the T = 0 determinism caveat.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Setting temperature to 0 and assuming the model is now fully deterministic across runs. Other sources of variance (sampling implementation, distributed inference, ties in logits) can still produce different outputs on identical inputs.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.