Skip to main content
QUICK REVIEW

[Paper Review] The Effect of Sampling Temperature on Problem Solving in Large Language Models

Matthew Renze, Erhan Guven|arXiv (Cornell University)|Feb 7, 2024
Natural Language Processing TechniquesComputer Science14 citations
TL;DR

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.

ABSTRACT

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.
Figure 1: Accuracy by temperature and prompt for GPT-3.5 with 1,000 questions. Performance remains relatively stable across all temperatures and prompts. However, there is a non-significant decrease in performance as a function of temperature.
Figure 1: Accuracy by temperature and prompt for GPT-3.5 with 1,000 questions. Performance remains relatively stable across all temperatures and prompts. However, there is a non-significant decrease in performance as a function of temperature.

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.
Figure 2: Accuracy by temperature and model. Performance remains stable across sampling temperatures for all four LLMs on the 100-question MCQA exam. However, both Llama 2 models performed no better than statistically random guesses.
Figure 2: Accuracy by temperature and model. Performance remains stable across sampling temperatures for all four LLMs on the 100-question MCQA exam. However, both Llama 2 models performed no better than statistically random guesses.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.