# Temperature

> Temperature: A number that divides the logits before softmax: below 1 sharpens the distribution, above 1 flattens it, 0 means greedy.

Canonical: https://llmdojo.dev/glossary/temperature

A number that divides the logits before softmax: below 1 sharpens the distribution, above 1 flattens it, 0 means greedy.

Learn it in the lesson: [Sampling and temperature](https://llmdojo.dev/learn/model-foundations/sampling/temperature) (Model Foundations · Next-Token Prediction and Sampling).

## Interview questions about Temperature

- [Explain temperature, top-k and top-p. Why would you usually reach for top-p rather than a fixed k?](https://llmdojo.dev/interview/q/explain-temperature-top-k-and-top-p-why-would-you-usually-reach)
- [Your integration tests call a hosted model at temperature 0 and compare the output with an exact string. They fail now and then. What's going on, and what do you change?](https://llmdojo.dev/interview/q/your-integration-tests-call-a-hosted-model-at-temperature-0-and-compare)
- [Implement masked cross-entropy in NumPy that stays numerically stable, with label smoothing and a temperature.](https://llmdojo.dev/interview/q/implement-masked-cross-entropy-in-numpy-that-stays-numerically-stable-with-label)
- [Cover the fundamentals: self- versus cross-attention, autoregressive decoding and sampling, where RL fits, and how you evaluate the result.](https://llmdojo.dev/interview/q/cover-the-fundamentals-self-versus-cross-attention-autoregressive-decoding-and-sampling-where)
- [Build a lightweight evaluation harness for a model served through Ollama: run a dataset of prompts, score the answers against references and report the results.](https://llmdojo.dev/interview/q/build-a-lightweight-evaluation-harness-for-a-model-served-through-ollama-run)
- [Your judge gives the same reply different scores on different runs. What do you do?](https://llmdojo.dev/interview/q/your-judge-gives-the-same-reply-different-scores-on-different-runs-what)
- [For an offline audio detection system, outline the ML inference and labeling pipeline: feature extraction, keyword spotting, thresholding, calibration and human labeling.](https://llmdojo.dev/interview/q/for-an-offline-audio-detection-system-outline-the-ml-inference-and-labeling)

## Related
- [Logit](https://llmdojo.dev/glossary/logit)
- [LM head](https://llmdojo.dev/glossary/lm-head)
- [Autoregressive generation](https://llmdojo.dev/glossary/autoregressive)
- [Greedy decoding](https://llmdojo.dev/glossary/greedy-decoding)
- [Top-k](https://llmdojo.dev/glossary/top-k)
- [Top-p (nucleus sampling)](https://llmdojo.dev/glossary/top-p)
- [Seed](https://llmdojo.dev/glossary/seed)
- [Logprob](https://llmdojo.dev/glossary/logprob)
- [Glossary of every term](https://llmdojo.dev/glossary)
