Uncertainty Estimation for Molecular Diffusion Models


Abstract

Diffusion models have seen wide adoption for 3D molecular generation, yet they offer no principled signal of when a generated molecule is likely to be of low quality. We propose a post-hoc method for estimating per-sample uncertainty in pretrained molecular diffusion models. Building on a Laplace approximation of the denoising network, we measure the variability of the noise prediction across the generation trajectory. Empirically, we show that the resulting uncertainty score is informative of sample quality, exhibiting a negative correlation with established sample-level quality metrics. We further study how the proposed uncertainty score can be used to filter generated samples, improving model performance via test-time scaling.

1 Introduction↩︎

Diffusion models have rapidly become the dominant paradigm for 3D molecular generation [1][4]. Yet even state-of-the-art models can produce samples that are chemically invalid or unstable. This becomes a practical bottleneck when scaling up the generation budgets: deciding which molecules merit expensive downstream evaluation (e.g., docking or wet-lab validation) currently relies on coarse rule-based filters or on the model’s own—often poorly calibrated [5], [6]—likelihood.

For predictive models, uncertainty estimation is the standard tool for flagging unreliable outputs [7], and a growing line of work has begun to adapt these ideas to diffusion models in the image domain [8][12], showing promising early results for flagging low-quality generated images. To the best of our knowledge, however, no analogous work exists for molecular diffusion, despite the aforementioned practical need for sample-quality signals in scientific domains where downstream evaluation is expensive.

In this work, we take a first step towards extending the existing diffusion uncertainty approaches to molecular domain. Our method is post-hoc: given a pretrained molecular diffusion model, we fit a Laplace approximation [13] to the denoising network and measure the variability of its noise predictions along the generation trajectory. We aggregate this variability across selected timesteps, atoms, and feature dimensions to obtain a single uncertainty score for each generated molecule. Empirically, we show that this score is informative of molecular sample quality: it is negatively correlated with established metrics such as molecular stability, atom stability, and validity, and it is more predictive than diffusion likelihood baseline in our QM9 [14] experiments. We further show that the score can be used for test-time scaling [15], [16] by oversampling molecules and filtering out high-uncertainty generations, improving sample quality without retraining the underlying generator.

2 Background↩︎

2.0.0.1 Diffusion Models

Diffusion models [17][19] are a class of generative models that learn to invert a gradual noising process. Given a data sample \(\boldsymbol{x}_0 \sim q(\mathbf{x})\), the forward process produces progressively noisier samples via \[\begin{align} \label{eq:forward} \boldsymbol{x}_t = \sqrt{\bar{\alpha}_t}\, \boldsymbol{x}_0 + \sqrt{1 - \bar{\alpha}_t}\, \boldsymbol{\epsilon}, \qquad \boldsymbol{\epsilon}\sim \mathcal{N}(0, I), \end{align}\tag{1}\] where \(\bar{\alpha}_t = \prod_{r=1}^t (1 - \beta_r)\) and \(\{\beta_r\}_{r=1}^T\) is a variance schedule with \(\beta_r \in (0,1)\), chosen such that \(\boldsymbol{x}_T\) is approximately standard Gaussian. For any \(s < t\), the reverse-time posterior is also Gaussian distributed \[\begin{align} q(\boldsymbol{x}_{s} \mid \boldsymbol{x}_t, \boldsymbol{x}_0) = \mathcal{N}\!\left(\boldsymbol{x}_{s}; \boldsymbol{\mu}_{s\rightarrow t}(\boldsymbol{x}_t, \boldsymbol{x}_0),\, \beta_{s \rightarrow t} I\right), \end{align}\] where \(\boldsymbol{\mu}_{s\rightarrow t}\) and \(\beta_{s \rightarrow t}\) can be obtained analytically [20]. Since \(\boldsymbol{x}_0\) is unknown at generation time, the learned reverse process \(p_\theta(\boldsymbol{x}_{s} \mid \boldsymbol{x}_t)\) is trained to match this posterior. In practice, the mean is often reparametrized in terms of the noise (\(\boldsymbol{\epsilon}\)) prediction which yields the simplified regression objective [20]1 \[\begin{align} \label{eq:diff-loss} \mathcal{L}(\theta) = \mathbb{E}_{\boldsymbol{x}_0,\boldsymbol{\epsilon},t} \left[ \|\boldsymbol{\epsilon}- \hat{\boldsymbol{\epsilon}}_t\|_2^2 \right], \end{align}\tag{2}\] with \(\hat{\boldsymbol{\epsilon}}_t := f_\theta(\boldsymbol{x}_t, t)\). After training, starting from \(\hat{\boldsymbol{x}}_T \sim \mathcal{N}(0, I)\) a new sample \(\hat{\boldsymbol{x}}\) is generated by iteratively predicting noise \(\hat{\boldsymbol{\epsilon}}_t\) and sampling a partially denoised \(\hat{\boldsymbol{x}}_{t-1} \sim p_{\hat{\theta}}(\cdot \mid \hat{\boldsymbol{x}}_t, \hat{\boldsymbol{\epsilon}}_t)\) along a decreasing sequence of timesteps \(t=T, T-1,\ldots, 1\), according to the transition rules of a chosen sampler, such as DDPM [20] or DDIM [21].

