Manuscript Offprint
arXiv:2610.11738Scalable AI Uncertainty Quantification via Generalized Laplace Active Subspaces
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Reliable uncertainty quantification (UQ) is essential for deploying neural networks in scientific and high-stakes applications, but full Bayesian inference over the network parameters is computationally infeasible. We propose a low-rank generalized Laplace approximation for neural-network UQ based on a small number of data-informed curvature directions. Starting from a generalized Bayesian posterior defined through an empirical loss, we construct a local Gaussian approximation around a pretrained set of weights in this active curvature subspace. The posterior variances in the retained subspace are available in closed form, and the prior variance is calibrated by an empirical Bayes procedure. The generalized Bayesian formulation allows us to compare two posterior scalings: the standard Bayesian scaling associated with the summed negative log likelihood, and a mean-loss scaling in which the empirical loss is normalized by the number of data. A central finding is that the standard scaling induces a data-size dependent contraction of the posterior variance in the leading active directions. In regression problems, this can force the low-rank framework to retain additional weak-curvature directions in order to achieve nominal coverage of calibration data. When posterior samples are propagated through the non-linear network, these additional directions can degrade the coherence of the predictive intervals.
and shift the posterior predictive mean away from the pretrained model. In contrast, the generalized mean-loss scaling yields a more stable, lower dimensional active subspace and produces calibrated, coherent predictive confidence intervals. These results indicate that generalized Laplace active subspaces provide a practical and scalable route to calibrated uncertainty quantification in neural networks. We demonstrate the method on two regression problems, and a classification case involving an autoregressive molecular language model.
Keywords: uncertainty quantification, neural networks, Laplace posterior, active subspaces
1 Introduction
One of the biggest open questions concerning artificial intelligence (AI) is the reliability and trustworthiness of the predictions which emanate from its output. After training, AI software operating in inference mode can spew out predictions concerning the behaviour of a new system in the same class as those it has been trained on in virtually instantaneous fashion. Such predictions can have enormous value in many real world scenarios. In some situations, qualitative classifications suffice while others require only a modicum of accuracy to be beneficial; still others require accurate and precise predictions or they are not actionable. This last scenario is the one which is most often necessary in scientific and engineering contexts.
To use the results of a calculation inside a scientific procedure, one generally needs to know that the predictions are reliable within defined and suitably limited bounds of uncertainty. Actionable predictions must therefore not only be timely; they need to be of a sufficient level of accuracy and/or precision to be used with confidence. The problem with AI methods in general is that what they output often appears plausible and may pass muster as such for some applications; but in more quantitative scientific and mathematical domains, plausibility is not sufficient: we need to be clear about the level of certainty of its predictions. The key assessments of validation, verification and uncertainty quantification are regularly visited on physics-based models, e.g. for weather and climate prediction [1, 2], turbulence modelling [3, 4], tsunami hazards [5, 6] or biological applications [7]. In these instances there is an exactly defined mathematical model based on clearly defined equations that typically include a variety of parameters, whereas such systematic analysis are significantly more challenging for AI systems.
One immediately noticeable difference between AI and physics-based codes resides in the number of parameters which arise in the two cases. Whereas physics-based codes typically contain around five parameters [3], possibly several hundreds [8] (extending to a few thousand in some large scale codes), each parameter has a well-defined physical meaning pertaining to the underlying model. In AI software there are many orders of magnitude more, none of which has a physical interpretation, as they are simply free parameters. The impressive fitting of input-output data can be readily performed with so many free parameters in play, particularly when one works with held-out data sets.
where all manner of optimisations can be conducted. The approach lends itself to the making of overconfident predictions, which can and often do unravel when the trained system is applied to data which it has not previously encountered. We are interested in the uncertainty of such predictions in terms of the uncertainty in the parameter values of the trained model; unlike a physics-based approach, lacking any physical meaning, these parameters cannot be meaningfully adjusted based on insights into the system which can be gleaned from mathematical models we have created.
The purpose of the present paper is to demonstrate that, despite the lack of clarity as to the meaning of the parameters in an AI system, it is possible to obtain predictive uncertainty estimates. A natural framework for quantifying parameter uncertainty is Bayesian inference [9]. In principle, one would place a prior distribution on the neural-network weights, update this prior by conditioning on data, and propagate the resulting posterior distribution through the network to obtain predictive uncertainty. In practice, since the parameter dimension is extremely large, standard sampling strategies are computationally infeasible. Scalable approximations are therefore unavoidable.
Scalable Bayesian neural-network posterior approximations include variational approaches such as Bayes by Backprop [10], which learns a parametric approximation to the posterior distribution over the network weights, typically using a Gaussian variational family. The resulting training objective is an evidence lower bound, consisting of an expected data-fit term and a Kullback-Leibler (KL) divergence to the prior. In practice, the balance between these two terms can be delicate, and may require specialized training strategies such as KL annealing or cyclical schedules [11].
By contrast, the Laplace approximation [12] is a post-hoc posterior approximation. It also models the parameter posterior by a Gaussian distribution, but this Gaussian is centred at a pre-trained set of weights, and its covariance is obtained from the local curvature of the log posterior density rather than by optimizing a variational distribution during training. While the posterior is now conceptually simple, the computational bottleneck shifts to the covariance matrix of the Laplace approximation, as it is too large to form explicitly for many networks. In this work we circumvent this bottleneck via a generalized-Bayes low-rank Laplace approximation. The posterior is restricted to a low-dimensional active subspace spanned by the dominant Gauss-Newton curvature directions of the empirical mean loss. These directions are computed using matrix-free curvature-vector products, so that the full covariance matrix is never formed. Although active subspaces are originally derived from the dominant directions of an uncentered covariance matrix of the gradient of a (physics-based) model [13], the overarching idea is similar, namely to find a linear projection to a low-dimensional subspace relevant for a quantity of interest. For the original active subspace approach this quantity was the model output subject to a prior distribution, in this work it is the posterior predictive uncertainty of a neural network. Within the subspace spanned by these dominant active directions, the posterior variances are available in closed form, while the prior variance is calibrated using a generalized-evidence criterion. The active subspace dimension is selected by empirical coverage on held-out calibration data, yielding predictive intervals that are both calibrated and sharp.
We derive our low-rank Laplace posterior within the framework of generalized Bayesian inference, where the data is connected to the parameters via a loss function, rather than a traditional likelihood function [14]. In particular we contrast summed with mean loss functions, where the latter is scaled by 1/N, N being the number of data records in the training set. The use of the summed loss equates to the standard Bayesian likelihood function. A central observation of the paper is that the scaling of the generalized posterior is not merely a technical detail. The standard Bayesian scaling leads to an increasingly concentrated posterior variance with the number of training data. To avoid such overconfident predictions, a low-rank approximation should then retain many weak-curvature directions with relatively high posterior variance. This increases the computational cost, and reduces the statistical coherence of the predictive output distribution. In other words, when samples from a local Gaussian weight posterior are propagated through the nonlinear network, these weak directions can shift the predictive mean or distort the resulting uncertainty intervals. Existing methods [15, 16] deal with this issue by replacing the full network with its linear expansion. By contrast, our generalized Bayesian mean-loss scaling avoids the purely data-size-driven contraction, results in a much lower-dimensional active subspace and can retain the full non-linear network. Numerical studies demonstrate that the proposed approach yields coherent predictive intervals with only a small number of active directions.
Before we describe our results, we give a brief overview of our UQ framework, called generalized Laplace active subspaces. Full details are found in the Methods section; the PyTorch code and data to reproduce the results below are available through .
2.1 Generalized Laplace active subspaces
Two choices define our Bayesian posterior. First, instead of seeking a posterior distribution in the original D-dimensional coordinate system of the connection weights, we seek a low-rank coordinate system that is most relevant for the posterior predictive uncertainty. Secondly, we do not employ the standard Bayesian belief update , which uses the likelihood function to connect the parameters to the observed data . For independent Gaussian observations, the corresponding negative log-likelihood is proportional to a summed loss. In contrast, neural networks are typically trained using an average loss , such as the mean squared error, which includes an additional factor . To obtain a Bayesian-style update that is consistent with the average loss used in practice, we adopt the generalized Bayesian framework of [14] instead, which gives rise to the following posterior:
see Section 4.1.1 for more details. The so-called ‘temperature’ parameter controls the contribution of the loss relative to the prior. This formulation includes the standard Bayesian posterior as a special case, obtained by the appropriate choice of , while also allowing alternative scalings such as the mean-loss scaling considered in this work. It therefore provides a convenient framework for studying how posterior scaling (i.e. the choice of ) affects the dimension and structure of the resulting low-rank posterior approximation.
This posterior approximation is obtained by constructing a local Laplace approximation centered at the pre-trained weights . With a commonly-assumed isotropic Gaussian prior , this results in a Gaussian posterior distribution , with
Here, is defined to be the Hessian (curvature) of the mean loss: . For large neural networks this matrix cannot be formed or inverted explicitly, and it may not be positive semi-definite. We therefore replace the full curvature by a low-rank approximation in the dominant eigenspace of the generalized Gauss-Newton matrix (defined by (28)), being a positive semi-definite approximation to . The -dimensional dominant eigenspace with ;
defines the projection matrix , used to obtain the posterior perturbations on top of via
In this way uncertainty is represented only via the dominant curvature-informed directions, along which the data was able to inform the parameters well. In the coordinate system of this subspace the Laplace posterior has diagonal covariance, with
Thus, once the leading eigenpairs of are available, the posterior variances in the retained active directions are obtained in closed form. The eigenpairs are computed using automatic differentiation, matrix-free vector products and the Lanczos algorithm (see section 4.1.5). This avoids explicitly forming , and makes the construction applicable to networks with a large number of parameters. The resulting approximation is therefore both local and low-rank: local because it describes uncertainty around a single trained solution , and low-rank because only a small number of active directions are retained.
The prior variance sets the overall scale of the posterior, and can be calibrated by an empirical-Bayes criterion within the active subspace . The resulting prior variance is found by solving
for . Note that this relation chooses the prior scale such that the norm of the projected parameter vector is consistent with the amount of variance reduction induced by the data in the active subspace.
The posterior predictive distribution is then approximated by sampling (4) and propagating these samples through the neural network . This sampling strategy is denoted as sampled Laplace. However, the non-linear nature of the network may distort the UQ estimates. So-called linearized Laplace methods [15], which replace the full network with its linear expansion (see (45)), are a means to counteract this. We will contrast these two sampling methods below.
2.2 Regression with known observational noise
We start with the same scalar regression function with Gaussian noise as in [18], namely;
using a known noise of .
Implementation verification. This example is used to verify the implementation, in particular the matrix-free computation of and the dominant eigenpairs of . We train a fully-connected feed-forward neural network, using back propagation with Stochastic Gradient Descent and the Adam optimizer [19, 20]. The learning rate was set at 0.001, and we used two hidden layers at 50 neurons each. The dimension of the weight space is , small enough to explicitly form the full matrix (28). The matrix-free vector is contrasted against the corresponding explicit matrix-vector product in Figure 1. The absolute error is in general (using the torch.float32 data type). A similar verification for the matrix-free eigenpairs is displayed in Figure 2.
Standard vs generalized scaling. Next we examine the scaling of the output confidence intervals (CIs) with the temperature parameter , with the CIs computed using the sampled Laplace strategy. As described in Section 4.1.1, the value corresponds to the standard Bayesian setting, whereas with we employ the generalized Bayesian scaling where the task of standard likelihood function is taken up by the mean-squared loss. For both posterior scalings we determine the active

