From First Principles: A Statistical Mechanics Framework for Machine Learning
Abstract
Modern machine learning has achieved remarkable empirical success, yet its theoretical underpinnings remain incomplete. This paper develops a unified framework for understanding learning through the first principles of statistical physics. Within this view, a model’s loss function corresponds to an energy landscape, the training process to stochastic dynamics, and generalization to an entropy-driven preference for flat minima and phase-transition behavior. Energy-Based Models (EBMs) are analyzed as a central case study. This study shows how their mathematical form arises naturally from the Principle of Maximum Entropy, and how their latent-variable structures can be interpreted as learning an effective theory of the data. The learning dynamics are also given a direct physical interpretation, with training algorithms like Contrastive Divergence representing non-equilibrium relaxation processes. In particular, we highlight that the Hessian-dependent gradient noise in Stochastic Gradient Descent emerges as the key mechanism driving an exponential preference for the flat minima associated with good generalization. Beyond explanation, this framework offers constructive principles. Symmetry, conservation laws, and duality provide powerful inductive biases for building data-efficient and interpretable models, as exemplified by Physics-Informed Neural Networks and compositional generative architectures. We conclude by pointing toward future research directions, including exploring the limits of compositionality through the lens of spin glass theory and developing a non-equilibrium thermodynamic framework for learning dynamics.
References
- Baiesi, M., & Suweis, S. (2025). The enduring relevance of simple machine learning models. Europhysics News, 56(1), 20–23.
- Levine, H., & Tu, Y. (2024). Machine learning meets physics: A two-way street. Proc. Natl. Acad. Sci. USA, 121(27), e2403580121.
- Carbone, D. (2024). Hitchhiker's guide on the relation of Energy-Based Models with other generative models, sampling and statistical physics: a comprehensive review. arXiv preprint arXiv: 2406.13661.
- Mehta, P., Bukov, M., Wang, C. H., Day, A. G., Richardson, C., Fisher, C. K., & Schwab, D. J. (2019). A high-bias, low-variance introduction to machine learning for physicists. Physics Reports, 810, 1–124.
- Gupta, P., Ferrari, A. E., & Iqbal, N. A. (2025). A machine learning approach to duality in statistical physics. In Proc. 42nd Int. Conf. Machine Learning.
- Meng, C., Griesemer, S., Cao, D., Seo, S., & Liu, Y. (2025). When physics meets machine learning: A survey of physics-informed machine learning. Mach. Learn. Comput. Sci. Eng., 1(1), 20.
- Niroomand, M. P., & Wales, D. J. (2023). Physics-inspired interpretability of machine learning models. arXiv preprint arXiv: 2304.02381.
- Ackley, D. H., Hinton, G. E., & Sejnowski, T. J. (1985). A learning algorithm for Boltzmann machines. Cognitive Science, 9(1), 147–169.
- Du, Y., Li, S., & Mordatch, I. (2020). Compositional visual generation with energy based models. In Advances in Neural Information Processing Systems, 33 (pp. 6637–6647).
- Raissi, M., & Karniadakis, G. E. (2018). Hidden physics models: Machine learning of nonlinear partial differential equations. Journal of Computational Physics, 357, 125–141.
- Hinton, G. E., & Salakhutdinov, R. R. (2006). Reducing the dimensionality of data with neural networks. Science, 313(5786), 504–507.
- Liu, W., Wang, X., Owens, J., & Li, Y. (2020). Energy-based out-of-distribution detection. In Advances in Neural Information Processing Systems, 33 (pp. 21464–21475).
- Pun, G. P., Batra, R., Ramprasad, R., & Mishin, Y. (2019). Physically informed artificial neural networks for atomistic modeling of materials. Nature Communications, 10(1), 2339.
- Domingo-Enrich, C., Bietti, A., Vanden-Eijnden, E., & Bruna, J. (2021). On energy-based models with overparametrized shallow neural networks. In Proc. Int. Conf. Machine Learning (pp. 2771–2782). PMLR.
- De Martino, A., & De Martino, D. (2018). An introduction to the maximum entropy approach and its application to inference problems in biology. Heliyon, 4(4).
- LeCun, Y., Chopra, S., Hadsell, R., Ranzato, M., & Huang, F. (2006). A tutorial on energy-based learning. Predicting Structured Data, 1(0).
- Xie, Z., Sato, I., & Sugiyama, M. (2020). A diffusion theory for deep learning dynamics: Stochastic gradient descent exponentially favors flat minima. arXiv preprint arXiv: 2002.03495.
- Jastrzębski, S., Kenton, Z., Arpit, D., Ballas, N., Fischer, A., Bengio, Y., & Storkey, A. (2017). Three factors influencing minima in sgd. arXiv preprint arXiv: 1711.04623.
- Chaudhari, P., Choromanska, A., Soatto, S., LeCun, Y., Baldassi, C., Borgs, C., … & Zecchina, R. (2019). Entropy-sgd: Biasing gradient descent into wide valleys. Journal of Statistical Mechanics: Theory and Experiment, 2019(12), 124018.
- Kozyrev, S. V., Lopatin, I. A., & Pechen, A. N. (2024). Control of overfitting with physics. Entropy, 26(12), 1090.
- Du, Y., & Mordatch, I. (2019). Implicit generation and modeling with energy based models. Advances in Neural Information Processing Systems, 32.
- Lin, C. C., & McCarthy, A. (2022). On the uncomputability of partition functions in energy-based sequence models. In Proc. Tenth Int. Conf. Learning Representations (ICLR).
- Decelle, A., Furtlehner, C., & Seoane, B. (2021). Equilibrium and non-equilibrium regimes in the learning of restricted Boltzmann machines. Advances in Neural Information Processing Systems, 34, 5345–5359.