Beyond sampling, diffusion models also admit tractable likelihood evaluation. In the discrete-time setting we consider, an estimate of \(\log p_{\hat{\theta}}(\boldsymbol{x})\) for any sample \(\boldsymbol{x}\) is obtained by evaluating a variational lower bound (ELBO) [20], [22]; in the continuous-time formulation, the analogous quantity follows from solving the probability flow ODE [18].

3 Methods↩︎

We next describe our approach for estimating the uncertainty of molecules generated by diffusion models. The goal is to produce a single uncertainty score \(u \in \mathbb{R}_{\ge 0}\) that correlates with the quality of a generated sample \(\hat{\boldsymbol{x}} \in \mathbb{R}^{N_a \times D}\), where \(N_a\) is the number of atoms and \(D\) the number of per-atom features (including coordinates). At a high level, we measure the variability of the denoiser’s prediction across sampling steps, based on intuition that samples the model is internally uncertain about should exhibit more variable denoising trajectories, and aggregate this variability over time, atoms, and features into a single score (see 1).

Figure 1: Molecular Generation with Uncertainty

3.0.0.1 Laplace Posterior

As a first step, we fit an approximate posterior over model parameters, \(q(\theta) \approx p(\theta \mid \mathcal{D})\). To remain post-hoc compatible with any pretrained molecular diffusion model, we follow prior work on uncertainty estimation in diffusion models [8], [11] and use the Laplace approximation [23], \[\begin{align} \label{eq:la} q(\theta) = \mathcal{N}(\theta \mid \hat{\theta}, \Sigma), \quad \Sigma = \big(\nabla^2_{\theta} \mathcal{L}(\theta; \mathcal{D}) \big|_{\hat{\theta}} + \lambda I\big)^{-1}, \end{align}\tag{3}\] where \(\hat{\theta}\) are the parameters of the pretrained diffusion model, \(\mathcal{L}\) is the diffusion training loss from Eq. 2 , and \(\lambda\) is the prior precision. To scale to models with many parameters, we follow [13] and apply probabilistic treatment only to the final layers of the network as well as use the empirical Fisher as a Hessian approximation.

3.0.0.2 Noise Prediction Variability

Next, we use the posterior \(q(\theta)\) to measure the variability of the denoiser \(f_{\theta}\) along a sampling trajectory \(\{\hat{\boldsymbol{x}}_t\}_{t=T,\ldots,0}\). Concretely, for a subset of sampling steps \(\mathcal{T} \subseteq \{0, \ldots, T\}\), we draw \(M\) weight samples from the posterior and compute the corresponding noise predictions, \[\begin{align} \boldsymbol{\epsilon}_t^m = f_{\theta_m}(\hat{\boldsymbol{x}}_t, t), \quad \theta_m \sim q(\theta), \end{align}\] and define the intermediate uncertainty \(\boldsymbol{u}_t \in \mathbb{R}_{\ge 0}^{N_a \times D}\) as their elementwise sample variance, \[\begin{align} \boldsymbol{u}_t = \frac{1}{M}\sum_{m=1}^M (\boldsymbol{\epsilon}_t^m - \bar{\boldsymbol{\epsilon}}_t)^2, \quad \bar{\boldsymbol{\epsilon}}_t = \frac{1}{M}\sum_{m=1}^M \boldsymbol{\epsilon}_t^m. \end{align}\] Empirically, we find that a small subset of sampling steps (\(|\mathcal{T}| \ll T\)) is sufficient for good performance, which limits the computational overhead of uncertainty estimation. Finally, we aggregate the per-step uncertainties \(\{\boldsymbol{u}_t\}_{t \in \mathcal{T}}\) into a single score \(u (\hat{\boldsymbol{x}})\) for the generated sample \(\hat{\boldsymbol{x}}\) by averaging across time steps, atoms, and feature dimensions: \[\begin{align} \label{eq:unc95score} u(\hat{\boldsymbol{x}}) := \frac{1}{|\mathcal{T}| \cdot N_a \cdot D} \sum_{t \in \mathcal{T}} \sum_{n=1}^{N_a} \sum_{d=1}^{D} [\boldsymbol{u}_t]_{n,d}. \end{align}\tag{4}\]

