---
title: 'Bayesian NequIP: Uncertainty in Atomistic Modeling'
url: https://www.emergentmind.com/topics/bayesian-nequip
type: topic
---

# Bayesian NequIP: Uncertainty in Atomistic Modeling

Searching arXiv for the cited Bayesian NequIP papers and directly related NequIP context.
Bayesian NequIP denotes Bayesian augmentations of the E(3)-equivariant interatomic potential NequIP that are used for uncertainty-aware atomistic modeling and for accelerated structure search. In one line of work, NequIP is turned into a stochastic neural network with a Gaussian prior over parameters, Gaussian likelihoods for energies and forces, and posterior sampling by an adaptive stochastic-gradient Hamiltonian Monte Carlo procedure, yielding uncertainty-aware interatomic force models with state-of-the-art accuracy and a good measure of uncertainty [2304.03694]. In another line of work, NequIP is coupled to Bayesian optimization in the BOSS framework for adsorption-structure determination, where a Gaussian-process surrogate reduces the number of structure evaluations and NequIP reduces the cost of each evaluation [2311.16750].

## 1. NequIP as the common substrate

NequIP is an E(3)-equivariant graph neural network for interatomic potentials. It takes as input a molecular configuration
$x = \{(r_i,z_i)\}_{i=1}^n$,
where $r_i \in \mathbb{R}^3$ are nuclear coordinates and $z_i$ their atomic numbers, and outputs a scalar energy $E(x)$ and forces $F_i = -\nabla_{r_i}E(x)$. In the uncertainty-aware formulation, each atom carries features $v_i^{\ell,p} \in \mathbb{R}^{d_\ell}$, one vector per irrep up to $\ell_{\max}=2$, with $d_\ell=64$ for all $\ell$; radial functions use a learnable Bessel basis of size $8$ plus two hidden layers with $64$ units and SiLU activation and a cutoff of $4$ Å; five interaction blocks are stacked; and the final invariant features are mapped by an MLP to virtual atomic energies $E_i$ with total energy $E=\sum_i E_i$ [2304.03694]. In the adsorption-search formulation, the NequIP configuration uses $4$ message-passing layers, feature multiplicity $32$, maximum rotation order $\ell_{\max}=2$, and cutoff radius $r_{\mathrm{cut}}=3.5$ Å, again relying on spherical harmonics and tensor-valued features to ensure E(3) equivariance [2311.16750].

The common architectural core should not obscure the fact that the literature uses the label “Bayesian NequIP” for two different Bayesian constructions. One places a posterior distribution over network parameters and treats energy and force prediction probabilistically. The other places a Gaussian-process prior over an unknown potential-energy surface in a Bayesian optimization loop and uses NequIP as the fast evaluator inside that loop. The shared element is NequIP’s equivariant energy–force model; the Bayesian layer differs substantially between the two usages.

## 2. Bayesian neural-network formulation of NequIP

In the uncertainty-aware force-field formulation, all network parameters, including the weights and biases of the base and projection layers and the two new standard-deviation MLPs, are collected into $\theta \in \mathbb{R}^P$ and assigned the isotropic Gaussian prior
$$
p(\theta)=\mathcal{N}(\theta;0,I).
$$
The dataset is $D=\{(x_i,y_i)\}_{i=1}^L$, assumed i.i.d., where each $y_i$ contains the true DFT energy $E^{(i)}$ and forces $F^{(i)}_1,\ldots,F^{(i)}_{n_i}$. Under $\theta$, the network predicts means $\mu_E(\theta,x)$ and $\mu_{F_i}(\theta,x)\in\mathbb{R}^3$, and it also predicts standard deviations $\sigma_E(\theta,x)>0$ and a single scalar $\sigma_F(\theta,x)>0$ for all three components of every atomic force. These standard deviations are produced by small MLP heads acting on the invariant features from the NequIP base. The likelihood is
$$
p(y|x,\theta)
=
\mathcal{N}(E;\mu_E(\theta,x),\sigma_E^2(\theta,x))
\prod_{i=1}^n
\mathcal{N}(F_i;\mu_{F_i}(\theta,x),\sigma_F^2(\theta,x)I_3),
$$
and the posterior density is
$$
p(\theta|D)\propto p(\theta)\prod_{i=1}^L p(y_i|x_i,\theta).
$$
Equivalently, the negative-log potential is
$$
u(\theta):=-\ln p(\theta)-\sum_{i=1}^L \ln p(y_i|x_i,\theta),
$$
and posterior sampling targets $p(\theta|D)\propto \exp(-u(\theta))$ [2304.03694].