Fig. 1 The matrix-vector product with , computed using the matrix-free method outlined in Section 4.1.5, and by explicitly forming matrix via (28). The absolute error is plotted on the right vertical axis.
subspace dimension as described in Section 4.1.7. Essentially, we increase , starting from and solve (6) for every iteration, until our computed 90% CIs achieve empirical coverage of (at least) 90% of held-out calibration data. Our goal here is to compare this minimal required subspace dimension for both posterior scalings.
Figure 3 displays the result. The generalized Bayesian posterior only required active subspace directions to achieve coverage, and produces coherent CIs. Conversely, the standard Bayesian scaling of required directions and yields slightly wider, less coherent intervals.
The preceding results were obtained with N = 50 training data points. We now compare the standard and generalized scaling using N = 1000. The results from the generalized Bayesian scaling (not shown) are essentially unchanged by the increase in training data, as it still yields a 2D active subspace that generates consistent CIs. We therefore focus on the 90% CI results of the standard Bayesian scaling, as displayed in Figure 4. Clearly, the quality of the mean prediction and the CIs significantly degraded. Furthermore, instead of d = 31, we now required 43 curvature directions to achieve coverage.
Sampled vs linear Laplace. The underfitted results of Figure 4 are a consequence of the of propagating the Laplace posterior through the non-linear network, see also [15]. Instead, the posterior predictive results obtained from linearized Laplace , i.e. from (45), are shown in Figure 5 for N = 100 and N = 1000 for the standard scaling. Due to the linearity of the predictive model, its distribution is Gaussian as well, with a standard deviation given by (46). We therefore perform the coverage calibration using a 95% confidence interval constructed from , which

(a) Eigenvalue fit and errors.

(b) Eigenvector fit and errors
Fig. 2 The leading eigenvalues and leading eigenvector of , computed using the matrix-free method outlined in Section 4.1.5, and by explicitly forming matrix via (28). The absolute errors are plotted on the right vertical axis.
avoids Monte Carlo sampling. We further imposed a maximum subspace dimension of .
As expected, the posterior predictive mean is improved relative to Figure 4, since the linearized predictive distribution is centered by construction at the expansion-point prediction . The confidence intervals are substantially narrower, confirming that the overly wide intervals observed for non-linear posterior sampling are largely caused by propagating weight samples through the non-linear network. However, the linearized predictive distribution is under resolved. For both and , the calibration procedure reaches the maximum allowed dimension of 50, covering only

(a)

(b)
Fig. 3 90% confidence intervals for the, a) generalized Bayesian scaling, and b) standard Bayesian scaling. Both CIs were generated by drawing 1000 posterior samples, and propagating these through the network.
approximately 75% and 40% of the calibration data, respectively, with nominal 95% confidence intervals.
2.3 Regression with unknown observational noise
The following test case involves the Concrete Compressive Strength dataset from the UCI machine learning repository, see [21] for details. This is a regression test case containing N = 1030 samples and 8 input features describing the concrete mixture, and a scalar output corresponding to compressive strength. We train the same architecture

Fig. 4 The results for the standard Bayesian scaling with and . The CIs were generated by drawing 1000 posterior samples, and propagating these through the network.
as the preceding test case, except that now it contains approximately connection weights. This case therefore assesses the scalability of the proposed matrix-free low-rank generalized Laplace approximation.
Since the observation noise is unknown, we estimate the noise via residuals:
which is approximately 0.07 for this test case, and we use this value to specify as before. We set the number of training data to be 90% of the 1030 available data points. The remainder ( ) is used to calibrate . We execute the calibration procedure until our target coverage of 90% is met, or until a preset maximum active subspace dimension is exceeded.
Standard vs generalized scaling. The coverage for both the generalized and standard Bayesian scaling is plotted versus d in Figure 6(a). In the case of the former, the target coverage was reached at d = 3, while for the latter it was never reached within the allotted range. In fact, even at d = 50 only approximately 60% of the calibration data was covered by the 90% CIs.
Sampled vs linear Laplace. The same coverage study was conducted with the linear predictive posterior distribution, using again a 95% confidence interval constructed from . The overall results, see Figure 6(b), are similar compared to the sampled Laplace study. For the generalized scaling, with active dimensions the coverage criterion is met, while the coverage of the standard scaling stagnates.
Due to the multivariate input x, we display the generalized Bayesian posterior predictive results in Figure 7(a) in the form of a parity plot. Here we show the mean predicted compressive strength versus itself with 90% sampled Laplace CIs, and the mean predicted compressive strength versus the calibration data. Visually speaking, for the generalized scaling the CIs are consistent, as the mean is generally centered around

