Temperature is All You Need for Generalization in Langevin Dynamics and other Markov Processes

Itamar Harel, Yonathan Wolanowsky, Gal Vardi, Nathan Srebro, Daniel Soudry · DOI

Introduction

A central paradox in modern machine learning is the remarkable generalization performance of over-parameterized neural networks. Despite having millions or billions of parameters—far exceeding the number of training samples—these models consistently avoid overfitting. This paper, presented at NeurIPS 2025, offers a mathematically elegant explanation for this phenomenon. The authors suggest that for a broad class of stochastic training algorithms, generalization is fundamentally tied to the "temperature" of the optimization process rather than the specific architecture or the complexity of the loss landscape.

The Generalization Gap and Predictive Theory

Classical learning theory often predicts that massive models should "memorize" training data, leading to poor performance on unseen data. However, empirical evidence contradicts this. Existing theoretical frameworks, such as those based on Rademacher complexity or uniform stability, frequently produce "vacuous" bounds—guarantees so loose (e.g., predicting an error rate > 100%) that they offer no practical insight.

Furthermore, many current theories rely on properties that are difficult to track during training, such as the exact optimization path (trajectory dependence) or the time it takes for the algorithm to reach a steady state (mixing time). This research aims to develop a "predictive" theory of generalization: a framework that can provide meaningful, non-vacuous guarantees based on observable parameters before training is even complete.

Methodology: Thermodynamics and Markov Processes

The authors model the training process as a data-dependent Markov process, specifically focusing on Continuous Langevin Dynamics (CLD). CLD can be viewed as Gradient Descent with added Gaussian noise, where the noise level is controlled by an inverse temperature parameter $\beta$.

The core innovation lies in combining two distinct fields:

  1. PAC-Bayes Theory: This framework bounds the generalization gap by measuring the Kullback-Leibler (KL) divergence between the distribution of the trained model and a prior distribution.
  2. The Second Law of Thermodynamics: By applying a generalized version of the second law, the authors demonstrate that if a training process possesses a Gibbs-style stationary distribution, the divergence from the initial state remains bounded throughout the entire optimization.

This thermodynamic perspective implies that the noise inherent in the process acts as a natural regularizer. It prevents the model from becoming excessively specialized to the training set, effectively "capping" the complexity of the learned distribution.

Key Theoretical Insights

The derived generalization bound is remarkably simple and possesses several groundbreaking properties:

  • "Any-Time" Guarantees: Unlike many bounds that degrade as training time increases, this bound remains valid for any $t \ge 0$. This provides a theoretical justification for long training runs and clarifies why models don't necessarily overfit more the longer they are optimized.
  • Dimension Independence: Crucially, the bound does not explicitly depend on the number of parameters $d$. In an era of Large Language Models with billions of parameters, this independence is vital for a theory to be relevant.
  • Trajectory Independence: The theory focuses on the distribution of the model rather than the specific path taken by the optimizer, making it more robust to different initialization and optimization quirks.
Comparison of generalization bounds across different studies.

As shown in the table above, the proposed approach (Ours) eliminates dependencies on both the trajectory and the dimensionality of the model, which were present in previous state-of-the-art bounds. This simplification allows for a more direct understanding of how noise levels influence generalization.

Empirical Results and Validation

The theoretical framework was tested against several standard benchmarks, including MNIST, fashionMNIST, SVHN (Street View House Numbers), and a Synthetic Parity Task.

The results are significant for two reasons. First, the bounds are non-vacuous; on datasets like MNIST and SVHN, the mathematical guarantees predict error rates below 0.5, a rare achievement in deep learning theory. Second, the experiments confirm that the "temperature" (noise level) is the primary lever for generalization. While higher noise (lower $\beta$) improves the generalization guarantee, it presents a trade-off by potentially making the training error harder to minimize.

Limitations and Future Directions

While the paper provides a significant leap forward, several challenges remain:

  • Noise Structure: The current theory assumes isotropic noise. Real-world Stochastic Gradient Descent (SGD) typically exhibits non-isotropic noise aligned with the gradient. Extending the thermodynamic framework to account for this structure is a priority for future work.
  • Regularization: The existence of a stationary distribution currently requires a small amount of weight decay or a bounded parameter space.
  • Discrete Approximation: While the strongest results are in continuous time, the authors provide results for Stochastic Gradient Langevin Dynamics (SGLD), though the discrete-time approximation introduces additional complexity.

Conclusion

By linking the physics of thermodynamics with the statistics of PAC-Bayes theory, this work provides a powerful new lens through which to view neural network training. It suggests that generalization is not a mystery of architecture, but a consequence of the physical constraints of the optimization process itself.

Summary updated

BibTeX
@inproceedings{harel2025temperature,
  author = {Itamar Harel and Yonathan Wolanowsky and Gal Vardi and Nathan Srebro and Daniel Soudry},
  title = {{Temperature is All You Need for Generalization in Langevin Dynamics and other Markov Processes}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=EjkvtZwRoA},
}
Figure