Figure 2: Sample quality vs.generation budget on QM9 dataset under filtering-based test-time scaling for EDM and GeoLDM diffusion models. We generate N \in \{10\text{K}, 11\text{K}, \ldots, 20\text{K}\} molecules and keep the 10K with the lowest uncertainty or lowest diffusion NLL ; random subsampling and the no-filter setting at N=10K serve as references. Uncertainty-based filtering improves molecular stability, atomic stability, and validity on both models and consistently outperforms NLL-based filtering, at the cost of a {\sim}1\% drop in uniqueness. Notably, the EDM gains from test-time filtering are comparable in magnitude to those from switching the underlying model to GeoLDM at the 10K generation budget.

4 Experiments↩︎

In our experiments, we first establish that our proposed uncertainty score (Equation 4 ) is informative of sample quality by reporting its correlation with standard sample-level metrics used in molecular generation (4.1). Next, we explore how uncertainty can be used in a test-time compute setting [15], where we oversample generated molecules and use uncertainty as a filtering criterion (4.2). Finally, we report a series of ablations to support our proposed design choices (4.3).

4.0.0.1 Experimental details

We evaluate our approach on two open-source diffusion models for 3D molecular generation: i) EDM [1] is an E(3)-equivariant diffusion model that jointly diffuses atomic coordinates and features in data space, while ii) GeoLDM [2] performs diffusion in a learned equivariant latent space. For both models, we use the official pretrained checkpoints, as our uncertainty estimation is post-hoc and does not require retraining. We use two standard datasets: QM9 [14], containing small organic molecules with up to 9 heavy atoms, and GEOM-Drugs [24], a larger collection of drug-like molecules with substantially more atoms and conformational complexity. For the Laplace approximation, we use default hyperparameters (prior precision \(\lambda=1\), likelihood noise \(\sigma=1\)). We measure uncertainty only in the final \(10\%\) of generation process, i.e. \(t<100\) when using \(T=1000\), as we found that including earlier timesteps yields no or only marginal performance improvements (4.3).

4.1 Uncertainty correlates with sample quality↩︎

To assess whether our proposed uncertainty is predictive of sample quality, we report its correlation with a set of well-established metrics for molecular generation in 1 on QM9 dataset. Across both models, our uncertainty score exhibits a statistically-significant negative correlation, indicating that the measured variability is picking up signal informative of sample quality. Moreover, uncertainty exhibits a stronger negative correlation compared to using diffusion model log-likelihood \(\log p_{\hat{\theta}}(\hat{\boldsymbol{x}})\) (NLL). For example, using the EDM model uncertainty achieves \(-0.284\) correlation with molecular stability, while likelihood gets \(-0.15\).

Table 1: Comparison of uncertainty estimation approaches across model-dataset pairs. We report Spearman rank correlation between the uncertainty score and each quality metric (lower is better). For ours see 1, likelihood is based on (negative )diffusion log-likelihood \(\log p_{\hat{\theta}}(\hat{\boldsymbol{x}})\). For all model/data settings, we report results based on \(N{=}10\)K generated molecules.
:=================== 2-3 (lr)4-5 Metric EDM / QM9 :===========:+:========: Uncertainty | NLL GeoLDM / QM9 :===========:+:========: Uncertainty | NLL
Mol.stab. \(-\)​0.284 \(-\)​0.150 \(-\)​0.333 \(-\)​0.171
Atom.stab. \(-\)​0.305 \(-\)​0.160 \(-\)​0.334 \(-\)​0.178
Validity \(-\)​0.212 \(-\)​0.100 \(-\)​0.266 \(-\)​0.147

4.2 Test-time scaling via uncertainty↩︎

We next examine whether the observed correlation between our uncertainty score and molecular sample quality can be exploited in practice. Following a test-time scaling setting [15], we improve the quality of a fixed-size set of generated molecules via oversampling and filtering: we generate \(N\) samples, with \(N\) varying from \(10\)K to \(20\)K, and retain the \(10\)K with the lowest estimated uncertainty (or, as a baseline, the lowest diffusion NLL). The \(N{=}10\)K case corresponds to no filtering.

Figure 3: Same setup as Figure 2, evaluated on GEOM-Drugs. In contrast to QM9, neither uncertainty- nor NLL-based filtering meaningfully improves molecular stability, atom stability, or validity over random subsampling on this larger, more complex dataset.