(a) , , 75% coverage

(b) , , 40% coverage
Fig. 5 The results for the standard Bayesian scaling combined with the linearized Laplace predictive posterior distribution, computed using .
the validation data, and the 90% CIs encompass most data without being overly wide. The CIs generated by the standard scaling (Figure 7(b)) are indeed overconfident.
Activity scores. The dominant eigenvectors of G define important directions in parameter space. However, we can also extract information about the importance of individual connections weights. Activity scores, originally derived in [22], are (first-order) sensitivity indices for individual parameters, which can be extracted from the active subspace eigenmodes. Analogously, using the G eigenmodes, we define the activity scores for individual connection weights as:

(a) Sampled Laplace posterior prediction, 90% nominal coverage.
(b) Linear Laplace posterior prediction, 95% nominal coverage.
Fig. 6 The coverage of the calibration procedure as outlined in Section 4.1.7, versus the active subspace dimension d, for both the standard Bayesian scaling and the generalized scaling .

(a) Generalized mean-loss scaling, d = 3.

(b) Standard Bayes scaling, d = 50.
Fig. 7 The parity plot of the mean compressive strength of concrete, with 90% CIs. We show the standard and generalized scaling results, both computed with sampled Laplace.
Here is the i-th component of the j-th eigenvector of G. The activity score measures how strongly parameter coordinate i contributes to the retained d-dimensional curvature-informed active subspace, weighted by the importance of each active direction. Since the connection weights have no physical interpretation, we will use (8) primarily to examine if the contribution to the curvature is broadly distributed across the network, or concentrated in a small subset of connection weights. However, rather than plotting individual , we first sort from largest to smallest and instead plot the cumulative scores

Fig. 8 The cumulative (normalized) activity scores for our concrete compression strength feedforward neural network with approximately weights.
in a log-log plot. The results are shown in Figure 8. We see that the 1000 most-sensitive connection weights (just 0.1% of the total) rapidly saturate and are responsible for most of the curvature sensitivity. In particular, for this case the remaining 99.9% of weights account for 5% of the total sensitivity. This indicates that, in addition to being only d = 3 dimensional, the active subspace is also localised in the high-dimensional weight space.
2.4 Autoregressive classification for molecular generative modelling
For our final (classification) test case we consider the autoregressive molecular language model from [23]. Here, molecules are represented as simplified molecular-input line-entry specification (SMILES) strings, a sequence of characters corresponding to atoms, generated sequentially by a recurrent neural network trained to predict a discrete distribution for the next token. In particular, we use a 3-layer LSTM network part of the REINVENT toolkit ([24]) with 256 neurons per layer and approximately 1.6M weights, trained on SMILES strings from the ChEMBL database ([25]). The M = 34 tokens that make up the SMILES vocabulary and some example ChEMBL molecules can be found in the Appendix. This makes molecular generation a sequence of autoregressive token-level classification problems since, at each step, the network outputs a softmax distribution over the vocabulary, from which the next token is sampled. We study here how the low-rank posterior uncertainty in the network (for both the standard and generalized scaling) affects free-running autoregressive molecular generation. This setting separates the intrinsic stochasticity of the softmax layer from epistemic variability induced by posterior weight perturbations.
Reducing computational cost via subsampling. The LSTM was trained on 1.25M SMILES strings, each containing a (varying) number of tokens, which results in a total number of data records of . As each product used in the Lanczos algorithm is an empirical average over the dataset (see (30)), we choose to randomly subsample the data for computational efficiency, computing the eigendecomposition of using SMILES strings instead. Note a similar strategy was employed by [16]. To examine the effect of this subsampling we plot the (absolute value of) the inner product between the dominant eigenvector and a reference vector as a function of in Figure 9. This reference vector was computed using , and we replicate this procedure times at each subsampling to account for sampling noise, creating 25 possible inner products per . While clear variation is present in the replica inner products for and , soon clusters near 1, indicating that reasonable alignment with the reference eigenvector can be obtained with a small fraction of the total dataset. That said, we note that there is an obvious outlier for . This is most-likely caused by a which failed to converge during the Lanczos algorithm, such that all 5 corresponding cluster near 0.14 in this case. One simple way to flag such outliers for a given is computing the matrix with entries , , being the i-th replica eigenvector. Ill-converged vectors will cause entries away from 1. All subsequent analysis was performed using SMILES, corresponding to data points.

Fig. 9 The inner products as a function of , replicated 25 times per . The reference vectors were computed using SMILES strings.
Standard vs generalized scaling. Our first results concern the output validity, as not all generated molecules are guaranteed to be chemically correct compounds.

Fig. 10 Kernel density estimates of the sequence length for the standard and generalized scaling with . The maximum allowed sequence length is 256.
REINVENT verifies the validity in a post processing step using the RDKit [26]. Note that validity here means RDKit can parse the SMILES string into a molecular graph and the graph passes basic chemical sanitization checks. It does not imply drug-likeness, synthetic accessibility, or chemical plausibility. Table 1 shows the number of valid molecules out of a set of 10k generated SMILES strings for the baseline REINVENT model (i.e. with softmax-only uncertainty and weights fixed at ), and the perturbed model Laplace models with standard and generalized scaling. When varying the active-subspace dimension from 1 to 3, the standard scaling does not result in a notable change in validity compared to the baseline model. For the generalized scaling, validity notably drops.
Table 1 Number of valid SMILES strings (out of 10k).
| baseline | Laplace (std. scaling) | Laplace (gen. scaling) | |
|---|---|---|---|
| d = 1 | 8692 | 8709 | 6863 |
| d = 2 | 8692 | 8753 | 5279 |
| d = 3 | 8692 | 8732 | 4435 |
The following results were obtained using only valid SMILES strings. Figure 10 shows the kernel density estimates of the sequence length of the molecules (i.e. the number of tokens), computed from 10k generated SMILES strings. Once again only the generalized scaling shows a departure from the baseline results. Especially for the generator produces longer SMILES strings, with an increased probability that the maximum allowed sequence length of 256 is reached. Finally, we examine the effect of the Laplace active subspaces on the distribution of several Quantities of Interest (QoIs), described in Table 2. The corresponding distribution are found in Figure 11.
Activity scores. The cumulative activity scores are shown in Figure 12, using . Note the curve saturates less quickly compared to the concrete compression

(a) Molecular weight distributions.

(b) SA score distributions.

(c) SlogP distributions.
Fig. 11 Kernel density estimates of the QoIs for the standard and generalized scaling with .
Table 2 Molecular quantities of interest used to compare generated SMILES distributions within REINVENT.
| Quantity | Description |
|---|---|
| Molecular weight | Molecular size based on atomic masses, large values indicate large molecules. |
| SA score | Synthetic Accessibility score, higher values indicate more difficult synthesis. |
| SlogP | Estimate of how fat-soluble a molecule is. |

