[Paper Review] The Effect of Sampling Temperature on Problem Solving in Large Language Models
The study empirically tests how sampling temperature (0.0 to 1.0) affects LLM problem-solving across models and prompts and finds no statistically significant impact on accuracy for MCQA tasks.
In this research study, we empirically investigate the effect of sampling temperature on the performance of Large Language Models (LLMs) on various problem-solving tasks. We created a multiple-choice question-and-answer (MCQA) exam by randomly sampling problems from standard LLM benchmarks. Then, we used nine popular LLMs with five prompt-engineering techniques to solve the MCQA problems while increasing the sampling temperature from 0.0 to 1.6. Despite anecdotal reports to the contrary, our empirical results indicate that changes in temperature from 0.0 to 1.0 do not have a statistically significant impact on LLM performance for problem-solving tasks. In addition, these results appear to generalize across LLMs, prompt-engineering techniques, and problem domains. All code, data, and supplemental materials are available on GitHub at: https://github.com/matthewrenze/jhu-llm-temperature
Motivation & Objective
- Motivate the need to understand optimal sampling temperature for LLM problem solving.
- Evaluate whether temperature changes influence problem-solving accuracy across multiple domains.
- Compare performance across diverse LLMs and prompt-engineering techniques.
- Provide empirical evidence to inform prompt-engineering best practices and reduce anecdotal claims.
Proposed method
- Construct a multi-domain MCQA exam by sampling problems from standard benchmarks.
- Evaluate four LLMs (GPT-3.5, GPT-4, Llama 2 7B, Llama 2 70B) with five prompt-engineering techniques.
- Vary sampling temperature from 0.0 to 1.0 during inference.
- Measure accuracy as the primary metric and compute several text-similarity metrics.
- Use Kruskal-Wallis tests to assess statistical significance of temperature effects at alpha = 0.05.

Experimental results
Research questions
- RQ1Does increasing or decreasing sampling temperature from 0.0 to 1.0 affect problem-solving accuracy of LLMs on MCQA tasks?
- RQ2Is the temperature effect consistent across different models and prompt-engineering techniques?
- RQ3How does temperature influence output variability as measured by text-similarity metrics?
Key findings
- Mean accuracy remains relatively stable across all temperatures for GPT-3.5 on the 1,000-question exam.
- Kruskal-Wallis tests show no statistically significant differences in accuracy across temperatures for the evaluated prompts and models.
- Higher temperatures increase text variability, as shown by decreasing text-similarity metrics across prompts and domains.
- Some Llama models perform at or near random chance on the 100-question exam, indicating model- or formatting-related limitations.
- Beyond temperature values above 1.0, accuracy declines and can approach random guessing, consistent with increased randomness.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.