Temperature Setting Guide
This temperature setting guide shows how temperature moves a model’s answers from focused and repeatable to varied and creative.
Temperature: 0
Deterministic - Most likely output every time
Characteristics:
- Completely deterministic
- Always picks highest probability token
- Reproducible results
- No randomness
Good for:
- Factual responses
- Code generation
- Technical documentation
- Data extraction
Avoid for:
- Creative writing
- Brainstorming
- Diverse solutions
- Natural conversation
Example Output:
Q: What is 2+2? A: 4
Temperature: 0.3
Low Temperature - Focused and consistent
Characteristics:
- Mostly predictable
- Slight variation possible
- High confidence choices
- Minimal creativity
Good for:
- Professional writing
- Summaries
- Analysis
- Structured outputs
Avoid for:
- Story generation
- Poetry
- Humor
- Exploration of ideas
Example Output:
Q: Summarize photosynthesis A: Photosynthesis is the process by which plants convert light energy into chemical energy, using carbon dioxide and water to produce glucose and oxygen.
Temperature: 0.7
Medium Temperature - Balanced creativity
Characteristics:
- Good balance
- Natural variation
- Coherent but creative
- Default for many tasks
Good for:
- General conversation
- Blog posts
- Explanations
- Problem-solving
Avoid for:
- Strict factual queries
- Legal documents
- Precise calculations
- Extreme creativity needs
Example Output:
Q: Explain AI to a child A: Imagine AI is like a really smart robot friend who learns by reading lots of books. The more it reads, the better it gets at answering questions and helping people!
Temperature: 1
High Temperature - Creative and varied
Characteristics:
- High randomness
- Diverse outputs
- Creative responses
- Less predictable
Good for:
- Creative writing
- Brainstorming
- Story ideas
- Marketing copy
Avoid for:
- Factual information
- Technical tasks
- Consistency needs
- Formal documents
Example Output:
Q: Write a story opening A: The clocktower struck thirteen on the night Miranda discovered she could taste colors—purple hummed like jazz on her tongue.
Temperature: 1.5
Very High Temperature - Highly creative
Characteristics:
- Very unpredictable
- Experimental outputs
- May be incoherent
- Maximum diversity
Good for:
- Wild brainstorming
- Surreal content
- Breaking patterns
- Experimental writing
Avoid for:
- Most practical tasks
- Coherent narratives
- Professional use
- Logical reasoning
Example Output:
Q: Describe a dream A: Butterfly keyboards typed moonbeams while my grandmother's teacup sang operatic algorithms to the sleeping WiFi dragons.
Common Temperature Settings
Other Important Parameters
Top-p (Nucleus Sampling)
Limits token selection to a cumulative probability threshold
Top-k
Limits token selection to the k most likely tokens
Frequency Penalty
Reduces repetition of tokens based on their frequency
Presence Penalty
Penalizes tokens that have appeared at all
Best Practices
Start with defaults
Begin with temperature 0.7 and adjust based on results
Test different values
Experiment to find the sweet spot for your use case
Balance parameters
Combine temperature with top-p for fine-tuned control
Consider the task
Match temperature to your specific needs and goals
Understanding Temperature
What is Temperature?
Temperature controls the randomness of predictions by scaling the probabilities of tokens before sampling. It affects how the model chooses the next word or token.
How does temperature work?
Lower temperatures make the model more confident and deterministic, while higher temperatures increase randomness and creativity by flattening the probability distribution.
Which temperature should I use?
The ideal temperature depends on your task. Use lower values for accuracy and consistency, higher values for creativity and variety.