Can Training Dynamics of Scale-Invariant Neural Networks Be Explained by the Thermodynamics of an Ideal Gas?

Ildus Sadrtdinov, Ekaterina Lobacheva, Ivan Klimov, Mikhail I. Katsnelson, Dmitry P. VetrovarXiv 2025 · DOI

Abstract

This paper establishes a formal thermodynamic framework for the training dynamics of scale-invariant neural networks, such as those employing BatchNorm or LayerNorm. By modeling Stochastic Gradient Descent (SGD) through the lens of statistical mechanics, the authors demonstrate that these networks follow an "Ideal Gas Law" ($pV = RT$). In this mapping, weight decay acts as pressure and the parameter norm acts as volume, providing a principled physical foundation for understanding hyperparameter interactions and optimization behavior.

Introduction

Despite the ubiquity of deep learning, the theoretical understanding of why specific optimization settings succeed remains incomplete. Optimization via SGD does not merely find a single point; it settles into a stationary distribution—a "cloud" of weight configurations. While previous analogies have linked SGD noise to temperature and loss to energy, they often failed to account for the role of weight decay and its interaction with the parameter norm. This research fills that gap by focusing on scale-invariant architectures, where network output is invariant to the scaling of weights, a property common in modern networks using normalization layers.

Thermodynamic Mapping of SGD

The authors utilize Stochastic Differential Equations (SDEs) to model the continuous-time behavior of SGD. They introduce a rigorous thermodynamic mapping:

  • Internal Energy ($U$): Represented by the training loss.
  • Temperature ($T$): Determined by the learning rate ($\eta$) and gradient noise.
  • Pressure ($p$): The weight decay coefficient ($\lambda$).
  • Volume ($V$): The squared norm of the weights ($r^2/2$).
Experimental validation of thermodynamic variables (temperature, radius, loss, entropy) against learning rate and weight decay.

Under this framework, weight decay is viewed as a physical "pressure" that compresses the weight distribution toward the origin, balancing the "thermal expansion" caused by SGD noise. The researchers validated this mapping using synthetic models with isotropic noise and real-world image datasets (CIFAR-10/100) with ResNet-18 and ConvNet architectures.

Key Insights and Results

The core finding is the emergence of an AI "State Equation." For scale-invariant networks, the relationship between weight decay, weight norm, and learning rate follows the ideal gas law: $pV = RT$. This implies that hyperparameters are not independent but are constrained by physical laws.

Furthermore, the study confirms that "Maxwell relations"—fundamental thermodynamic equations relating entropy changes to pressure and temperature—hold true for neural networks. This allows for the mathematical prediction of how "disorder" (entropy) in the model shifts as hyperparameters are tuned. Empirical results on ResNet-18 showed that predicted relationships between entropy and hyperparameters had a maximal absolute error of less than 2.5%.

Verification of the Ideal Gas Law and Maxwell relations showing the close fit between theoretical predictions and experimental data.

Discussion and Limitations

While the framework provides a powerful new perspective, it currently relies on several assumptions. The cleanest theoretical results assume isotropic gradient noise, whereas real-world noise is often anisotropic (directional). Additionally, the analogy may break down in the "interpolation regime" of overparameterized models where training loss reaches zero; in such cases, the system effectively "freezes," losing its gas-like properties. Future work aims to extend these laws to non-scale-invariant architectures and more complex optimizers like Adam or Lion.

Summary updated

BibTeX
@misc{sadrtdinov2025can,
  author = {Ildus Sadrtdinov and Ekaterina Lobacheva and Ivan Klimov and Mikhail I. Katsnelson and Dmitry P. Vetrov},
  title = {{Can Training Dynamics of Scale-Invariant Neural Networks Be Explained by the Thermodynamics of an Ideal Gas?}},
  year = {2025},
  eprint = {2511.07308},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.07308},
}
Figure