Temperature
Temperature changes the sharpness of a sampling distribution by scaling logits. Lower values concentrate probability; higher values spread it.
Before you start: Review Next token first. Python-like examples use variables, lists and functions.
Follow the mechanism
Scores
Keep the same toy logits.
Start with an everyday explanation
Imagine making a raffle favor the most common answers more strongly or less strongly. Changing the raffle does not check the answers against a source.
See a concrete example
With logits [2,1], the first option has probability about 0.731 at T=1 and 0.881 at T=0.5. Neither number measures factual accuracy.
A claim to question
Cold means less varied sampling, not more truthful output by definition.
Try before revealing the answer
Use the sampling simulator to compare T=0.5 and T=1.5. Explain why a wrong top logit remains a problem.
Show the worked answer
The distribution changes while the underlying evidence does not. Fix missing evidence or model/task fit rather than relying on temperature as a correctness control.
Now explain the idea to someone else using your own example. If you cannot explain a stage, revisit it before moving on.
Engineering details and trade-offs
For positive T, use softmax(logits / T). At low T, score differences grow; temperature zero is often a separate greedy-decoding setting.
Reproducibility also depends on implementation, model version and numerical execution. Low temperature does not remove hallucinations.
Reason through the example
With logits [2,1], the first option has probability about 0.731 at T=1 and 0.881 at T=0.5. Neither number measures factual accuracy.
Implement and test
Use the sampling simulator to compare T=0.5 and T=1.5. Explain why a wrong top logit remains a problem.
Inspect the reasoning and expected result
The distribution changes while the underlying evidence does not. Fix missing evidence or model/task fit rather than relying on temperature as a correctness control.
What to measure
State the expected result before changing a control. Record your inputs, compare the observed result and explain one limit of this model. In a real implementation, test the failure case as well as the normal path.
Answer before reading the reference
When would you use a higher temperature?
A defensible answer
When diverse candidates are useful and independently checked, such as brainstorming. For structured business tasks, evaluate the full decoding configuration and keep deterministic validation after generation.
Prepare the follow-up
What would you log to investigate supposedly identical requests with different outputs?
Show follow-up reasoning
Log the model and version, exact input or privacy-safe digest, decoding configuration, seed where supported, tool results, execution environment and timing. Check changing sources and infrastructure behavior before assuming temperature is the only variable. Do not log secrets or unnecessary personal data.
Use the engineering explanation and worked task above to support your response. Identify which assumptions you would need to verify in production.
Choose a practice depth
- New to GenAI
- Define temperature with the everyday example and name its key limitation.
- Applied experience
- Explain the example, implementation choice and a measured failure case. Use the exercise as a small design review.
- Senior or systems depth
- Answer the follow-up, compare alternatives and justify an evaluation or rollout plan with operational constraints.
Self-review your answer
0/4 checks selected. This is self-assessment, not an interview score.
Your explanation and revision notes
Loading local notes…