Long Horizon Temperature Scaling
Andy Shih, Dorsa Sadigh, Stefano Ermon
TL;DR
Long Horizon Temperature Scaling addresses the limitation that myopic temperature scaling optimizes only the next-token likelihood rather than the joint sequence likelihood. It introduces an amortized, model-agnostic objective that trains a $q_T$ to approximate $p_T(x)$ by minimizing $KL(p_T\|q_T)$ via importance weights dependent on the base model $p$ and the temperature $T$, with variance-reduction via baselines and horizon-limited suffixes. The method applies across diffusion and autoregressive models, enabling a controllable long-horizon temperature with a single finetuned model and achieving improved likelihood-diversity tradeoffs and downstream task gains, including analogy tasks. The approach supports extrapolation to unseen temperatures and provides practical techniques (clipping, streaming statistics, multi-temperature finetuning) to make joint-temperature sampling tractable in real-world settings.
Abstract
Temperature scaling is a popular technique for tuning the sharpness of a model distribution. It is used extensively for sampling likely generations and calibrating model uncertainty, and even features as a controllable parameter to many large language models in deployment. However, autoregressive models rely on myopic temperature scaling that greedily optimizes the next token. To address this, we propose Long Horizon Temperature Scaling (LHTS), a novel approach for sampling from temperature-scaled joint distributions. LHTS is compatible with all likelihood-based models, and optimizes for the long horizon likelihood of samples. We derive a temperature-dependent LHTS objective, and show that finetuning a model on a range of temperatures produces a single model capable of generation with a controllable long horizon temperature parameter. We experiment with LHTS on image diffusion models and character/language autoregressive models, demonstrating advantages over myopic temperature scaling in likelihood and sample quality, and showing improvements in accuracy on a multiple choice analogy task by $10\%$.