This construction is explicitly motivated by the use of Bayesian neural networks for modeling uncertainty, active learning, and incorporating prior physical knowledge. The NequIP backbone remains the mechanism that enforces equivariance and produces energies and forces, while the Bayesian formulation adds a probabilistic layer over both the parameters and the predictive outputs. In this sense, Bayesian NequIP is not merely an ensemble heuristic but a stochastic neural network model with a defined prior, likelihood, posterior, and predictive density.

## 3. Adaptive SGHMC posterior sampling and training protocol

A central obstacle in applying Bayesian neural networks to interatomic force modeling is posterior sampling for state-of-the-art architectures. Standard SGHMC introduces an auxiliary momentum variable $v$ and simulates
$$
\Delta v = -\nabla_\theta u(\theta)\Delta t - C M^{-1}v\Delta t + \sqrt{2C\Delta t}\,\xi_t,\qquad \xi_t\sim \mathcal{N}(0,I),
$$
$$
\Delta \theta = M^{-1}v\Delta t,
$$
with diagonal mass $M$ and friction $C$. In NequIP, however, different parameter groups exhibit gradient scales differing by orders of magnitude, so a single fixed $M$ or stepsize $\Delta t$ causes some parameters to move too slowly while others explode. The proposed remedy is an AMSGrad-based diagonal mass adaptation:
$$
a_t=(1-\beta)g_t^2+\beta a_{t-1},
$$
$$
D_t=\max(D_{t-1},a_t),
$$
$$
M_t=\sqrt{D_t/(1-\beta^t)+\epsilon_{\mathrm{stability}}},
$$
where the maximum is elementwise. During the first $t_{\max}$ steps, regarded as burn-in, $M_t$ is updated; afterward it is frozen as $M_{t_{\max}}$, yielding a true SGHMC chain. The algorithm uses minibatches $\hat D \subset D$ of size $B \ll |D|$ and the stochastic-gradient estimate
$$
\nabla_\theta \hat u(\theta)
=
\nabla_\theta(-\ln p(\theta))
-
(|D|/B)\sum_{(x,y)\in \hat D}\nabla_\theta \ln p(y|x,\theta)
+\epsilon_t,
\qquad \mathbb{E}[\epsilon_t]=0.
$$
The update rule given in the pseudocode is
$$
v_t \leftarrow v_{t-1}-\alpha g_t-\alpha v_{t-1}+\alpha\sqrt{2M_t/(|D|\gamma)}\,\xi_t,
$$
$$
\theta_t \leftarrow \theta_{t-1}+\gamma M_t^{-1}v_t,
$$
with $\alpha=\Delta t M^{-1}C$, $\gamma=(\Delta t)^2|D|/\alpha$, $\beta\approx 0.999$, and $\epsilon_{\mathrm{stability}}=10^{-3}$ [2304.03694].

The reported training protocol fixes $\alpha=0.1$, $\beta=0.999$, and $\epsilon_{\mathrm{stability}}=10^{-3}$. For the RMD17 datasets, the batch size is $B=32$ and the learning rate $\gamma$ is decayed exponentially from $10^{-2}$ to $10^{-5}$ over the first $10^6$ steps of burn-in; after step $10^6$, the mass is frozen and a cosine cyclic schedule is used,
$$
\gamma_i = (\gamma_0/2)[\cos(\pi + i\pi/K)+1],
$$
with $\gamma_0=10^{-3}$ and $K=5\times 10^4$, sampling one $\theta$ every cycle and obtaining $k=8$ samples in about $4\times 10^5$ extra steps. For the PEDOT dataset, the scheme is identical except that $B=10$, burn-in lasts $5\times 10^5$ steps, and the mass is frozen after $1\times 10^5$ steps. The paper reports that $k=8$ samples are a good trade-off and that a single chain suffices to produce approximately independent samples.

## 4. Predictive uncertainty, calibration, and benchmark behavior

