Temperature & Sampling
Understand temperature, top-p, and other settings that control how creative or deterministic AI outputs are.
If you send the exact same prompt twice, you'll often get different responses. This isn't random — it's controlled by sampling parameters, the most important of which is temperature. Understanding these settings lets you control whether the model is creative and varied or focused and consistent.
Temperature is a number between 0 and 2 that controls randomness. At temperature 0, the model always picks the single most likely next token — giving you the most predictable, deterministic output. At higher temperatures, the model is more willing to pick less-likely tokens, producing more creative and varied (but sometimes less accurate) outputs.
Prompt
How temperature affects output:
Temperature 0
Deterministic, focused, repetitive. Best for: factual questions, code, math, data extraction.
Temperature 0.7
Balanced creativity and coherence. Best for: general writing, brainstorming, conversation.
Temperature 1.0+
Highly creative, sometimes unpredictable. Best for: poetry, creative fiction, wild brainstorming.
Top-p is another way to control randomness. Instead of adjusting the probability distribution like temperature, top-p sets a threshold: the model only considers tokens whose cumulative probability adds up to the top-p value. A top-p of 0.1 means the model only picks from the top 10% most likely tokens.
- Factual Q&A, data extraction, code: Temperature 0–0.3
- Business writing, summaries, analysis: Temperature 0.3–0.7
- Creative writing, brainstorming, marketing copy: Temperature 0.7–1.0
- Experimental / wild ideas: Temperature 1.0–1.5
Prompt Templates
Brainstorm Divergent Ideas
Encourages high-creativity output even at default temperature.
Generate 10 wildly different ideas for [TOPIC]. Don't self-censor — include unconventional, surprising, and even slightly absurd options. I want breadth and creativity, not safe suggestions. For each idea, add one sentence on why it might actually work.
Precise Factual Answer
Encourages deterministic, factual output through prompt design.
Answer this question with maximum precision: [QUESTION]. Provide only verified facts. If you're not confident in any claim, explicitly say so. No speculation, no hedging, no filler. Just the direct answer with sources of reasoning.
Test Your Knowledge
Knowledge Check
1 / 3
What does a temperature of 0 produce?
Key Takeaways
- ✓Temperature controls randomness: 0 = deterministic, 1+ = creative
- ✓Low temperature for accuracy (code, facts), higher for creativity (writing, brainstorming)
- ✓Top-p is an alternative randomness control — use one or the other, not both
- ✓Chat interfaces hide these settings; APIs expose them directly
- ✓You can influence creativity through prompt wording even without access to temperature settings
Continue Learning
What Are LLMs
A plain-English explanation of large language models and why they behave the way they do.
Tokens & Context Windows
Learn about tokens, context windows, and why they determine what AI can and cannot do.
Understanding Model Capabilities
What AI models can and cannot do, and how to choose the right model for your task.