Scalable Bayesian Uncertainty Quantification for Neural Network Potentials: Promise and Pitfalls

Stephan Thaler, Gregor Doehner, Julija ZavadlavarXiv 2022

Abstract

Neural network (NN) potentials promise highly accurate molecular dynamics (MD) simulations within the computational complexity of classical MD force fields. However, when applied outside their training domain, NN potential predictions can be inaccurate, increasing the need for Uncertainty Quantification (UQ). Bayesian modeling provides the mathematical framework for UQ, but classical Bayesian methods based on Markov chain Monte Carlo (MCMC) are computationally intractable for NN potentials. By training graph NN potentials for coarse-grained systems of liquid water and alanine dipeptide, we demonstrate here that scalable Bayesian UQ via stochastic gradient MCMC (SG-MCMC) yields reliable uncertainty estimates for MD observables. We show that cold posteriors can reduce the required training data size and that for reliable UQ, multiple Markov chains are needed. Additionally, we find that SG-MCMC and the Deep Ensemble method achieve comparable results, despite shorter training and less hyperparameter tuning of the latter. We show that both methods can capture aleatoric and epistemic uncertainty reliably, but not systematic uncertainty, which needs to be minimized by adequate modeling to obtain accurate credible intervals for MD observables. Our results represent a step towards accurate UQ that is of vital importance for trustworthy NN potential-based MD simulations required for decision-making in practice.

Introduction

Neural network (NN) potentials have revolutionized molecular dynamics (MD) by offering the accuracy of ab initio quantum mechanics at the speed of classical force fields. However, as data-driven "black boxes," these models can produce wildly inaccurate or unphysical results when a simulation explores atomic configurations not covered by the training data. To make these simulations trustworthy for real-world applications—such as drug discovery or materials science—reliable Uncertainty Quantification (UQ) is essential.

While Bayesian statistics provides a rigorous mathematical framework for UQ, "gold-standard" methods like Hamiltonian Monte Carlo (HMC) are computationally impossible for complex NNs and large datasets. This research investigates whether more scalable approximations, such as Stochastic Gradient MCMC (SG-MCMC) and Deep Ensembles, can provide the necessary reliability for MD observables.

Methodology

The study evaluates three primary approaches for UQ using the DimeNet++ architecture, a state-of-the-art graph neural network:

  1. SG-MCMC (pSGLD): A scalable Bayesian method that uses mini-batches of data to estimate gradients, allowing it to sample from the posterior distribution of model parameters.
  2. Deep Ensembles: A popular non-Bayesian alternative where multiple NNs are trained from different random initializations.
  3. NUTS (No-U-Turn Sampler): Used as a "gold-standard" HMC reference for a simple toy system to verify the accuracy of the scalable methods.

A key technical exploration in this work is the use of "cold posteriors"—artificially sharpening the posterior distribution by introducing a temperature hyperparameter ($\mathcal{T} < 1$).

Experimental Benchmarks

The methods were tested across three systems of increasing complexity:

  • Lennard-Jones (LJ) Potential: A 2-body toy system used to compare scalable methods against the HMC gold standard. Both multi-chain pSGLD and Deep Ensembles provided good approximations of the reference distribution, while single-chain approaches proved dangerously overconfident.
  • Coarse-Grained (CG) Liquid Water: A benchmark for MD used to test performance under distribution shifts (e.g., training at one temperature and testing at another). The UQ metrics correctly signaled increased uncertainty during these shifts.
  • Coarse-Grained Alanine Dipeptide: A system used to learn free energy surfaces (FES). This system highlighted the impact of "potential energy holes" and model misspecification.

Key Insights

The Necessity of Multi-Chain Sampling

A single MCMC chain is often insufficient for neural networks. Because the loss landscape is highly multi-modal, a single chain typically becomes trapped in one "mode." The researchers found that using multiple chains with different initializations is essential to capture the full range of epistemic (model) uncertainty.

The "Cold Posterior" Advantage

In graph NN experiments, cold posteriors significantly reduced the volume of training data required. For the liquid water system, a cold posterior allowed the model to achieve high accuracy using only 3% of the original dataset (30 boxes versus 1000), suggesting a path toward more data-efficient training.

Deep Ensembles vs. SG-MCMC

Despite being theoretically less rigorous than Bayesian MCMC, Deep Ensembles achieved UQ quality comparable to multi-chain SG-MCMC. Given that Deep Ensembles require less hyperparameter tuning and shorter training times, they remain a highly attractive baseline for practical MD applications.

The Limits of UQ: Systematic Uncertainty

While these methods excel at capturing aleatoric (noise) and epistemic (data-lack) uncertainty, they struggle with systematic uncertainty. This refers to errors arising from the model's fundamental inability to represent the underlying physics—such as using a force-matching objective that does not perfectly align with the desired free energy surface. UQ can signal when a model is untrustworthy, but it cannot compensate for a fundamentally misspecified model.

Conclusion and Future Outlook

This work demonstrates that scalable Bayesian UQ is a vital step toward trustworthy NN-based MD simulations. However, challenges remain. To obtain uncertainty for MD observables like diffusion or density, one must run a separate simulation for every member of an ensemble, which is computationally expensive. Future work may involve "student-teacher" distillation to reduce this overhead. Additionally, while UQ is a powerful diagnostic, it must be paired with active learning or improved training objectives to eliminate "potential energy holes" and ensure models remain within physical bounds.

Summary updated

BibTeX
@misc{thaler2022scalable,
  author = {Stephan Thaler and Gregor Doehner and Julija Zavadlav},
  title = {{Scalable Bayesian Uncertainty Quantification for Neural Network Potentials: Promise and Pitfalls}},
  year = {2022},
  eprint = {2212.07959},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2212.07959},
}
Figure