Given posterior samples $\{\theta_i\}_{i=1}^k$, the predictive density for a new configuration is approximated by
$$
p(y|x,D)\approx \frac{1}{k}\sum_{i=1}^k p(y|x,\theta_i),
$$
with point estimates
$$
\bar\mu_E=\frac{1}{k}\sum \mu_E(\theta_i,x),
\qquad
\bar F_j=\frac{1}{k}\sum \mu_{F_j}(\theta_i,x).
$$
For a force component $j$, the total predictive variance is
$$
\mathrm{Var}[F_j|x,D]
\approx
\frac{1}{k}\sum \sigma_F^2(\theta_i,x)
+
\frac{1}{k}\sum [\mu_{F_j}(\theta_i,x)-\bar F_j]^2.
$$
The first term is identified as aleatoric uncertainty, and the second as epistemic uncertainty; analogous formulas hold for the energy [2304.03694].

The empirical evaluation uses PEDOT conducting-polymer molecular dynamics and Revised MD17. The PEDOT dataset contains $100$ training and $30$ validation structures for chains of length $8/12$, with testing also on length $16$ and zero training on that length. The Revised MD17 setup uses $1000$ training structures, $30$ validation structures, and approximately $9500$ test structures per molecule. Metrics include MAE-F and RMSE-F in kcal/(mol·Å), MAE-E and RMSE-E in kcal/mol, mean log-likelihood under the predictive distribution, ROC AUC for outlier detection with threshold $|error|\ge 1$ kcal/(mol·Å), and calibration via Expected Calibration Error normalized by bin width, denoted NECE. The main baseline is Dropout-based NequIP with a single dropout layer of rate $1/64$ trained with AMSGrad on identical data splits. On PEDOT, MAE-F is approximately $0.03$–$0.06$ kcal/(mol·Å), improving slightly from $k=1$ to $k=8$, while energy MAE is about $15$–$50$ kcal/mol. On length-$16$ PEDOT, NECE improves from $0.180$ for $k=1$ to $0.058$ for $k=8$, and $\mathrm{MLL}_F$ improves from $-3.8$ to $-1.5$. On RMD17, force MAE is comparable to Dropout on easy molecules but $20$–$30\%$ better on aspirin and malonaldehyde; $\mathrm{MLL}_F$ is consistently better by $0.5$–$1.0$ nats; ROC AUC for outlier detection at $k=8$ is $0.95$–$0.99$ versus $0.75$–$0.90$ for Dropout; and NECE is $1.2$–$2.4\times 10^{-2}$, indicating some overconfidence but still lower than Dropout’s $3$–$5\times 10^{-2}$. The paper also reports that the Bayesian procedure requires about twice the GPU hours of deterministic NequIP to reach convergence, while inference with $k$ Monte Carlo predictions costs approximately $k$ times a single NequIP forward pass plus small MLP overhead for the standard deviations, and in most workflows DFT data generation dominates runtime.

## 5. Bayesian optimization with NequIP for adsorption structure determination

In the adsorption-search usage, Bayesian NequIP refers to a protocol that combines Bayesian optimization structural inference with NequIP. The decision variables are split into conformer-search internal coordinates $\theta\equiv\{\theta_1,\ldots,\theta_D\}$ and adsorption-search variables $\xi\equiv\{x,y,z,\alpha,\beta,\gamma\}$, consisting of the Cartesian translation of the molecule above the surface and three Euler roll-pitch-yaw angles. A Gaussian-process prior is placed on the unknown potential-energy surface $f(\xi)$. After $n$ evaluations at points $\{(\xi_i,y_i=f(\xi_i))\}$, the posterior predictive mean and variance are
$$
\mu_n(\xi)=k(\xi)^\top [K+\sigma_n^2 I]^{-1}y,
$$
$$
\sigma_n^2(\xi)=k(\xi,\xi)-k(\xi)^\top [K+\sigma_n^2 I]^{-1}k(\xi),
$$
where $K_{ij}=k(\xi_i,\xi_j)$, $k(\xi)=[k(\xi,\xi_1),\ldots,k(\xi,\xi_n)]^\top$, $\sigma_n^2$ is the noise or jitter hyperparameter, and $y=[y_1,\ldots,y_n]^\top$. The acquisition function may be Expected Improvement,
$$
\mathrm{EI}(\xi)=\mathbb{E}[\max(f(\xi)-f^\star,0)]
=
(\mu_n(\xi)-f^\star)\Phi(\Delta)+\sigma_n(\xi)\phi(\Delta),
$$
with $\Delta=(\mu_n(\xi)-f^\star)/\sigma_n(\xi)$, or Upper-Confidence Bound,
$$
a(\xi)=\mu_n(\xi)+\kappa\cdot \sigma_n(\xi).
$$
The BO loop is initialized with a small number, for example $5$, of random or space-filling samples, then iterates by fitting $(\mu_n,\sigma_n)$, choosing $\xi_{n+1}=\arg\max_\xi a(\xi)$, evaluating the expensive objective, augmenting the dataset, and stopping when a budget such as $500$ points is reached or a convergence criterion is met [2311.16750].