Fig. 12 The cumulative (normalized) activity scores for the REINVENT LSTM with approximately 1.6M weights. Computed using .
strength case. Still, the first of the activity scores already account for of the total sensitivity.
3 Discussion
We now discuss our findings and contrast our proposed method with related work.
3.1 Posterior scaling and active-subspace dimension
The results show that the scaling of the generalized posterior plays a central role in the quality and efficiency of our low-rank approximation. Under the standard Bayesian scaling, the leading active directions become increasingly contracted with the number of training data, as with or for regression or classification respectively. This forces coverage calibration to retain many weak-curvature directions.
Note that this does not mean the standard scaling is intrinsically defective, since posterior contraction with increasing data is an expected feature of the standard
Bayesian update. The standard Bayesian scaling and generalized mean-loss scaling define do different posterior objects, and in our specific context of low-rank posterior UQ for overparameterized neural networks, the generalized scaling can provide a more effective posterior approximation.
To further discuss this behaviour, consider Figure 13. For the analytic regression function (7), we plot the posterior variances and the contraction ratio;
for which implies that the -th direction is strongly data-informed (since then ), and values close to zero denote prior-dominated directions ( ). Under the standard Bayesian scaling (Figures 13(b)-13(d)), while the leading directions are almost fully contracted (posterior dominated), the posterior variances remain close to zero over much of the leading spectrum, due to the scaling with : when . Coverage calibration therefore selects directions much deeper in the spectrum, where the posterior variances increase rapidly, as the span multiple orders of magnitude. Consequently, nominal coverage is obtained only after adding directions that introduce substantial parameter-space variability along weak-curvature modes. This effect becomes more pronounced with more training data; in Figure 13(d) the variance along the leading active directions is reduced by an order of magnitude compared to Figure 13(b). As a result, was required to meet the coverage criterion, which exacerbates the aforementioned problems of incorporating weak curvature modes with high variance. In the non-linear network, these larger perturbations may move samples outside the local region in which the Laplace approximation is accurate, resulting in wider and less stable predictive intervals, as shown in Figure 4. A better mean posterior prediction can be obtained with a lower , at the cost of overconfident CIs, or by utilizing the linear predictive distribution. Such overconfident CIs were also observed with the UCI concrete compressive strength network with standard scaling, where 50 curvature directions were insufficient to achieve coverage. The slow increase displayed in Figure 6 also suggests a significantly higher subspace dimension is required to achieve target coverage. Moreover, the retained eigenvalue spectrum spans several orders of magnitude, indicating that the additional directions correspond to genuinely low-curvature modes.
While the linear predictive distribution does remove the non-linear sampling artifacts when they occur, the excessive posterior contraction with N induced by the standard Bayesian scaling is still present for linear Laplace. This is clear from Figures 5-7. In contrast, under the generalized Bayesian scaling, sufficient uncertainty is retained in the leading active directions, regardless of N or the posterior predictive method, and desired coverage was obtained with only d = 4 or less in all cases. Thus, the uncertainty is concentrated in a small number of coherent active directions rather than spread across many weak-curvature modes.
The increase in the selected active subspace dimension under the standard Bayesian scaling is also computationally consequential. Although is not large by modern machine-learning standards, the standard scaling already requires a substantially

(a)
(b)