Focusing first on QM9 (2), we find that uncertainty-based filtering meaningfully improves molecular stability, atomic stability, and validity across both EDM and GeoLDM. For EDM, oversampling to \(20\)K and filtering down to \(10\)K yields gains of \({\sim}10\%\) in molecular stability, \({\sim}1\%\) in atomic stability, and \({\sim}5\%\) in validity. Notably, these test-time gains are comparable in magnitude to the improvement from switching the underlying model from EDM to GeoLDM at the \(10\)K generation budget, highlighting test-time compute as a complementary axis for improving molecular generation. The gains come with a modest tradeoff in diversity: uniqueness drops by roughly \(1\%\). Finally, the stronger negative correlation of uncertainty relative to NLL translates into larger downstream gains: uncertainty-based filtering outperforms NLL-based filtering across both models and all three quality metrics (molecular stability, atomic stability, validity) on QM9.

On GEOM-Drugs (3), by contrast, test-time filtering fails to meaningfully improve any of the three sample quality metrics, both for our uncertainty score and for NLL. We leave an investigation of why uncertainty-based filtering does not transfer to this larger, more complex dataset to future work.

Figure 4: Spearman rank correlation between single-timestep score uncertainty u_t and atomic stability, as a function of timestep t. Signal concentrates sharply at the clean end of the generation trajectory (t \approx 91) for both EDM and GeoLDM; measuring uncertainty at the start of the generation (large t) provides weaker signal.

4.3 Ablations↩︎

We begin our ablations by isolating the contribution of the Laplace approximation (Equation 3 ). We compare the quality signal from our uncertainty score against a simpler alternative that omits the Fisher approximation of the Hessian and instead samples from an isotropic Gaussian centered at the MAP [25]: \[\begin{align} \label{eq:laplace95ablate} q_{\lambda}(\theta) = \mathcal{N}(\theta \mid \hat{\theta}, \lambda^{-1} I) \: . \end{align}\tag{5}\] As shown in 2, the simpler, Fisher-free variant performs almost on par with the original Laplace approximation in terms of yielding uncertainties that correlate (negatively) with the quality metrics like molecular stability. This suggests that the signal driving our score is closer to a sensitivity measure — the variability of model predictions under small isotropic perturbations of the MAP — than to ‘true’ epistemic uncertainty in a strict Bayesian sense.

Table 2: Ablation on the Laplace approximation (EDM / QM9, \(N=10\)K). We compare our full Fisher-based Laplace posterior against a Fisher-free variant that replaces the covariance with an isotropic Gaussian (Equation 5 ). Same as in 1, we report Spearman rank correlations between the uncertainty score and each quality metric. The two variants perform almost on par, suggesting our score behaves more like a sensitivity measure than ‘Bayesian’ epistemic uncertainty.
:=========== 2-3 Metric EDM / QM9 :========:+:=================: Ours | Ours (w/o Fisher)
Mol.stab. \(-\)​0.284 \(-\)​0.269
Atom.stab. \(-\)​0.305 \(-\)​0.291
Validity \(-\)​0.212 \(-\)​0.216

Finally, we ablate the choice of timesteps \(\mathcal{T}\) at which we measure uncertainty along the generation trajectory. As shown in 4, the timesteps closest to the clean sample (small \(t\)) correlate most negatively with sample quality (atomic stability), supporting our choice to concentrate the uncertainty measurement at the end of the generation process.

5 Conclusion↩︎

We have introduced a post-hoc uncertainty estimation approach for molecular diffusion models based on noise-prediction variability along the sampling trajectory, and empirically validated its effectiveness on QM9. A central limitation is that the approach does not transfer to the larger, more complex GEOM-Drugs dataset, which we leave to future work. One promising direction is to compute uncertainty in a ‘semantic’ feature space—i.e., based on a pretrained molecular encoder—analogous to the approach shown to be effective for uncertainty estimation in high-dimensional image generation [11]. Lastly, our uncertainty score is a natural drop-in replacement for the NLL-based verifier in recently proposed adaptive test-time scaling methods [16], which represents another promising future direction.

References↩︎

