Information-Theoretic Foundations of Online Temperature Sampling
arXiv:2610.15043
Abstract
Repetitive, degenerate generation is a persistent failure of LLM decoding, and the standard remedies (temperature, nucleus, and top- sampling) are static heuristics. By Kac's lemma and the AEP, a stationary source takes time exponential in its entropy to repeat a block. We therefore maximize the entropy of the sampling distributions under one cross-entropy budget that keeps the output plausible under the model. Offline, the solution is temperature sampling, with the inverse temperature as the budget's Lagrange multiplier. \emph{Our contribution is the online problem}: the conditionals are revealed one at a time, and the sampling distribution must be chosen causally from while the budget couples the entire horizon. The optimal temperature is thus a global shadow price that must be estimated from a prefix. We propose Entropic Online Sampling (EOS), which re-solves for the temperature on each prefix. We prove it loses entropy against the offline optimum while overshooting the budget by , with an instance-dependent drift parameter. A budget-tightened variant is exactly feasible at the same rate. Conversely, every exactly feasible online algorithm must lose , so EOS is optimal up to a factor. When the conditionals are drawn from a finite mixture, . Experiments confirm that EOS tracks the offline temperature and beats fixed-temperature sampling in entropy.