(c)
(d)
Fig. 13 The contraction ratio (10) and posterior variances (22) for the generalized (left column) and standard (right column) Bayesian scaling, for both N = 50 and N = 1000. These results were computed using the analytic regression function (7).
higher posterior rank to achieve the desired coverage compared to N = 50, which is a problem that will escalate with larger N. That said, as we showed in Section 2.4, for large datasets one could subsample the data when computing the eigenmodes of G. Still, computing these modes under the standard scaling will require a larger d, and therefore more Lanczos iterations (see Section 4.1.5). Thus, the standard Bayesian scaling not only shifts uncertainty into weaker-curvature directions, but also increases the computational cost of the low-rank posterior approximation compared to the generalized scaling. In contrast, the generalized Bayesian mean-loss scaling achieves calibrated and sharp confidence intervals with a much smaller active subspace. The proposed approach therefore provides a practical route to calibrated predictive uncertainty for regression-based neural networks.
Similarly, for our autoregressive classification case, the standard scaling resulted in distributions that do not deviate from the baseline REINVENT model in any notable fashion, see Figure 11. The low-rank Laplace perturbations with appear to add meaningful variation to the generated molecular distribution while remaining broadly within the regime learned by the pretrained generator. In contrast, clearly crosses a stability boundary. The generator can start to produce some long (carbon-rich), formally valid yet chemically implausible molecules with extreme SlogP values. Lipinski's Rule of Five [27] is a rule of thumb used in drug discovery to evaluate if a chemical compound has the right properties to make it an orally active drug in humans. One violating condition of this rule is an SlogP value greater than 5, which occurs at a significantly higher probability once d = 3. This suggests that the addition of third active direction pushes the autoregressive dynamics outside the chemically meaningful region of the model.
Overall, under standard Bayesian scaling, the low-rank Laplace generator remains close to the pretrained baseline for all tested subspace dimensions. Valid-molecule QoI distributions and sequence lengths are not meaningfully affected, indicating that the posterior samples remain in a local generative regime. The reason behind this is the same as in the regression case, and again will be become even more pronounced with increasing (subsampled) data size. In contrast, under generalized scaling, increasing the active-subspace dimension produces progressively stronger deviations from the baseline. The most pronounced effect is in the sequence-length distribution, where a higher d introduces a long right tail, suggesting that generalized posterior perturbations affect the learned stopping behaviour. The same scaling also broadens the QoI distributions, indicating increased chemical exploration at the cost of generative stability.
However, this was only a sensitivity study of the effect of posterior weight perturbations on free running molecule generation. Our pretrained REINVENT model is already reasonably calibrated at the token level, and we therefore did not expect the additional uncertainty of the Laplace posterior to improve the predictive distribution. That said, low-rank Laplace methods have also been proposed for fine-tuned large language models (LLMs). For instance, the low-rank adaptation (LoRA) method of [28] is a means to fine tune an LLM by introducing low-rank updates to selected weight matrices. This deterministic fine-tuning can make the model poorly calibrated, often overconfident. Laplace-LoRA, introduced by [29] places a Laplace posterior over the fine-tuned LoRA parameters to induce variability in the logits/predicted probabilities. The prior precision is tuned using gradient descent, maximizing the Laplace evidence, such that the posterior predictive distribution becomes better calibrated and achieves lower negative log likelihood. Extending our generalized-Bayes active-subspace Laplace approximation to fine-tuned language models is therefore a promising direction for future work. This would shift the role of the Laplace approximation from probing generative sensitivity, as in the present REINVENT experiments, toward correcting overconfidence in fine-tuned autoregressive models.
Finally, the activity scores from Figures 8 and 12 show that the active subspace is concentrated in a very small subset of all connection weights, relative to the total weight space. However, the active subspace itself provides an even more compact representation, as it is a linear combination of connection weights instead of a collection of individual weights. Similar observations have been made in physics-based models, see e.g. [8].
3.2 Related work
In recent years several contributions to the problem of uncertainty quantification for neural networks have been made, see [30] or [31] for survey articles. Here we discuss those most relevant to our work.
Our work is related to the subspace inference framework of [32], where Bayesian model averaging is performed within low-dimensional parameter subspaces constructed from random projections, SGD-trajectory PCA, or mode-connecting curves. In contrast, we construct the subspace from the dominant generalized Gauss–Newton curvature directions of the empirical mean loss. In [32] posterior tempering is also used as a calibration device, although here the temperature is a hyper parameter selected by cross-validation, rather than being fixed by the loss function used in generalized Bayes. Our curvature-based setting exposes the different scaling issue of increasingly contracted leading active directions with N for the standard scaling. The generalized Bayesian mean-loss scaling avoids this purely data-size-driven contraction. A further distinction is that our generalized Laplace approximation yields a closed-form Gaussian posterior in the active subspace, avoiding Markov-Chain Monte Carlo sampling or variational optimization within the subspace.
Most closely related is the low-rank Laplace subspace construction of [16], whose authors derive an optimal low-dimensional subspace model for approximating the predictive output covariance of a full Laplace approximation and propose a scalable compute strategy. Their construction is formulated in the linearized Laplace setting discussed previously. This linearization yields a closed-form Gaussian on both the networks weights and the output, which [16] use to find the subspace projection matrix P by minimizing the discrepancy between the output covariance of the subspace model and that of the full Laplace approximation. However, the exact construction requires access to quantities that are generally inaccessible for large neural networks, including the full (GGN) curvature matrix and an eigendecomposition of the full output covariance. In practice, scalable variants therefore rely on additional approximations such as diagonal or Kronecker-factored curvature estimates [33].
Our goal is different. Rather than computing the output covariance of the full Laplace approximation, we construct a generalized-Bayes Laplace approximation directly in a curvature informed active subspace. The posterior samples are propagated through the non-linear network itself rather than through a linearized predictive model. This distinction is important since linearized Laplace methods keep the posterior predictive mean anchored at the MAP prediction (see section 4.1.8), and can thereby avoid the underfitting behaviour observed when non-linear weight samples are propagated through the network. In our non-linear predictive setting, the size and coherence of the sampled parameter perturbations are therefore central; if the calibrated posterior requires many weak-curvature directions, the resulting samples may leave the local region in which the Laplace approximation is reliable. The generalized Bayesian scaling mitigates this effect by achieving calibrated coverage with a much smaller active subspace, thereby reducing both non-linear sampling artifacts and the number of curvature-vector products required.
Also, the authors of [16] shows that a low-dimensional subspace can approximate the full predictive covariance of the linearized Laplace approximation, but the required subspace dimensions are still in the tens to hundreds in their experiments. While this is tiny compared to the size of the full weight space, our generalized-Bayes active subspace often achieves calibrated coverage with only a handful of curvature directions, preserving the intended low-rank character of the approximation.
There are a number of other contributions that use the Laplace approximation of the posterior. The authors of [34] proposed a scalable Laplace approximation for neural networks using the aforementioned Kronecker-factored curvature estimates of [33]. This approach improves scalability by imposing a layer-wise Kronecker structure on the curvature, whereas our method obtains scalability by restricting the posterior to a low-rank generalized Gauss-Newton active subspace. Consequently, our approach does not require layer-wise Kronecker independence assumptions. The broader practical relevance of Laplace approximations for Bayesian deep learning has been demonstrated by [35], whose authors review and benchmark several scalable Laplace variants and provide a dedicated laplace PyTorch library.
Related active-subspace approaches based on variational inference include [18] and [36]. These methods draw on the classical active-subspace construction, in which the subspace is identified from an uncentered covariance of model gradients [13]. This matrix is typically averaged over a prescribed prior weight distribution. In contrast, our active subspace can be viewed as a Monte Carlo approximation of a data-averaged local curvature matrix. Specifically, the generalized Gauss–Newton matrix is an empirical average over the training data, evaluated at the pretrained weights. Thus, unlike prior-averaged active-subspace constructions, our subspace is tied directly to the local data-fit geometry that also defines the generalized Laplace approximation.
4 Methods
We now describe the methodological details of the proposed low-rank generalized Laplace framework for uncertainty quantification in neural networks.
4.1 Statistics
Our method starts from a generalized Bayesian posterior defined through the empirical mean loss, rather than the summed negative log-likelihood used in standard Bayesian analysis. Around a pretrained set of weights, we then construct a Laplace approximation whose covariance is determined by the local curvature of the loss. Since the full Hessian is intractable and may be indefinite, we replace it by a positive semi-definite generalized Gauss-Newton approximation [37] and compute its dominant eigenspace using matrix-free products computed with automatic differentiation. The resulting Gaussian posterior is restricted to this low-dimensional active subspace, with the prior variance calibrated by an empirical generalized-Bayes evidence criterion. We end with a discussion on posterior sampling strategies.
4.1.1 Generalized Bayes formulation
To define a posterior update, a mechanism to connect the parameters to the data is required. In a generalized Bayesian setting this is achieved via a loss function rather than through a traditional likelihood function. This allows us to construct a generalized posterior based on the empirical mean loss while retaining the familiar structure of a prior-to-posterior belief update. We define the mean loss function as
We will consider:
i.e. squared-loss and cross-entropy loss terms for regression and classification respectively. In the former are the (noisy) observations of the true process, whereas in the latter is the -dimensional one-hot encoded vector with for and for , being the index of the correct class. Here, the neural-network outputs are the logits that determine the softmax probabilities
The generalized Bayesian (unnormalized) posterior is given by [14] as:
where we assume the following prior:
Here, is the -dimensional identity matrix and is a so-called temperature parameter, which typically is a hyper parameter used to control how random the output of a neural networks is. Here we will use it to distinguish between generalized and standard Bayesian setting. Further note that the prior variance of the connection weights will play an important role in subsequent analysis. Finally, we write the normalized posterior as , with the normalizing constant denoted as the marginal likelihood or the evidence.
In the case of a regression problem with Gaussian noise, the following statistical model is often assumed to relate the model f to the data y;
Here, is the noise variance, which is assumed known, or estimated from residuals. Under this model, the standard Bayesian posterior is recovered by setting in (14), which is equivalent to replacing with a summed loss. In contrast, the generalized posterior based on the mean squared loss is obtained using . For classification with softmax cross-entropy, there is no analogous Gaussian noise variance. Similarly, corresponds to the summed categorical negative log-likelihood of the standard Bayesian posterior, whereas the generalized posterior based on the mean cross-entropy loss requires .
4.1.2 Laplace approximation of the generalized posterior
We define as the negative log of (14), i.e.;
The most-likely maximum a-posteriori (MAP) parameter value solves
We will use the pretrained weights in place of the MAP value, which is a common approximation (also used by e.g. [34] and [15]) unless the network was trained using L2 weight decay with regularization strength consistent with the values of and . In our approach, serves as the anchor point for the Laplace approximation, originally applied by [12] to small neural networks. This approximation models the posterior distribution as a Gaussian distribution, with a covariance structure defined from (the inverse of) the curvature of the log-likelihood function. The underpinning idea here is that the log likelihood quickly drops away (i.e. has high curvature) when the data is able to inform the parameters well. For generalized Bayes, the covariance structure is derived from the curvature of the loss function instead. To arrive at such an expression a second-order Taylor expansion of around is made
where under the assumption that is sufficiently close to a stationary point of , the first-order term drops out: . Given (19), the posterior now becomes a Gaussian :
with
Note that here is defined to be the Hessian of the mean loss, .
The Gaussian form is thus a consequence of truncating the Taylor expansion around at the quadratic term, it is not statement that the full neural-network posterior is indeed normally distributed, which may well be multi-modal and non-Gaussian. The Laplace approximation is therefore a pragmatic, local posterior estimate around one trained solution, not as a faithful global description of all plausible weights. We examine its usefulness through its posterior predictive behaviour, i.e. by the resulting posterior distribution of the neural-network output.
The Laplace approximation gives a closed-form expression for the posterior on . Unlike UQ approaches based on (low-rank) variational inference (e.g. [18, 36]), no additional training is therefore required. Still, computing and inverting is computationally intractable in neural networks due to the size of . To overcome this limitation we will construct a computationally tractable closed-form expression for the posterior variance.
4.1.3 Low-rank posterior variance
By examining (21), we observe that in the principal coordinate system spanned by the eigenvectors from , the posterior variances become;
In practice, a low-rank framework is obtained by retaining only the first dominant eigenvalues of an approximation to the Hessian. The quality of this approximation depends on how well the approximate Hessian captures directions of significant curvature (see Section 4.1.4), as well as on the choice of prior variance .
It is not uncommon to find references which discuss Hessian approximations in the context of the sum loss, see e.g. [37]. As discussed, in the present work we use the loss from generalized Bayes rather than the summed negative log-likelihood. This corresponds to a temperature-scaled posterior where the parameter controls how strongly the data loss is weighted relative to the prior (see (14)). For or (mean regression / classification loss), the likelihood contribution is normalized by the number of data points. This normalization prevents the curvature eigenvalues from scaling linearly with N, such that the curvature is governed by the shape of the mean loss landscape, not by the size of the dataset. This is important in our low-rank subspace setting, since as N increases, the posterior variances (22) decrease in the standard Bayesian setting with or . While in this setting posterior contraction is expected as N grows, in a low-rank projected posterior this can become too aggressive, and the leading active directions become extremely narrow. Using the mean loss avoids this purely sample-size-driven contraction. It makes the eigenvalues describe the average local sensitivity of the trained model rather than the total accumulated data-fit curvature.
Regardless of the choice of , the form highlights the interplay between data and prior. Directions with large average curvature (large ) lead to stronger posterior contraction, while in flat directions ( ) the posterior variance reverts to the prior, . Thus, the prior variance acts as a baseline level of uncertainty in directions not informed by the data.
Since appears explicitly in the posterior variance and controls the overall scale of uncertainty, it must be chosen carefully. We estimate using an empirical Bayes procedure in Section 4.1.6. First, we discuss common choices for the approximate Hessian, and means to efficiently extract their dominant eigenpairs.
4.1.4 Approximate Hessians
In general, an issue with using the true Hessian in the covariance expression is that it is not guaranteed to be positive semi-definite. Several approximations are therefore commonly employed, most notably the generalized Gauss–Newton matrix G, which coincides with the true Hessian only under specific assumptions [37]. Understanding the precise conditions under which these matrices agree, and how they differ otherwise, is essential for justifying their use as curvature surrogates. In the following, we briefly make these relationships explicit and discuss their implications for subspace-based uncertainty quantification.
One can decompose the Hessian into a term involving second derivatives of the model output, and a (more tractable) term that depends only on first-order derivatives. A natural approach is to apply the chain rule to (11), differentiating with respect to f before taking the derivative. The resulting gradient will have entries
where are residuals, defined as:
for regression or classification. Note that for the latter, is a probability residual, which unlike its regression counterpart, is a function of all entries (see (13)). Applying the chain rule to (23) once more gives the Hessian entries:
When written in matrix form we obtain:
Here, is the Jacobian of the output, and is a Hessian with , leading to
for regression and classification respectively.
The generalized Gauss–Newton (GGN) matrix G is an approximation to that captures (partial) curvature information while avoiding second-order derivatives of the model, and is obtained by simply ignoring the first term of (26);
This is convenient as it drops the (expensive) Hessians of . Moreover, from (26) we can see that this is a well-justified approximation as argued by [37], in the sense that the neglected term vanishes when the residuals are small. For (28) to be exact, it would be sufficient if all residuals are zero. However, this is unrealistic, and would be indicative of overfitting. The authors of [15] therefore prefer an alternative justification for the use of , namely that it is equivalent to replacing the network by its first-order Taylor expansion around , for which holds. This leads to so-called linearized Laplace predictive distributions, discussed in Section 4.1.8.
Finally, we note that empirical work has shown that the loss gradient aligns strongly with the leading eigenvectors of the Hessian, see [38], implying that optimization proceeds primarily within a subspace spanned by a small number of dominant curvature directions. This observation provides support for low-rank posterior approximations involving (approximate) Hessians; if training mainly explores a restricted subspace, then uncertainty quantification should focus on these same directions. Our approach leverages this structure by constructing a posterior covariance aligned with the dominant eigenspace of . As mentioned, we use the term active subspace to denote the dominant eigenspace of the generalized Gauss-Newton curvature of the empirical mean loss, which is a slight departure from its original definition [13]. That said, the overarching idea is similar, as is the linear projection to the active subspace;
here applied to the connection weights. contains the dominant (orthonormal) eigenvectors of . In order to form for large neural networks, we first discuss matrix-free eigenvalue methods.
4.1.5 Matrix-free computation of dominant eigenpairs
In practice, computing the dominant eigenvalues / vectors of will be complicated by the dimension of . For large enough , even storing in memory will not be possible. However, we can use the Lanczos algorithm [39, 40] to approximate the leading eigenpairs, which only requires access to matrix-vector products . These products can be computed using automatic differentiation without ever forming . If we write for brevity, we obtain
see (28). In general, by the chain rule, the Jacobian-vector product equals
which in turn can be computed with forward-mode automatic differentiation, see e.g. [41]. Once is available at the output, pre-multiplication with the known (27) yields . If we define the auxiliary scalar loss function such that its derivative equals , then once again by the chain rule;
which equals the n-th term of (30) and can be computed using standard back propagation. Hence, each of the N contributions to Gv can be evaluated using one forward-and one backward-pass through the network, without ever explicitly forming the Jacobian or the matrix G. In practice one uses mini-batches in place of a term-by-term computation. In addition, libraries such as PyTorch have dedicated subroutines for computing the required Jacobian-vector products.
Access to Gv enables scalable computation of the dominant eigenspace of G in high-dimensional settings. Briefly, we use the Lanczos algorithm, a well-known iterative method for approximating a few extremal eigenvalues and eigenvectors of a symmetric matrix using only matrix-vector products. Starting from an initial unit vector , it constructs an orthonormal basis of the Krylov subspace span via the recursion
with , which follows from a Gram-Schmidt procedure. This yields a low-dimensional symmetric tridiagonal matrix with constructed from , coefficients (see e.g. [39]) for which
holds, where . The eigenvalues of directly approximate the leading eigenvalues of , and approximate the corresponding eigenvectors, being the eigenvectors of .
The first columns of define our projection matrix . Note that in order to bring the error down as in Figure 2, it is important to select a sufficiently high number of basis functions to span the Krylov subspace. We used . Crucially, note that the method requires only repeated evaluations of , making it well-suited for large-scale settings where cannot be formed explicitly.
4.1.6 Empirical generalized Bayesian subspace inference for the prior variance
As previously mentioned, the value of the prior variance plays an important role in (22), and must be chosen with care. However, defining a plausible prior on the connection weights is challenging due to their lack of physical meaning. Empirical Bayesian inference [42] provides a solution in this context by allowing us to estimate directly from the data . That said, the severe overparameterization of neural networks again poses specific challenges. We found that applying empirical Bayes directly in the full, high-dimensional parameter space forces the optimization toward excessively high values to compensate for the many flat, uninformative directions. To resolve this, we perform empirical Bayes in the projected parameter space defined by the active subspace . Again, let contain the dominant eigenvectors of and define
The loss restricted to the active subspace is then
Our analysis will proceed similar to Section 4.1.2. Let be the generalized unnormalized posterior in the w subspace, i.e.;
with the prior . We find by maximizing the generalized evidence:
The log density is given by
with defined as the negative log unnormalized generalized posterior density:
We now insert a Taylor expansion for around into (36), to give rise to a Laplace approximation;
As in the full-space Laplace approximation, we assume that is sufficiently close to a stationary point of , so that the first-order term in the Taylor expansion can be neglected. The second log term contains the integral of the unnormalized Laplace posterior in the active subspace, with , and therefore equals the reciprocal of the Gaussian normalizing constant. Defining , (38) then becomes;
(39)
The loss does not depend explicitly on , and is therefore considered constant in this approximation. In the last line we swap out with an approximate Hessian discussed in Section 4.1.4 (i.e. ), and the low-rank structure of allows us to then compute the determinant using only the dominant eigenvalues obtained from the matrix-free method of Section 4.1.5. Setting , we now find that
(40)
Solving for the projected weight norm;
(41) with being the posterior variance (22). Therefore, the resulting sets the prior scale such that the magnitude of the projected parameter vector is consistent with the amount of variance reduction in the active subspace.
Note that performing this analysis in the full parameter space will lead to an expression involving in place of , which will be very large for overparameterized neural networks. This then leads to an excessively large prior variance .
Although (41) defines an implicit and non-linear equation for , the corresponding function is smooth and strictly decreasing in , and therefore admits a unique solution. This solution can be efficiently obtained using standard one-dimensional root-finding methods (we use the bisection method).
4.1.7 Calibrating d
The dimension of the active subspace is a hyperparameter that must be set. For regression problems, we will do so by evaluating the coverage of the output confidence intervals on a calibration data set , . Let be the confidence interval for . Our value of minimizes
Here 1[A] is an indicator function returning 1/0 if A is true/false. Note that for each d, we must perform the empirical Bayesian analysis of Section 4.1.6, such that d and are estimated jointly. Calibration in the context of classification entails making sure the correct class in contained in the set with (approximately) probability .
A similar calibration procedure can be applied to a classification network [29, 43]. However, if a classification network is already well calibrated, the additional stochasticity introduced via weight perturbations may diminish calibration, see the Discussion section.
4.1.8 Posterior prediction
The posterior variance (22) corresponds to the Laplace approximation restricted to the dominant eigenspace of the curvature matrix. In the full parameter space, directions orthogonal to this subspace have variance , corresponding to the prior. While these directions are individually flat, they are vast in number ( ), and can collectively contribute significantly to predictive uncertainty, often resulting in overly wide confidence intervals when posterior samples are propagated through the non-linear network.
Similar to e.g. [16, 18], we therefore omit these directions and obtain a low-rank approximation that concentrates uncertainty in the data-informed subspace. Sampling from this approximate posterior is then performed via
Using these samples during a forward pass we can approximate expectations such as
via Monte Carlo sampling, pushing the Laplace posterior through the network. As the Laplace posterior is an approximation, the non linear nature of the network may push the mean prediction away from the MAP prediction.
This underfitting problem of sampled Laplace does not primarily mean that the Gaussian posterior family is insufficiently expressive. Rather, it refers to a degradation of the posterior predictive mean caused by propagating local Gaussian weight samples through the non-linear network. As mention in Section 4.1.4, linearized Laplace [15] avoids this by making the a local linear approximation in the predictive model, thereby keeping the posterior predictive mean fixed at the MAP prediction:
where . The combination of the linear output and the Gaussian distribution of also leads a closed-form predictive covariance , where , with is our low-rank Laplace posterior covariance. In the case of scalar regression the (pointwise) posterior predictive variance becomes
with denoting the j-th column vector of .
Supplementary information. For this article no Supplementary Materials are available.
Acknowledgements. We thank Dr Ketan Maheshwari at the US Department of Energy Oak Ridge National Laboratory and Dr Alessandro Tibo at AstraZeneca for helpful discussions and support with training REINVENT. We also thank Dr Laura Harbach at Brunel University London for initiating the REINVENT UQ study.
Declarations
Funding
P.V.C. is grateful for funding from the UK Engineering and Physical Sciences Research Council under the following project “UK Consortium on Mesoscale Engineering Sciences (UKCOMES)” (Grant No. EP/R029598/1).
Competing interests
The authors declare no competing interests.
Ethics approval and consent to participate
Not applicable.
Consent for publication
Not applicable.
Data and code availability
The data used to train the neural networks, a pre-trained REINVENT model and Jupyter notebooks to reproduce the results of this article are available at [17].
Materials availability
Not applicable.
Author contribution
W.N.E. developed the methodology, implemented the algorithms, performed the numerical experiments, analysed the results, and wrote the initial manuscript. P.V.C. contributed to the conceptual framing, interpretation of results, funding acquisition and manuscript revision. Both authors reviewed and approved the final manuscript.
Declaration on the use of artificial intelligence tools
The authors used OpenAI's ChatGPT 5.5 as a tool for language editing. The tool was also used to discuss manuscript presentation, related-work positioning, and the interpretation of selected numerical results. All scientific claims, mathematical derivations, algorithms, references, numerical experiments, and conclusions were reviewed, verified, and finalized by the authors. The authors assume full responsibility for the content of the manuscript.
Appendix A ChEMBL vocabulary
Here we describe the ChEMBL vocabulary in Table A1 and display some example chemical compounds in Table A2.
Table A1 Vocabulary used by the autoregressive SMILES generator. The vocabulary contains start and stop tokens, bond symbols, branch symbols, ring-closure indices, atom tokens, and charged or aromatic atom tokens.
| Index | Token | Description | Index | Token | Description |
|---|---|---|---|---|---|
| 0 | $ | Stop/end token | 17 | Br | Bromine atom |
| 1 | ` | Start token | 18 | C | Aliphatic carbon atom |
| 2 | # | Triple bond | 19 | Cl | Chlorine atom |
| 3 | %10 | Two-digit ring closure | 20 | F | Fluorine atom |
| 4 | ( | Branch opening | 21 | N | Aliphatic nitrogen atom |
| 5 | ) | Branch closing | 22 | O | Oxygen atom |
| 6 | - | Single bond | 23 | S | Sulfur atom |
| 7 | 1 | Ring closure index | 24 | Positively charged nitrogen | |
| 8 | 2 | Ring closure index | 25 | Negatively charged nitrogen | |
| 9 | 3 | Ring closure index | 26 | Negatively charged oxygen | |
| 10 | 4 | Ring closure index | 27 | Positively charged sulfur | |
| 11 | 5 | Ring closure index | 28 | Positively charged aromatic nitrogen | |
| 12 | 6 | Ring closure index | 29 | Protonated aromatic nitrogen | |
| 13 | 7 | Ring closure index | 30 | C | Aromatic carbon atom |
| 14 | 8 | Ring closure index | 31 | n | Aromatic nitrogen atom |
| 15 | 9 | Ring closure index | 32 | o | Aromatic oxygen atom |
| 16 | = | Double bond | 33 | s | Aromatic sulfur atom |
Table A2 10 SMILES strings from the ChEMBL database.
| No. | SMILES |
|---|---|
| 1 | CC(C)C(NC(=0)C(NC(=0)C10C20C(C)(C)OC2C20C(C)(C)OC12)C(C)C(C(O)=0) |
| 2 | Fc1ccc(cc1)C(=0)NN1C(SCc2ccc(cc2)N(=0)=0)=Nc2ccccc2C1=0 |
| 3 | CC(C)CN1Cc2cnnn2-c2ccc(cc2C1)-c1ccccc1 |
| 4 | CCN(C(=0)CSc1nnnn1-c1ccccc1)C1=C(N)N(Cc2ccccc2)C(=0)NC1=0 |
| 5 | CC(C)N1CCN(CC1)C(=0)N1c2ccccc2Sc2ccccc12 |
| 6 | CC1(C)Cc2cc(0Cc3ccc(cc3)-c3nn[nH]n3)c(C1)c(C1)c2C1=0 |
| 7 | Cc1cccc(CSc2ccc(cn2)C(=0)Nc2ccc(F)cc2)c1F |
| 8 | CCC(N1N=C(O)C2=Nc3cc(C1)ccc3C(=0)C2=C10)c1ccccn1 |
| 9 | CC(N1C(=0)C2OC3(C)C=C(C)C=NC3C2C1=0)c1ccccc1 |
| 10 | Cc1nc(cs1)-c1cccc(NC(=0)c2ccc3nc4C(=0)NCCCn4c3c2)c1 |
References
[1] Palmer, T.N.: Predicting uncertainty in forecasts of weather and climate. Reports on progress in Physics 63(2), 71–116 (2000)
[2] Murphy, J.M., Sexton, D.M.H., Barnett, D.N., Jones, G.S., Webb, M.J., Collins, M., Stainforth, D.A.: Quantification of modelling uncertainties in a large ensemble of climate change simulations. Nature 430(7001), 768–772 (2004)
[3] Cheung, S.H., Oliver, T.A., Prudencio, E.E., Prudhomme, S., Moser, R.D.: Bayesian uncertainty analysis with applications to turbulence modeling. Reliability Engineering & System Safety 96(9), 1137–1149 (2011)
[4] Gorlé, C., Iaccarino, G.: A framework for epistemic uncertainty quantification of turbulent scalar flux models for reynolds-averaged navier-stokes simulations. Physics of Fluids 25(5) (2013)
[5] Liu, X., Guillas, S.: Dimension reduction for Gaussian process emulation: An application to the influence of bathymetry on tsunami heights. SIAM/ASA Journal on Uncertainty Quantification 5(1), 787–812 (2017)
[6] Selva, J., Tonini, R., Molinari, I., Tiberti, M.M., Romano, F., Grezio, A., Melini, D., Piatanesi, A., Basili, R., Lorito, S.: Quantification of source uncertainties in seismic probabilistic tsunami hazard analysis (sptha). Geophysical Journal International 205(3), 1780–1803 (2016)
[7] Avitabile, D., Cavallini, F., Dubinkina, S., Lord, G.J.: Neural field equations with random data. SIAM/ASA Journal on Uncertainty Quantification 14(2), 534–567 (2026)
[8] Edeling, W.N., Vassaux, M., Yang, Y., Wan, S., Guillas, S., Coveney, P.V.: Global ranking of the sensitivity of interaction potential contributions within classical molecular dynamics force fields. npj Computational Materials 10(1), 87 (2024)
[9] Gelman, A.: Bayesian data analysis. Chapman and Hall/CRC (2013)
[10] Blundell, C., Cornebise, J., Kavukcuoglu, K., Wierstra, D.: Weight uncertainty in neural network. In: International Conference on Machine Learning, pp. 1613–1622 (2015). PMLR
[11] Fu, H., Li, C., Liu, X., Gao, J., Celikyilmaz, A., Carin, L.: Cyclical annealing schedule: A simple approach to mitigating KL vanishing. In: Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 240–250 (2019)
[12] MacKay, D.J.C.: A practical Bayesian framework for backpropagation networks. Neural computation 4(3), 448–472 (1992)
[13] Constantine, P.G., Dow, E., Wang, Q.: Active subspace methods in theory and practice: applications to kriging surfaces. SIAM Journal on Scientific Computing 36(4), 1500–1524 (2014)
[14] Bissiri, P.G., Holmes, C.C., Walker, S.G.: A general framework for updating belief distributions. Journal of the Royal Statistical Society Series B: Statistical Methodology 78(5), 1103–1130 (2016)
[15] Immer, A., Korzepa, M., Bauer, M.: Improving predictions of Bayesian neural nets via local linearization. In: International Conference on Artificial Intelligence and Statistics, pp. 703–711 (2021). PMLR
[16] Faller, J., Martin, J.: Low rank based subspace inference for the Laplace approximation of Bayesian neural networks. In: The 29th International Conference on Artificial Intelligence and Statistics (2026). https://openreview.net/forum?id=RTwTXQX4gq
[17] Edeling, W.N.: GLAS: Generalized Laplace Active Subspaces. https://github.com/wedeling/GLAS. GitHub repository (2026)
[18] Jantre, S., Urban, N.M., Qian, X., Yoon, B.: Learning active subspaces for effective and scalable uncertainty quantification in deep neural networks. In: ICASSP 2024-2024 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5330–5334 (2024). IEEE
[19] Kingma, D.P., Ba, J.: Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980 (2014)
[20] Aggarwal, C.C.: Neural Networks and Deep Learning vol. 10. Springer, ??? (2018)
[21] Yeh, I.: Concrete Compressive Strength. UCI Machine Learning Repository. DOI: https://doi.org/10.24432/C5PK67 (1998)
[22] Constantine, P.G., Diaz, P.: Global sensitivity metrics from active subspaces. Reliability Engineering & System Safety 162, 1–13 (2017)
[23] Olivecrona, M., Blaschke, T., Engkvist, O., Chen, H.: Molecular de-novo design through deep reinforcement learning. Journal of cheminformatics 9(1), 48 (2017)
[24] Loeffler, H., He, J., Tibo, A., Janet, J.P., Voronov, A., Mervin, L.H., Engkvist, O.: Reinvent 4: Modern AI-driven generative molecule design. Journal of Cheminformatics 16(1), 20 (2024)
[25] Gaulton, A., Hersey, A., Nowotka, M., Bento, A.P., Chambers, J., Mendez, D., Mutowo, P., Atkinson, F., Bellis, L.J., Cibrián-Uhalte, E., et al.: The ChEMBL database in 2017. Nucleic acids research 45(D1), 945–954 (2017)
[26] Landrum, G., Tosco, P., Kelley, B., Cosgrove, D., Vianello, R., Kawashima, E., Jones, G., Dalke, A., Cole, B., Swain, M., et al.: rdkit/rdkit: 2026_03_4. Zenodo (2026)
[27] Lipinski, C.A., Lombardo, F., Dominy, B.W., Feeney, P.J.: Experimental and computational approaches to estimate solubility and permeability in drug discovery and development settings. Advanced drug delivery reviews 23(1-3), 3–25 (1997)
[28] Hu, E.J., Shen, Y., Wallis, P., Allen-Zhu, Z., Li, Y., Wang, S., Wang, L., Chen, W.: Lora: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685 (2021)
[29] Adam., Y., Maxime, R., Xi, W., Laurence, A.: Bayesian Low-rank Adaptation for Large Language Models (2024). https://arxiv.org/abs/2308.13111
[30] Psaros, A.F., Meng, X., Zou, Z., Guo, L., Karniadakis, G.E.: Uncertainty quantification in scientific machine learning: Methods, metrics, and comparisons. Journal of Computational Physics 477, 111902 (2023)
[31] Wang, K., Cuzzolin, F., Shariatmadar, K., Moens, D., Hallez, H.: A review of uncertainty representation and quantification in neural networks. IEEE Transactions on Pattern Analysis and Machine Intelligence 48(3), 2476–2495 (2026)
[32] Izmailov, P., Maddox, W.J., Kirichenko, P., Garipov, T., Vetrov, D., Wilson, A.G.: Subspace inference for Bayesian deep learning. In: Uncertainty in Artificial Intelligence, pp. 1169–1179 (2020). PMLR
[33] Grosse, R., Martens, J.: A kronecker-factored approximate fisher matrix for convolution layers. In: International Conference on Machine Learning, pp. 573–582 (2016). PMLR
[34] Ritter, H., Botev, A., Barber, D.: A scalable Laplace approximation for neural networks. In: International Conference on Learning Representations (2018). https://openreview.net/forum?id=Skdvd2xAZ
[35] Daxberger, E., Kristiadi, A., Immer, A., Eschenhagen, R., Bauer, M., Hennig, P.: Laplace redux-effortless Bayesian deep learning. Advances in neural information processing systems 34, 20089–20103 (2021)
[36] Nafiz, A., Jantre, S., Urban, N.M., Yoon, B.: Leveraging active subspaces to capture epistemic model uncertainty in deep generative models for molecular design. In: 2024 IEEE 34th International Workshop on Machine Learning for Signal Processing (MLSP), pp. 1–6. IEEE, ??? (2024). https://doi.org/10.1109/mlsp58920.2024.10734787. http://dx.doi.org/10.1109/MLSP58920.2024.10734787
[37] Kunstner, F., Hennig, P., Balles, L.: Limitations of the empirical Fisher approximation for natural gradient descent. Advances in neural information processing systems 32 (2019)
[38] Gur-Ari, G., Roberts, D.A., Dyer, E.: Gradient descent happens in a tiny subspace. arXiv preprint arXiv:1812.04754 (2018)
[39] Chen, T.: The Lanczos algorithm for matrix functions: a handbook for scientists (2026). https://arxiv.org/abs/2410.11090
[40] Lanczos, C.: An iteration method for the solution of the eigenvalue problem of linear differential and integral operators. Journal of research of the National Bureau of Standards 45(4), 255–282 (1950)
[41] Pearlmutter, B.A.: Fast exact multiplication by the Hessian. Neural computation 6(1), 147–160 (1994)
[42] Carlin, B.P., Louis, T.A.: Empirical Bayes: Past, present and future. Journal of the American Statistical Association 95(452), 1286–1289 (2000)
[43] Guo, C., Pleiss, G., Sun, Y., Weinberger, K.Q.: On calibration of modern neural networks. In: International Conference on Machine Learning, pp. 1321–1330 (2017). PMLR