[Paper Review] Bayesian Neural Networks at Finite Temperature
This paper proposes sampling from finite-temperature Bayesian posterior distributions in deep neural networks to improve generalization beyond standard posterior sampling or maximum likelihood training. It demonstrates that optimal test error occurs at T > 0, introduces a temperature-based early stopping criterion, and uses thermodynamic integration for Hessian-free model selection, favoring simpler models when evidence is low.
We recapitulate the Bayesian formulation of neural network based classifiers and show that, while sampling from the posterior does indeed lead to better generalisation than is obtained by standard optimisation of the cost function, even better performance can in general be achieved by sampling finite temperature ($T$) distributions derived from the posterior. Taking the example of two different deep (3 hidden layers) classifiers for MNIST data, we find quite different $T$ values to be appropriate in each case. In particular, for a typical neural network classifier a clear minimum of the test error is observed at $T>0$. This suggests an early stopping criterion for full batch simulated annealing: cool until the average validation error starts to increase, then revert to the parameters with the lowest validation error. As $T$ is increased classifiers transition from accurate classifiers to classifiers that have higher training error than assigning equal probability to each class. Efficient studies of these temperature-induced effects are enabled using a replica-exchange Hamiltonian Monte Carlo simulation technique. Finally, we show how thermodynamic integration can be used to perform model selection for deep neural networks. Similar to the Laplace approximation, this approach assumes that the posterior is dominated by a single mode. Crucially, however, no assumption is made about the shape of that mode and it is not required to precisely compute and invert the Hessian.
Motivation & Objective
- To improve generalization in deep neural network classifiers beyond standard maximum likelihood or posterior sampling.
- To investigate the effect of finite temperature T on generalization performance and identify optimal T values.
- To develop a practical early stopping criterion based on temperature-adjusted validation error during simulated annealing.
- To enable Hessian-free model selection using thermodynamic integration, avoiding costly Hessian computation.
Proposed method
- Formulates Bayesian neural network classification using a uniform prior over bounded weight spaces and derives the temperature-adjusted posterior distribution.
- Introduces finite-temperature sampling via a Boltzmann distribution over network weights, with T controlling posterior noise.
- Employs replica-exchange Hamiltonian Monte Carlo (HMC) to efficiently sample across temperature levels and explore complex posterior landscapes.
- Uses thermodynamic integration (TI) with bridging distributions to compute model evidence without computing or inverting the Hessian.
- Applies TI to compare deep (3-layer) and shallow (1-layer) networks on MNIST, evaluating model evidence under a uniform prior.
- Employs adaptive HMC with step size tuning and Simpson’s rule for numerical integration of free energy differences.
Experimental results
Research questions
- RQ1Does sampling from a finite-temperature posterior lead to better generalization than standard posterior sampling or maximum likelihood training in deep neural networks?
- RQ2At what temperature T > 0 is test error minimized for typical deep neural network classifiers on MNIST?
- RQ3Can temperature-dependent validation error serve as a reliable early stopping criterion for full-batch simulated annealing?
- RQ4How does thermodynamic integration enable accurate model selection without computing the Hessian of the cost function?
- RQ5Does a deeper network with more parameters always outperform a shallower one, given the same data and prior?
Key findings
- A clear minimum in test error is observed at T > 0 for typical deep neural network classifiers on MNIST, indicating improved generalization over T = 1 or T → ∞.
- The optimal temperature for generalization is model-dependent, with different T values yielding best performance for different network architectures.
- Temperature-based early stopping—cooling until validation error increases and reverting to the best parameters—proves effective for full-batch simulated annealing.
- Thermodynamic integration enables accurate model evidence estimation without Hessian computation, allowing direct comparison of deep and shallow networks.
- For the given data set (D₅₀₀) and uniform prior, the shallow network M⁽¹⁾ is strongly favored over the deeper M⁽³⁾, with a Bayes factor of approximately e⁻²³³², indicating overwhelming evidence for the simpler model.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.