For adsorption searches, the objective is the binding energy
$$
E_{\mathrm{ads}}(\xi)=E_{\mathrm{tot}}(\xi)-[E_{\mathrm{surface}}+E_{\mathrm{conformer}}],
$$
which is minimized. NequIP serves as the machine-learning interatomic potential that replaces DFT as the expensive oracle at active-learning steps. In this protocol, the NequIP model uses $4$ message-passing layers, feature multiplicity $32$, $\ell_{\max}=2$, and $r_{\mathrm{cut}}=3.5$ Å. Training minimizes
$$
L=\sum_i \left[|E_{\mathrm{pred}}^{(i)}-E_{\mathrm{ref}}^{(i)}|^2+\|F_{\mathrm{pred}}^{(i)}-F_{\mathrm{ref}}^{(i)}\|^2\right],
$$
with equal weighting of the energy and force terms; Adam is used with learning rate $5\times 10^{-3}$ and EMA decay $0.99$. The network outputs atomic contributions $\epsilon_i$ such that $E_{\mathrm{pred}}=\sum_i \epsilon_i$, and forces are obtained by analytic differentiation, $F_i=-\partial E_{\mathrm{pred}}/\partial r_i$. Between BO iterations, local relaxations of candidate minima are carried out with BFGS in ASE using the NequIP calculator until $|F|_{\max}<0.01$ eV/Å. To address conformational flexibility, the protocol adopts a building-block strategy: gas-phase conformers are located first, and where full conformational mapping is infeasible, external conformer search tools such as CREST metadynamics are used; the resulting conformers are then frozen as rigid building blocks and only the $6$D adsorption pose is optimized with BOSS.

## 6. Performance claims, limitations, and recurrent points of confusion

For adsorption-structure determination, the reported performance gains are substantial in terms of search cost. DFT-only global adsorption searches for flexible xylotetraose are described as intractable, requiring more than $300$ years of CPU time for $10^5$ structures. BOSS with DFT reduces the number of required DFT evaluations by two to three orders of magnitude, for example from approximately $10^4$ to approximately $10^2$–$10^3$. NequIP accelerates each energy and force evaluation by approximately $100$–$1000\times$ over DFT. Combined, the protocol identifies known DFT global minima at approximately $10\times$–$100\times$ lower wall time, enabling $O(10^5)$ pose samples instead of $O(10^3)$ by DFT at comparable accuracy [2311.16750].

A recurrent source of confusion is that the Bayesian ingredient is different in the two main usages. In the uncertainty-aware force-modeling work, the Bayesian object is the posterior over NequIP parameters and the predictive density is a Monte Carlo average over sampled networks. In the adsorption-search work, the Bayesian object is the Gaussian-process surrogate over adsorption configurations, while NequIP functions as the fast machine-learning interatomic potential inside the optimization loop. Another common misunderstanding is to equate uncertainty estimation with perfect calibration. The uncertainty-aware force-modeling results explicitly report slight overconfidence tails, even though calibration as measured by NECE is better than the Dropout baseline. A further limitation concerns conformational flexibility: the adsorption-search paper states that the applicability of Bayesian optimization for the conformational analysis of the more flexible xylotetraose molecule is restricted by the sample-complexity bottleneck, and that this bottleneck can be bypassed with external conformer search tools before lower-dimensional adsorption optimization [2304.03694].

These two usages therefore occupy different positions in atomistic-learning workflows. One addresses posterior uncertainty within the interatomic force model itself; the other addresses sample efficiency in global structure determination. Taken together, they show how Bayesian methodology can enter NequIP-based atomistic modeling either through weight-space posterior inference or through Gaussian-process-guided search over molecular and adsorption configurations.

Source: https://www.emergentmind.com/topics/bayesian-nequip