New Tool Radar

AI Concepts

How to Set Temperature Low for Factual Tasks

Set temperature to 0 for extraction and classification so the output stays predictable and repeatable.

Schematic with three steps: Set temperature to 0; Run the task twice and compare; Raise only to 0.2 to 0.5 if.

Temperature is a parameter that scales the logits before softmax: a low temperature makes the distribution sharper, so the highest-probability token almost always wins, and a high temperature flattens it, making unlikely tokens more likely. At temperature 0, the model becomes deterministic and usually repeats itself, which is exactly what a factual task wants. For extraction, classification and any task feeding a downstream system, the documented advice is to use temperature 0.

What you need

  • A factual task, such as extraction or classification
  • Access to the temperature setting on your model call
  • A note of what counts as a correct answer

Step 1: Set temperature to 0

Set temperature to 0, which approximates greedy decoding: the model always picks the highest-probability token. That is the starting point for any task where the answer must be the same every time.

Step 2: Run the task twice and compare

Run the same input twice and compare the outputs. They should match; if they do not, check whether another setting, such as top-p, is adding randomness.

Step 3: Raise only to 0.2 to 0.5 if the output is too rigid

If the output is correct but too rigid, raise the temperature a little, into the 0.2 to 0.5 range that is common for tasks that need accuracy. Stop as soon as the answers start to vary.

Worked example: synthetic temperature test on extraction

The table below is a synthetic example. It shows the expected result of a temperature test; no model was run.

Temperature Run 1 Run 2
0 Refund: 30 days Refund: 30 days – identical
0.3 Refund: 30 days Refund: 30 days – identical
1.0 Refund: 30 days Refund: about a month – varies

Expected result (UNTESTED). temperature 0 and 0.3 give identical answers on both runs, while temperature 1.0 varies the wording. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Temperature 0 approximates greedy decoding; in practice the same prompt can still vary across runs on some providers.
  • A value around 0.2 to 0.5 is common for tasks that need accuracy; 0.7 to 1.0 is common for creative writing.
  • Temperature is not a truth setting; a low temperature makes a wrong answer repeatable, not right.
  • For extraction, classification and any task feeding a downstream system, use temperature 0.

Sources

See all