Temperature

What is temperature?

Temperature is a parameter in LLM configuration that controls the randomness or creativity of the model's outputs. A lower temperature (closer to 0) makes responses more deterministic and focused, while a higher temperature increases variability and creativity.

Temperature is one of the key settings developers adjust when configuring LLM behavior for specific use cases. It represents a fundamental tradeoff: reliability versus creativity.

How does temperature affect LLM outputs?

Temperature works like a dial that controls how "surprising" the LLM's responses will be:

Lower temperature (0-0.3) produces more predictable, consistent responses. The model selects the most probable next words, resulting in focused, reliable outputs. This setting works well for tasks requiring accuracy and consistency, such as extracting structured data, answering factual questions, or generating code.

Higher temperature (0.7-1.0) produces more varied, creative responses. The model explores less probable options, resulting in outputs that are more unexpected and diverse. This setting works well for brainstorming, creative writing, or generating multiple perspectives on a problem.

When should teams adjust temperature?

The optimal temperature depends on the task:

Use lower temperature for:
- Coding and technical tasks
- Data extraction and analysis
- Factual question answering
- Tasks requiring consistent formatting

Use higher temperature for:
- Creative content generation
- Brainstorming alternative approaches
- Generating diverse examples
- Exploring unconventional solutions

Teams typically adjust temperature alongside other parameters like system prompts and model selection to fine-tune LLM behavior for their specific application.

Learn more:

Related terms:

← Back to Ai Glossary