- Open Access
Understanding temperature tuning in energy-based models
Phys. Rev. Research 8, 043137 – Published 6 November, 2026
DOI: https://doi.org/10.1103/g8cm-7ps7
Abstract
Generative models of complex systems often require post hoc parameter adjustments to produce useful outputs. For example, energy-based models for protein design are sampled at an artificially low “temperature” to generate novel, functional sequences. This temperature tuning is a common yet poorly understood heuristic used across machine learning contexts to control the trade-off between generative fidelity and diversity. Here, we develop an interpretable, physically motivated framework to explain this phenomenon. We demonstrate that in systems with a large “energy gap” separating a small fraction of meaningful states from a vast space of unrealistic states, learning from sparse data causes models to systematically overestimate high-energy state probabilities, a bias that lowering the sampling temperature corrects. More generally, we characterize how the optimal sampling temperature depends on the interplay between data size and the system's underlying energy landscape, and that this interplay is sufficient to elicit the tuning phenomenon; regularizing while training can contribute, but is not necessary. Crucially, our results show that lowering the sampling temperature is not always desirable. We identify the conditions under which raising it results in better generative performance. Our framework reveals that post hoc temperature tuning is indicative of both specific properties of the true data distribution and the limits of the learned model due to insufficient data availability.
Physics Subject Headings (PhySH)
Article Text
References (58)
- W. P. Russ, M. Figliuzzi, C. Stocker, P. Barrat-Charlaix, M. Socolich, P. Kast, D. Hilvert, R. Monasson, S. Cocco, M. Weigt, and R. Ranganathan, An evolution-based model for designing chorismate mutase enzymes, Science 369, 440 (2020).
- G. Hinton, O. Vinyals, and J. Dean, Distilling the knowledge in a neural network, arXiv:1503.02531.
- Q. Qi, J. Lyu, K.-S. Chan, E.-W. Bai, and T. Yang, Stochastic constrained DRO with a complexity independent of sample size, Trans. Mach. Learn. Res. 2023, 1 (2023).
- Z.-H. Qiu, Q. Hu, Z. Yuan, D. Zhou, L. Zhang, and T. Yang, Not all semantics are created equal: Contrastive self-supervised learning with automatic temperature individualization, in Proceedings of the 40th International Conference on Machine Learning, ICML’23 (JMLR.org, Honolulu, Hawaii, 2023), Vol. 202, pp. 28389–28421.
- C. Guo, G. Pleiss, Y. Sun, and K. Q. Weinberger, On calibration of modern neural networks, in Proceedings of the 34th International Conference on Machine Learning (PMLR, Sydney, Australia, 2017), pp. 1321–1330.
- F. Wenzel, K. Roth, B. Veeling, J. Swiatkowski, L. Tran, S. Mandt, J. Snoek, T. Salimans, R. Jenatton, and S. Nowozin, How good is the Bayes posterior in deep neural networks really? in Proceedings of the 37th International Conference on Machine Learning (PMLR, 2020), pp. 10248–10259.
- Y. Zhang, Y.-S. Wu, L. A. Ortega, and A. R. Masegosa, The cold posterior effect indicates underfitting, and cold posteriors represent a fully Bayesian method to mitigate it, Trans. Mach. Learn. Res. 2024, 1 (2024).
- E. Zhang, V. Zhu, N. Saphra, A. Kleiman, B. L. Edelman, M. Tambe, S. Kakade, and E. Malach, Transcendence: Generative models can outperform the experts that train them, Adv. Neural Inf. Process. Syst. 37, 86985 (2024).
- H. Ramsauer, B. Schäfl, J. Lehner, P. Seidl, M. Widrich, L. Gruber, M. Holzleitner, T. Adler, D. Kreil, M. K. Kopp, G. Klambauer, J. Brandstetter, and S. Hochreiter, Hopfield networks is all you need, in International Conference on Learning Representations (OpenReview.net, 2021).
- D. Firth, Bias reduction of maximum likelihood estimates, Biometrika 80, 27 (1993).
- M. B. Kloucek, T. Machon, S. Kajimura, C. P. Royall, N. Masuda, and F. Turci, Biases in inverse Ising estimates of near-critical behavior, Phys. Rev. E 108, 014109 (2023).
- B. Bordelon, A. Canatar, and C. Pehlevan, Spectrum dependent learning curves in kernel regression and wide neural networks, in Proceedings of the 37th International Conference on Machine Learning (PMLR, 2020), pp. 1024–1034.
- B. Sorscher, R. Geirhos, S. Shekhar, S. Ganguli, and A. Morcos, Beyond neural scaling laws: Beating power law scaling via data pruning, Adv. Neural Inf. Process. Syst. 35, 19523 (2022).
- Y. Kleeorin, W. P. Russ, O. Rivoire, and R. Ranganathan, Undersampling and the inference of coevolution in proteins, Cell Syst. 14, 210 (2023).
- P. W. Fields, V. Ngampruetikorn, R. Ranganathan, D. J. Schwab, and S. Palmer, Understanding energy-based modeling of proteins via an empirically motivated minimal ground truth model, in 1st Workshop on the Synergy of Scientific and Machine Learning Modeling, ICML 2023 (Honolulu, Hawaii, 2023).
- J. M. Smith, Natural selection and the concept of a protein space, Nature (London) 225, 563 (1970).
- Y. Ishida, Y. Ichikawa, A. Dote, T. Miyazawa, and K. Hukushima, Ratio divergence learning using target energy in restricted Boltzmann machines: Beyond Kullback-Leibler divergence learning, Phys. Rev. E 112, 045306 (2025).
- F. Huszár, How (not) to train your generative model: Scheduled sampling, likelihood, adversary? arXiv:1511.05101.
- P. Mehta, M. Bukov, C.-H. Wang, A. G. R. Day, C. Richardson, C. K. Fisher, and D. J. Schwab, A high-bias, low-variance introduction to machine learning for physicists, Phys. Rep. 810, 1 (2019).
- I. J. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio, Generative adversarial nets, in Advances in Neural Information Processing Systems (Curran Associates, Inc., Red Hook, NY, 2014), Vol. 27.
- C. K. Fisher, A. M. Smith, and J. R. Walsh, Boltzmann encoded adversarial machines, arXiv:1804.08682.
- Strictly, is not required. Temperature tuning is required when (see Appendix pp1-s4 for more details).
- It is worth noting that the reversed is not easily fit with a similar approximation, , as we typically do not have a tractable empirical estimate for this quantity.
- A pseudocount regularization term is introduced to ensure no divergences while fitting (see Appendix pp1 for further details of the sampling and fitting procedure, as well as a discussion on the contributions of regularization to the temperature-tuning effect).
- See Appendix pp3-s2 for more details.
- J. B. Ingraham, M. Baranov, Z. Costello, K. W. Barber, W. Wang, A. Ismail, V. Frappier, D. M. Lord, C. Ng-Thow-Hing, E. R. Van Vlack, et al., Illuminating protein space with a programmable generative model, Nature (London) 623, 1070 (2023).
- A. Madani, B. Krause, E. R. Greene, S. Subramanian, B. P. Mohr, J. M. Holton, J. L. Olmos, C. Xiong, Z. Z. Sun, R. Socher, J. S. Fraser, and N. Naik, Large language models generate functional protein sequences across diverse families, Nat. Biotechnol. 41, 1099 (2023).
- T. Hayes, R. Rao, H. Akin, N. J. Sofroniew, D. Oktay, Z. Lin, R. Verkuil, V. Q. Tran, J. Deaton, M. Wiggert, et al., Simulating 500 million years of evolution with a language model, Science 387, 850 (2025).
- E. T. Jaynes, Information theory and statistical mechanics, Phys. Rev. 106, 620 (1957).
- M. Weigt, R. A. White, H. Szurmant, J. A. Hoch, and T. Hwa, Identification of direct residue contacts in protein-protein interaction by message passing, Proc. Natl. Acad. Sci. USA 106, 67 (2009).
- F. Morcos, A. Pagnani, B. Lunt, A. Bertolino, D. S. Marks, C. Sander, R. Zecchina, J. N. Onuchic, T. Hwa, and M. Weigt, Direct-coupling analysis of residue coevolution captures native contacts across many protein families, Proc. Natl. Acad. Sci. USA 108, E1293 (2011).
- T. Mora, A. M. Walczak, W. Bialek, and C. G. Callan, Maximum entropy models for antibody diversity, Proc. Natl. Acad. Sci. USA 107, 5405 (2010).
- J. Harte, Maximum Entropy and Ecology: A Theory of Abundance, Distribution, and Energetics (Oxford University Press, Oxford, UK, 2011).
- W. Bialek, A. Cavagna, I. Giardina, T. Mora, E. Silvestri, M. Viale, and A. M. Walczak, Statistical mechanics for natural flocks of birds, Proc. Natl. Acad. Sci. USA 109, 4786 (2012).
- T. Mora, A. M. Walczak, L. Del Castello, F. Ginelli, S. Melillo, L. Parisi, M. Viale, A. Cavagna, and I. Giardina, Local equilibrium in bird flocks, Nat. Phys. 12, 1153 (2016).
- T. R. Lezon, J. R. Banavar, M. Cieplak, A. Maritan, and N. V. Fedoroff, Using the principle of entropy maximization to infer genetic interaction networks from gene expression patterns, Proc. Natl. Acad. Sci. USA 103, 19033 (2006).
- J. W. Locasale and A. Wolf-Yadlin, Maximum entropy reconstructions of dynamic signaling networks from quantitative proteomics Data, PLoS One 4, e6522 (2009).
- E. Schneidman, M. J. Berry, R. Segev, and W. Bialek, Weak pairwise correlations imply strongly correlated network states in a neural population, Nature (London) 440, 1007 (2006).
- G. Tkačik, O. Marre, D. Amodei, E. Schneidman, W. Bialek, M. J. Berry, and O. Sporns, Searching for collective behavior in a large network of sensory neurons, PLoS Comput. Biol. 10, e1003408 (2014).
- M. J. Berry II, G. Tkačik, J. Dubuis, O. Marre, and R. A. da Silveira, A simple method for estimating the entropy of neural activity, J. Stat. Mech.: Theory Exp. (2013) P03015.
- C. W. Lynn, Q. Yu, R. Pang, S. E. Palmer, and W. Bialek, Exact minimax entropy models of large-scale neuronal activity, Phys. Rev. E 111, 054411 (2025).
- G. Tkačik, T. Mora, O. Marre, D. Amodei, S. E. Palmer, M. J. Berry II, and W. Bialek, Thermodynamics and signatures of criticality in a network of neurons, Proc. Natl. Acad. Sci. USA 112, 11508 (2015).
- D. P. Kingma and M. Welling, An introduction to variational autoencoders, in Found. Trends Mach. Learn. 12, 307 (2019).
- D. Rezende and S. Mohamed, Variational inference with normalizing flows, in Proceedings of the 32nd International Conference on Machine Learning (PMLR, Lille, France, 2015), pp. 1530–1538.
- J. Sohl-Dickstein, E. Weiss, N. Maheswaranathan, and S. Ganguli, Deep unsupervised learning using nonequilibrium thermodynamics, in Proceedings of the 32nd International Conference on Machine Learning (PMLR, Lille, France, 2015), pp. 2256–2265.
- A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin, Attention is all you need, in Advances in Neural Information Processing Systems (Curran Associates, Inc., Red Hook, NY, 2017), Vol. 30.
- Y. LeCun, S. Chopra, R. Hadsell, M. Ranzato, and F. J. Huang, A tutorial on energy-based learning, Predicting Structured Data, edited by G. Bakır, T. Hofmann, B. Schölkopf, A. J. Smola, B. Taskar, and S. V. N. Vishwanathan (MIT Press, Cambridge, MA, 2007).
- A. Gu and T. Dao, Mamba: Linear-time sequence modeling with selective state spaces, arXiv:2312.00752.
- W. Bialek and R. Ranganathan, Rediscovering the power of pairwise interactions, arXiv:0712.4397.
- S. Cocco, C. Feinauer, M. Figliuzzi, R. Monasson, and M. Weigt, Inverse statistical physics of protein sequences: A key issues review, Rep. Prog. Phys. 81, 032601 (2018).
- A. Rives, J. Meier, T. Sercu, S. Goyal, Z. Lin, J. Liu, D. Guo, M. Ott, C. L. Zitnick, J. Ma, and R. Fergus, Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences, Proc. Natl. Acad. Sci. USA 118, e2016239118 (2021).
- W. Bialek, Biophysics: Searching for Principles (Princeton University Press, Princeton, NJ, 2012).
- T. Mora and W. Bialek, Are biological systems poised at criticality? J. Stat. Phys. 144, 268 (2011).
- A. De Martino and D. De Martino, An introduction to the maximum entropy approach and its application to inference problems in biology, Heliyon 4, e00596 (2018).
- G. Papamakarios, E. Nalisnick, D. J. Rezende, S. Mohamed, and B. Lakshminarayanan, Normalizing flows for probabilistic modeling and inference, J. Mach. Learn. Res. 22, 1 (2021).
- L. Yang, Z. Zhang, Y. Song, S. Hong, R. Xu, Y. Zhao, W. Zhang, B. Cui, and M.-H. Yang, Diffusion models: A comprehensive survey of methods and applications, ACM Comput. Surv. 56, 1 (2024).
- P. Fields, sepalmer/temp-tune: temperature tuning code v1.0.0 (Version v1.0.0) [Computer software], Zenodo, 2026, https://doi.org/10.5281/zenodo.23333988.
- I. Csiszár and P. Shields, Information Theory and Statistics: A Tutorial, Foundations and Trends in Communications and Information Theory (Now Publishers Inc., 2004).