[1]
E. Hoogeboom, V. G. Satorras, C. Vignac, and M. Welling, “Equivariant diffusion for molecule generation in 3d,” in International conference on machine learning, 2022, pp. 8867–8887.
[2]
M. Xu, A. S. Powers, R. O. Dror, S. Ermon, and J. Leskovec, “Geometric latent diffusion models for 3d molecule generation,” in International conference on machine learning, 2023, pp. 38592–38610.
[3]
A. Morehead and J. Cheng, “Geometry-complete diffusion for 3D molecule generation and optimization,” Communications Chemistry, vol. 7, no. 1, p. 150, 2024.
[4]
F. Cornet, G. Bartosh, M. N. Schmidt, and C. A. Naesseth, “Equivariant neural diffusion for molecule generation,” Advances in Neural Information Processing Systems, vol. 37, pp. 49429–49460, 2024.
[5]
L. Theis, A. van den Oord, and M. Bethge, “A note on the evaluation of generative models,” arXiv preprint arXiv:1511.01844, 2015.
[6]
E. Nalisnick, A. Matsukawa, Y. W. Teh, D. Gorur, and B. Lakshminarayanan, “Do deep generative models know what they don’t know?” arXiv preprint arXiv:1810.09136, 2018.
[7]
B. Lakshminarayanan, A. Pritzel, and C. Blundell, “Simple and scalable predictive uncertainty estimation using deep ensembles,” Advances in neural information processing systems, vol. 30, 2017.
[8]
S. Kou, L. Gan, D. Wang, C. Li, and Z. Deng, “BayesDiff: Estimating pixel-wise uncertainty in diffusion via bayesian inference,” in ICLR, 2024.
[9]
L. Berry, A. Brando, and D. Meger, “Shedding light on large generative networks: Estimating epistemic uncertainty in diffusion models,” in The 40th conference on uncertainty in artificial intelligence, 2024.
[10]
S. K. Aithal, P. Maini, Z. Lipton, and J. Z. Kolter, “Understanding hallucinations in diffusion models through mode interpolation,” Advances in neural information processing systems, vol. 37, pp. 134614–134644, 2024.
[11]
M. Jazbec, E. Wong-Toi, G. Xia, D. Zhang, E. Nalisnick, and S. Mandt, “Generative uncertainty in diffusion models,” UAI, 2025.
[12]
M. De Vita and V. Belagiannis, “Diffusion model guided sampling with pixel-wise aleatoric uncertainty estimation,” in 2025 IEEE/CVF winter conference on applications of computer vision (WACV), 2025, pp. 3844–3854.
[13]
E. Daxberger, A. Kristiadi, A. Immer, R. Eschenhagen, M. Bauer, and P. Hennig, “Laplace redux-effortless bayesian deep learning,” in NeurIPS, 2021.
[14]
R. Ramakrishnan, P. O. Dral, M. Rupp, and O. A. Von Lilienfeld, “Quantum chemistry structures and properties of 134 kilo molecules,” Scientific data, vol. 1, no. 1, pp. 1–7, 2014.
[15]
N. Ma et al., “Inference-time scaling for diffusion models beyond scaling denoising steps,” arXiv preprint arXiv:2501.09732, 2025.
[16]
G. Lee et al., “Adaptive inference-time scaling via cyclic diffusion search,” arXiv preprint arXiv:2505.14036, 2025.
[17]
J. Sohl-Dickstein, E. Weiss, N. Maheswaranathan, and S. Ganguli, “Deep unsupervised learning using nonequilibrium thermodynamics,” in ICML, 2015.
[18]
Y. Song, J. Sohl-Dickstein, D. P. Kingma, A. Kumar, S. Ermon, and B. Poole, “Score-based generative modeling through stochastic differential equations,” in ICLR, 2021.
[19]
T. Karras, M. Aittala, T. Aila, and S. Laine, “Elucidating the design space of diffusion-based generative models,” in NeurIPS, 2022.
[20]
J. Ho, A. Jain, and P. Abbeel, “Denoising diffusion probabilistic models,” in NeurIPS, 2020.
[21]
J. Song, C. Meng, and S. Ermon, “Denoising diffusion implicit models,” in ICLR, 2021.
[22]
D. Kingma, T. Salimans, B. Poole, and J. Ho, “Variational diffusion models,” Advances in neural information processing systems, vol. 34, pp. 21696–21707, 2021.
[23]
D. J. MacKay, “A practical bayesian framework for backpropagation networks,” Neural computation, vol. 4, no. 3, pp. 448–472, 1992.
[24]
S. Axelrod and R. Gomez-Bombarelli, “GEOM, energy-annotated molecular conformations for property prediction and molecular generation,” Scientific data, vol. 9, no. 1, p. 185, 2022.
[25]
M. Zhdanov, S. Dereka, and S. Kolesnikov, “Identity curvature laplace approximation for improved out-of-distribution detection,” in 2025 IEEE/CVF winter conference on applications of computer vision (WACV), 2025, pp. 7019–7028.

  1. Among other possible parameterizations of the denoising target; see [18], [19].↩︎