Optimizing Temperature for Language Models with Multi-Sample Inference

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Du, Weihua, Yang, Yiming, Welleck, Sean
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866915345014456320
author Du, Weihua
Yang, Yiming
Welleck, Sean
author_facet Du, Weihua
Yang, Yiming
Welleck, Sean
contents Multi-sample aggregation strategies, such as majority voting and best-of-N sampling, are widely used in contemporary large language models (LLMs) to enhance predictive accuracy across various tasks. A key challenge in this process is temperature selection, which significantly impacts model performance. Existing approaches either rely on a fixed default temperature or require labeled validation data for tuning, which are often scarce and difficult to obtain. This paper addresses the challenge of automatically identifying the (near)-optimal temperature for different LLMs using multi-sample aggregation strategies, without relying on task-specific validation data. We provide a comprehensive analysis of temperature's role in performance optimization, considering variations in model architectures, datasets, task types, model sizes, and predictive accuracy. Furthermore, we propose a novel entropy-based metric for automated temperature optimization, which consistently outperforms fixed-temperature baselines. Additionally, we incorporate a stochastic process model to enhance interpretability, offering deeper insights into the relationship between temperature and model performance.
format Preprint
id arxiv_https___arxiv_org_abs_2502_05234
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Optimizing Temperature for Language Models with Multi-Sample Inference
Du, Weihua
Yang, Yiming
Welleck, Sean
Machine Learning
Artificial Intelligence
Computation and Language
Multi-sample aggregation strategies, such as majority voting and best-of-N sampling, are widely used in contemporary large language models (LLMs) to enhance predictive accuracy across various tasks. A key challenge in this process is temperature selection, which significantly impacts model performance. Existing approaches either rely on a fixed default temperature or require labeled validation data for tuning, which are often scarce and difficult to obtain. This paper addresses the challenge of automatically identifying the (near)-optimal temperature for different LLMs using multi-sample aggregation strategies, without relying on task-specific validation data. We provide a comprehensive analysis of temperature's role in performance optimization, considering variations in model architectures, datasets, task types, model sizes, and predictive accuracy. Furthermore, we propose a novel entropy-based metric for automated temperature optimization, which consistently outperforms fixed-temperature baselines. Additionally, we incorporate a stochastic process model to enhance interpretability, offering deeper insights into the relationship between temperature and model performance.
title Optimizing Temperature for Language Models with Multi-Sample Inference
topic Machine Learning
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2502.05234