- Open Access
Deep Generative Modeling of the Canonical Ensemble with Differentiable Thermal Properties
Phys. Rev. Lett. 135, 027301 – Published 8 July, 2025
DOI: https://doi.org/10.1103/8wx7-kyx8
Abstract
It is a long-standing challenge to accurately and efficiently compute thermodynamic quantities of many-body systems at thermal equilibrium. The conventional methods, e.g., Markov chain Monte Carlo, require many steps to equilibrate. The recently developed deep learning methods can perform direct sampling, but only work at a single trained temperature point and risk biased sampling. Here, we propose a variational method for canonical ensembles with differentiable temperatures, which gives thermodynamic quantities as continuous functions of temperature akin to an analytical solution. The proposed method is a general framework that works with any tractable density generative model. At optimal, the model is theoretically guaranteed to be the unbiased Boltzmann distribution. We validated our method by calculating phase transitions in the Ising and XY models, demonstrating that our direct-sampling simulations are as accurate as Markov chain Monte Carlo methods but more efficient. Moreover, our differentiable free energy aligns closely with the exact one to the second-order derivative, indicating that the variational model captures the subtle thermal transitions at the phase transitions. This functional dependence on external parameters is a fundamental advancement in combining the exceptional fitting ability of deep learning with rigorous physical analysis.
Physics Subject Headings (PhySH)
Article Text
Supplemental Material
References (53)
- A. Bulatov and M. Grohe, The complexity of partition functions, Theor. Comput. Sci. 348, 148 (2005).
- M. Levin and C. P. Nave, Tensor renormalization group approach to two-dimensional classical lattice models, Phys. Rev. Lett. 99, 120601 (2007).
- M. I. Jordan, Z. Ghahramani, T. S. Jaakkola, and L. K. Saul, An introduction to variational methods for graphical models, Mach. Learn. 37, 183 (1999).
- R. K. Pathria, Statistical Mechanics (Elsevier, New York, 2016).
- M. E. Newman and G. T. Barkema, Monte Carlo Methods in Statistical Physics (Clarendon Press, New York, 1999).
- R. M. Neal, Monte Carlo implementation, in Bayesian Learning for Neural Networks (Springer, New York, 1996), pp. 55–98.
- I. Goodfellow, NIPS 2016 tutorial: Generative adversarial networks, arXiv:1701.00160.
- S.-H. Li and L. Wang, Neural network renormalization group, Phys. Rev. Lett. 121, 260601 (2018).
- F. Noé, S. Olsson, J. Köhler, and H. Wu, Boltzmann generators: Sampling equilibrium states of many-body systems with deep learning, Science 365, eaaw1147 (2019).
- D. Wu, L. Wang, and P. Zhang, Solving statistical mechanics using variational autoregressive networks, Phys. Rev. Lett. 122, 080602 (2019).
- K. A. Nicoli, S. Nakajima, N. Strodthoff, W. Samek, K.-R. Müller, and P. Kessel, Asymptotically unbiased estimation of physical observables with neural samplers, Phys. Rev. E 101, 023304 (2020).
- P. Białas, P. Czarnota, P. Korcyl, and T. Stebel, Simulating first-order phase transition with hierarchical autoregressive networks, Phys. Rev. E 107, 054127 (2023).
- S. Kullback and R. A. Leibler, On information and sufficiency, Ann. Math. Stat. 22, 79 (1951).
- G. Kanwar, M. S. Albergo, D. Boyda, K. Cranmer, D. C. Hackett, S. Racaniere, D. J. Rezende, and P. E. Shanahan, Equivariant flow-based sampling for lattice gauge theory, Phys. Rev. Lett. 125, 121601 (2020).
- K. A. Nicoli, C. J. Anders, L. Funcke, T. Hartung, K. Jansen, P. Kessel, S. Nakajima, and P. Stornati, Estimation of thermodynamic observables in lattice field theories with deep generative models, Phys. Rev. Lett. 126, 032001 (2021).
- P. Wirnsberger, G. Papamakarios, B. Ibarz, S. Racanière, A. J. Ballard, A. Pritzel, and C. Blundell, Normalizing flows for atomic solids, Mach. Learn.: Sci. Technol. 3, 025009 (2022).
- R. Ahmad and W. Cai, Free energy calculation of crystalline solids using normalizing flows, Model. Simul. Mater. Sci. Eng. 30, 065007 (2022).
- H. Xie, Z.-H. Li, H. Wang, L. Zhang, and L. Wang, Deep variational free energy approach to dense hydrogen, Phys. Rev. Lett. 131, 126501 (2023).
- See Supplemental Material at http://link.aps.org/supplemental/10.1103/8wx7-kyx8 for details of (1) a general introduction of the tractable density generative model, (2) the derivation of temperature-dependent Boltzmann distribution using the variational minimization of free energy, (3) the derivation of the first- and second-order derivatives of the expectation operator over parametrized distributions, (4) the derivation of mean energy and heat capacity from the differentiation of the partition function, and convergence time comparisons, and (5) implementation details and supplementary results of the Ising and XY experiments, which includes Refs. [8,11,20–34].
- S. Mohamed, M. Rosca, M. Figurnov, and A. Mnih, Monte Carlo gradient estimation in machine learning, J. Mach. Learn. Res. 21, 5183 (2020), https://www.jmlr.org/papers/v21/19-346.html.
- A. Van Den Oord, N. Kalchbrenner, and K. Kavukcuoglu, Pixel recurrent neural networks, in International Conference on Machine Learning (PMLR, New York, 2016), pp. 1747–1756.
- K. He, X. Zhang, S. Ren, and J. Sun, Deep residual learning for image recognition, in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (IEEE, Las Vegas, 2016), pp. 770–778.
- C. Durkan, A. Bekasov, I. Murray, and G. Papamakarios, Cubic-spline flows, arXiv:1906.02145.
- C. Naesseth, F. Ruiz, S. Linderman, and D. Blei, Reparameterization gradients through acceptance-rejection sampling algorithms, in Artificial Intelligence and Statistics (PMLR, 2017), pp. 489–498.
- H.-Y. Hu, S.-H. Li, L. Wang, and Y.-Z. You, Machine learning holographic mapping by neural network renormalization group, Phys. Rev. Res. 2, 023369 (2020).
- D. P. Kingma and M. Welling, Auto-encoding variational Bayes, arXiv:1312.6114.
- I. J. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio, Generative adversarial networks, arXiv:1406.2661.
- S. P. Boyd and L. Vandenberghe, Convex Optimization (Cambridge University Press, Cambridge, England, 2004).
- D. P. Kingma and J. Ba, Adam: A method for stochastic optimization, arXiv:1412.6980.
- R. T. Q. Chen, Y. Rubanova, J. Bettencourt, and D. Duvenaud, Neural ordinary differential equations, arXiv:1806.07366.
- B. Efron, Bootstrap methods: Another look at the Jackknife, Ann. Stat. 7, 1 (1979).
- D.-A. Clevert, T. Unterthiner, and S. Hochreiter, Fast and accurate deep network learning by exponential linear units (ELUs), arXiv:1511.07289.
- A. F. Agarap, Deep learning using rectified linear units (ReLU), arXiv:1803.08375.
- M. Girolami and B. Calderhead, Riemann manifold Langevin and Hamiltonian Monte Carlo methods, J. R. Stat. Soc. Ser. B 73, 123 (2011).
- H. Robbins and S. Monro, A stochastic approximation method, Ann. Math. Stat. 22, 400 (1951), https://www.jstor.org/stable/2236626.
- B. T. Polyak and A. B. Juditsky, Acceleration of stochastic approximation by averaging, SIAM J. Control Optim. 30, 838 (1992).
- A. G. Baydin, B. A. Pearlmutter, A. A. Radul, and J. M. Siskind, Automatic differentiation in machine learning: A survey, J. Mach. Learn. Res. 18, 1 (2018).
- K. Hornik, M. Stinchcombe, and H. White, Multilayer feedforward networks are universal approximators, Neural Netw. 2, 359 (1989).
- M. Dibak, L. Klein, A. Krämer, and F. Noé, Temperature steerable flows and Boltzmann generators, Phys. Rev. Res. 4, L042005 (2022).
- L. Onsager, Crystal statistics. I. A two-dimensional model with an order-disorder transition, Phys. Rev. 65, 117 (1944).
- J. M. Kosterlitz and D. J. Thouless, Ordering, metastability and phase transitions in two-dimensional systems, J. Phys. C 6, 1181 (1973).
- V. Berezinskii, Destruction of long-range order in one-dimensional and two-dimensional systems having a continuous symmetry group I. Classical systems, Sov. Phys. JETP 32, 493 (1971).
- D. J. Bishop and J. D. Reppy, Study of the superfluid transition in two-dimensional films, Phys. Rev. Lett. 40, 1727 (1978).
- Z. A. Xu, N. P. Ong, Y. Wang, T. Kakeshita, and S. Uchida, Vortex-like excitations and the onset of superconducting phase fluctuation in underdoped , Nature (London) 406, 486 (2000).
- G. Papamakarios, E. Nalisnick, D. J. Rezende, S. Mohamed, and B. Lakshminarayanan, Normalizing flows for probabilistic modeling and inference, J. Mach. Learn. Res. 22, 2617 (2021), https://www.jmlr.org/papers/v22/19-1028.html.
- D. Rezende and S. Mohamed, Variational inference with normalizing flows, in International Conference on Machine Learning (PMLR, 2015), pp. 1530–1538.
- T. Müller, B. McWilliams, F. Rousselle, M. Gross, and J. Novák, Neural importance sampling, ACM Trans. Graph. 38, 1 (2019).
- C. Durkan, A. Bekasov, I. Murray, and G. Papamakarios, Neural spline flows, Adv. Neural Inf. Process. Syst. 32 (2019), https://proceedings.neurips.cc/paper/2019/hash/7ac71d433f282034e088473244df8c02-Abstract.html.
- N. I. Fisher, Statistical Analysis of Circular Data (Cambridge University Press, Cambridge, England, 1993).
- D. Best and N. I. Fisher, Efficient simulation of the von Mises distribution, J. R. Stat. Soc. C 28, 152 (1979).
- H. Xie, L. Zhang, and L. Wang, Ab-initio study of interacting fermions at finite temperature with neural canonical transformation, J. Mach. Learn. 1, 38 (2022).
- H. Xie, L. Zhang, and L. Wang, of two-dimensional electron gas: A neural canonical transformation study, SciPost Phys. 14, 154 (2023).
- https://github.com/li012589/vatd for code implementation.