Temperature is a parameter that controls the randomness and creativity of AI-generated output. Lower temperatures (0-0.3) produce more focused, deterministic responses ideal for coding, while higher temperatures (0.7-1.0) enable more creative and varied outputs.
Temperature is one of the few AI parameters you can directly control, and it significantly impacts the code you get.
At each step, AI predicts probable next tokens:
| Task | Recommended Temperature |
|---|---|
| Code completion | 0.1 - 0.3 |
| Bug fixes | 0.1 - 0.2 |
| Documentation | 0.3 - 0.5 |
| Brainstorming | 0.7 - 0.9 |
| Creative writing | 0.8 - 1.0 |
Code needs to be:
High temperature introduces randomness that can break these requirements.
Most AI tools have defaults:
If you have control, start low for code and only increase when you want variety.