cs.LGOct 10, 2026

Information-Theoretic Foundations of Online Temperature Sampling

Authors: Jin Sima, Nikolaos Papagiannis, Ananth Grama, Wojciech Szpankowski

Organizations: Purdue University

Abstract

Repetitive, degenerate generation is a persistent failure of LLM decoding, and the standard remedies (temperature, nucleus, and top-kk 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. Our contribution is the online problem: the conditionals p1,p2,…p_1, p_2, \dots are revealed one at a time, and the sampling distribution qtq_t must be chosen causally from p1,…,ptp_1, \dots, p_t 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 O(Rlog⁡n)O(R\log n) entropy against the offline optimum while overshooting the budget by O(Rlog⁡n)O(R\log n), with RR an instance-dependent drift parameter. A budget-tightened variant is exactly feasible at the same rate. Conversely, every exactly feasible online algorithm must lose Ω(R)Ω(R), so EOS is optimal up to a log⁡n\log n factor. When the conditionals are drawn from a finite mixture, R=O~(n)R=\tilde{O}(\sqrt{n}). Experiments confirm that EOS tracks the offline temperature and beats fixed-temperature sampling in entropy.

Figures & tables

Appendix figures & tables3 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. The Optimal Decoder is Tilted Temperature

    Oct 10, 2026Nikolaos Papagiannis, Ananth Grama, Wojciech SzpankowskiLanguage Model Decoding

  2. Min-kk Sampling: Decoupling Truncation from Temperature Scaling via Relative Logit Dynamics

    Apr 13, 2026Yuanhao Ding, Meimingwei Li, Esteban Garces Arias +3Language Model DecodingAdaptive Inference