WorksComputer Science
Improved Uncertainty Quantification in Physics-Informed Neural Networks Using Error Bounds and Solution Bundles
Abstract
Physics-Informed Neural Networks (PINNs) have been widely used to obtain solutions to various physical phenomena modeled as Differential Equations. As PINNs are not naturally equipped with mechanisms for Uncertainty Quantification, some work has been done to quantify the different uncertainties that arise when dealing with PINNs. In this paper, we use a two-step procedure to train Bayesian Neural Networks that provide uncertainties over the solutions to differential equation systems provided by PINNs. We use available error bounds over PINNs to formulate a heteroscedastic variance that improves the uncertainty estimation. Furthermore, we solve forward problems and utilize the obtained uncertainties when doing parameter estimation in inverse problems in cosmology.
Introduction
Physics-Informed Neural Networks (PINNs), first proposed by Lagaris et al. [1997], solve differential equations (DEs) by embedding the physics of the problem into the network, eliminating the need for extra data. PINNs offer advantages over traditional solvers: they are continuous, differentiable, and parallelizable, allowing them to bypass the need for previous time steps. However, challenges remain in computing solution errors or error bounds, with ongoing research [Liu et al., 2022, 2023, De Ryck and Mishra, 2022b]. Specific equations like Navier-Stokes and Elasticity are also under study [De Ryck and Mishra, 2022a, De Ryck et al., 2022, Guo and Haghighat, 2022].
Since their introduction, PINNs have rapidly gained attention, being applied to heat transfer [9], wave equations [Rasht-Behesht et al., 2022], and fluid mechanics [8] (Jin et al. 2021; Mao et al. 2020). Efforts to address failure modes and optimization issues are ongoing [19] (Nabian et al. 2021; Steger et al. 2022; Krishnapriyan et al. 2021), with interest in Bayesian PINNs for uncertainty quantification (UQ) [Yang et al., 2020, Linka et al., 2022, Graf et al., 2021, Psaros et al., 2023].
The use of NNs for solving ODEs and PDEs was pioneered by Lagaris et al. [1997] and later advanced by Raissi et al. [2019], who introduced PINNs for forward and inverse problems. Forward problems solve for the solution given the equation and boundary conditions, while inverse problems estimate unknown parameters. Inverse problems were implemented by Raissi et al. [2019] by treating these parameters as trainable variables.
Although effective, this approach lacks a robust mechanism for uncertainty quantification, which Bayesian Neural Networks (BNN) address by introducing distributions over network weights. However, simply applying Bayesian methods does not fully leverage the available information about solution accuracy. This is where Solution Bundles [Flamant et al., 2020] come into play. Solution Bundles enable statistical analysis over multiple possible solutions, providing a more comprehensive view of uncertainty in both the solution and the equation parameters.
In cosmology, DEs aim to explain the universe’s expansion. Testing new models against observations typically involves statistical analysis to determine parameter bounds. By combining Solution Bundles with BNNs, we enhance uncertainty quantification, offering a more reliable method for parameter estimation. Our contributions include:
Introducing error-bound-based heteroscedastic variance for better uncertainty quality.
Solving forward problems for cosmological equations while quantifying uncertainties.
Applying Solution Bundles to solve inverse problems for parameter estimation.
Background
Problem Formulation
We adopt a slightly different formulation from Psaros et al. [2022]. The DEs we will work with can be defined as follows:
where is the space-time coordinate, is a bounded domain with boundary , is the source term, is the solution of the system, is a differential operator, and are the boundary conditions (BCs) operator and term, respectively, and denotes the parameters of the system.
In this paper, we will focus on problems where the operators , and terms , are known. If is assumed to be known, the goal is to find the solution , referred to as the forward problem. Conversely, if is known and the aim is to estimate , then this is known as the inverse problem.
Physics-Informed Neural Networks
A Physics-Informed Neural Network uses a neural network, , to approximate the true solution of a differential equations system. As discussed by Psaros et al. [2023], PINNs can be trained by minimizing a fitting dataset’s Mean Squared Error (MSE). A fitting dataset is composed of noisy observations of , , and noisy BCs data
Where and are weighting constants. Psaros et al. [2023] call this setup the Forward Deterministic PDE Problem, they also describe Mixed Deterministic PDE Problem where the objective is to obtain solutions for and , and the Mixed Stochastic PDE Problem which deals with stochastic PDEs.
In this work, we adopt a different optimization problem to solve the forward deterministic problem and address the inverse problem separately rather than solving both forward and inverse problems simultaneously.
Solving Forward Problems
We begin by defining the residual of a differential equation as
The computation of is easy to implement thanks to automatic differentiation provided by Deep Learning frameworks such as PyTorch [Paszke et al., 2019]. This formulation allows PINNs to be trained as a self-supervised network. Since any solution to the differential equation satisfies , we train the network to minimize the square of the residual
Usually, are sampled from with a uniform distribution or by taking an equally-spaced subset. It is important to note that we do not deal with noisy data, unlike the work by Raissi et al. [2019].
Enforcing Boundary Conditions
While adding a term for BCs in the loss (see Eq. (3)) when dealing with data is a good way to incorporate such knowledge, there is no guarantee that the conditions will be satisfied. When BCs are known rather than observed in the data, we can use the transformation introduced by Lagaris et al. [1997] that enforces the BCs to be always satisfied. This is achieved by writing the approximate solution as a sum of two terms:
where does not depend on the network parameters and it satisfies the BCs. Since we need to satisfy BCs, is constructed so it does not contribute to them. This transformation is also used by Graf et al. [2021], Chen et al. [ [12].
One-dimensional Initial Value Problem Given an initial condition , we consider a transformation
In Appendix A of the Supplementary Material we show the enforcing of two-dimensional Dirichlet BCs. Similar transformations can be defined for Neumann and mixed BCs.
Solution Bundles
Solution Bundles [Flamant et al., 2020] extend PINNs by allowing the network to take equation parameters as inputs. This modification allows the network to approximate a variety of solutions to a parameterized differential equation without the need to retrain for each value of .
In § 2.1 we considered a unique value for and one BC term . When working with Solution Bundles instead, we have subsets for the equation parameters and BCs.
, are such subsets that will be used to train the NN. and are the dimensionality of the equation parameters and the system’s state variable, respectively. The transformation described in § 2.4 can also be used for Solution Bundles. Eq. (6) turns into:
Training Solution Bundles
Flamant et al. [2020] proposed a weighting function for the residual loss (Eq. (5)) to influence how the approximation error is distributed across the training region. However, in this work, for simplicity, we stick to the unweighted residual loss
where we have redefined from Eq. (4) for the Solution Bundle case as .
Solution Bundles for Solving Inverse Problems
So far we have explained how to solve forward problems, that is, finding a solution to a differential equations system. As we described, for the case of PINNs, the solving step is an optimization problem.
On the other hand, inverse problems aim to find a differential system that best describes some collected data. For this, we assume the differential system can explain the phenomena observed and we seek to estimate the system’s parameters for a given dataset.
An effective approach to addressing the parameter estimation problem involves statistical analysis, specifically through the application of Bayesian methods. This approach necessitates multiple computations of the system’s solution, corresponding to each parameter value. Traditional numerical methods require the discretization and integration process to be performed for each of these solutions. In contrast, Solution Bundles eliminate the need for retraining for each parameter value, thereby expediting the computational process. A comprehensive explanation of the probabilistic setup for Bayesian parameter estimation is provided in § 5.
Error Bounds for PINNs
Good quality uncertainties should correlate with the true error of a solution. Since the true error is not accessible, we use error bounds in § 4.2 to improve the uncertainty in the Bayesian NNs.
In [Liu et al., 2022, 2023], the authors present algorithms for computing error bounds on PINNs. These bounds apply to linear ODEs, systems of linear ODEs, non-linear ODEs in the form , as well as certain types of PDEs. These algorithms are independent of the NN architecture and depend solely on the structure of the equation as defined in Eq. (1) and the residuals of the DE.
For the Solution Bundle setup, the network error is denoted as , and the error bound is represented by a scalar function such that
In this work we use the error bounds developed for first-order linear ODEs with nonconstant coefficient. In Appendix B of the Supplementary Material provide the algorithm for its computation and for first-order linear ODEs with constant coefficient. Appendix B.3 and Algorithm 1 describe how obtain tight bounds.
Bayesian Neural Networks
To quantify uncertainty, we adopt a Bayesian perspective on the neural networks. We do this by viewing the neural network as a probabilistic model and placing a prior distribution over its parameters . Using Bayes’ theorem, we can get the posterior distribution of :
is the likelihood distribution over a dataset .
The posterior distribution allows us to make predictions about unseen data by taking expectations. Consider a new data point , we can obtain the probability of the output being as:
Usually, the integral in Eq. (13) is analytically intractable, and we have to resort to Monte Carlo (MC) approximations that can be computed as:
Shortcomings of Residual-Based UQ Methods in PINNs
A direct application of Bayesian Neural Networks to PINNs is straightforward by placing the likelihood over the residuals of the PINN solution given a coordinate point i.e. . For more details see § 4.3.
However, evaluating a PINN solution based only on the residual loss Eq. (5) can be misleading. A low residual at does not guarantee a low solution error at . In Control Theory, for instance, an Integral Controller drives steady-state error to zero, yet errors may still exist:
where is the control input, the error, the reference, the system output, and the integral gain [Åström and Murray, 2008]. For a DE with IC , the approximation error can be expressed as:
where , given the approximation satisfies the ICs. Proof of Eq. (16) is in Proposition F.1 of the Supplementary Material. Eq. (16) suggests that the residual at some point is not enough to characterize the solution error at the same point .
These challenges, along with other Failure Modes of PINNs, remain an active area of research [Krishnapriyan et al., 2021, Wang et al., 2022, Penwarden et al., 2023]. Notably, Wang et al. [2022] identify an implicit bias in the PINN framework that can severely violate the temporal causality of dynamical systems. As a result, residual minimization at a given time may occur even when predictions at earlier times are inaccurate.
In Figure 1 we see how a PINN solution has near maximum and minimum error for the same residual value. This illustrates the decoupling of residuals from solution errors, which can be attributed to a violation of temporal causality. Furthermore, Figure 13 to Figure 16 show how there is no clear correlation between residuals and solution errors. These figures were obtained by training a deterministic PINN on a cosmological model, the construction details are provided in Appendix § 18.

Figure 1. Normalized Absolute Residual vs Normalized Absolute Relative Error of a Deterministic NN Solution for CPL Model.

Figure 13. Relationship Between Solution Errors and Residuals from CDM. Samples were collected as described in I.

Figure 16. Relationship Between Solution Errors and Residuals from HS. Samples were collected as described in I. Colors differentiate variables in the system.
Our experiments demonstrate that the baseline method produces uncalibrated predictive distributions and, in some cases, fails to approximate the true solutions. To address these limitations, we propose a two-step approach that incorporates error bounds into the solutions, leading to predictive distributions with improved calibration.
Two-Step Bayesian PINNs
We use a two-step approach to obtain uncertainties in the solutions of equations. In the first step, we train a PINN
as a Solution Bundle that we refer to as the deterministic network. We denote this network as and as the parameters resulting after training.
Note that as shown in Eq. (10), this training step is carried out without the use of any data, but rather sampling from the domain and minimizing the network’s residuals. Figure 2 shows a diagram of the entire training process.

Figure 2. Diagram of Both Training Steps. In the Second Step are The Resulting Network Parameters From the First Step and is The Likelihood Function.
Bayesian Neural Network Training
In the second step, we use the outputs of as targets to train a Bayesian Neural Network.
We construct a dataset by taking the space-time coordinates and equation parameters as independent variables, and the outputs of the deterministic net as dependent variables:
We define a BNN by assigning distributions to the network parameters and dataset as it is done in [Graf et al., 2021]. For all three methods described in § 2.7 we use a Gaussian prior:
To formulate the likelihood, we assume a Gaussian additive noise on the observations2
where
This setup is often used in machine learning, but we employ it with a different interpretation; see § 4.2. In this paper, we model the standard deviation as known, but it can also be modeled as unknown. Given Eq. (17), the resulting likelihood is:
We assume Gaussian noise in Eq. (17) due to its simplicity, tractability (see § 4.1.1), and suitability as a starting point for evaluating our methodology. To assess this assumption, we analyze the distributional behavior of , with details provided in Appendix § 18. Figure 4 to Figure 12 illustrate the solution distributions obtained by a PINN for various cosmological models. Although these distributions deviate from a perfect Gaussian, they are not significantly distant, suggesting that a Gaussian approximation is a reasonable initial choice.

Figure 4. Distribution of from CDM. Samples were collected as described in I. Orange lines show a Gaussian distribution with sample mean and variance.

Figure 12. Distribution of from HS. Samples were collected as described in I. Orange lines show a Gaussian distribution with sample mean and variance.
Posterior Distribution Approximation Methods
To apply the MC approximation in Eq. (13), we must generate samples from the posterior distribution . Given the complexity of neural networks and the need for computational efficiency, we compare three methods: Neural Linear Models (NLMs), Bayes By Backpropagation (BBB), and Hamiltonian Monte Carlo (HMC). NLMs offer a lightweight approach by approximating the posterior in a linearized feature space, making them suitable for speed-critical applications. BBB uses variational inference to achieve greater accuracy while maintaining tractability for larger networks. HMC is the most advanced method, producing highly accurate samples at the expense of increased computational complexity. Comparing these techniques allows for an evaluation of the trade-offs between accuracy and computational feasibility.
Neural Linear Models (NLMs) NLM represent Bayesian linear regression using a neural network for the feature basis, with only the final layer parameters treated as stochastic. Using Gaussian prior and likelihood allows for tractable inference, leading to the posterior and predictive distributions given by:
where and are posterior parameters, and is the learned feature map. The details of and computation can be found in Appendix § 12 of the Supplementary Material.
Bayes By Backpropagation (BBB) BBB approximates the posterior of network parameters using variational inference (VI) and minimizes the KL divergence between the true posterior and a variational distribution . This results in an approximation that is used to generate Monte Carlo samples for . We assume independent parameters under a mean-field approximation [4], defining , using a Gaussian distribution for the variational posterior [5].
Hamiltonian Monte Carlo (HMC) HMC employs a Metropolis-Hastings algorithm [Metropolis et al., 2004, Hastings, 1970] to draw samples from by simulating particle movement through Hamiltonian dynamics. To enhance sampling efficiency, we utilize the No-U-Turn Sampler [Hoffman and Gelman].
Improving Predictive Uncertainty with Error Bounds
When learning from observations , the standard approach assumes these observations have an error :
where is a deterministic function parameterized by . This formulation attributes all errors to the observations. However, we can introduce an additional error term for model error:
Separating model error from observational error is typically challenging due to their additive nature. If we know there is no observational error, we can use Eq. (21) similarly to Eq. (20). This is the case in Section 4.1, where the dataset has observations free of noise:

Figure 3. Examples of ΛCDM Bayesian Solutions Obtained Using the Bundle Solver. Analytic Solutions are Presented in Dotted Lines.
However, the approximate solution may still have prediction errors. We model this error with a Gaussian distribution with standard deviation , which we treat as known in two ways:
Homoscedastic:
We set to be zero on the boundaries because we enforce BC always to be met.
Error Bounds Based Heteroscedastic:
This choice ensures we are taking into account the error made by in the predictive uncertainty.
Baseline
In the literature, the standard approach to formulating the forward problem with Bayesian PINNs relies on noisy observations of , and [Psaros et al., 2022, Zou et al., 2023, Yang et al., 2020]. However, since our setup does not incorporate observations, we adopt as a baseline a Bayesian neural network with the likelihood defined over the residuals:
The training procedure follows the approach described in Section 4.1, with the exception that we could not implement NLM in this setting. This limitation arises because the residuals depend on the solution, thereby breaking the analytical tractability required for NLM.
Probabilistic Formulation of Inverse Problems
The Bayesian framework can be used to estimate the parameters of a DE system. For a given set of observations , we seek to find the posterior distribution of the parameters. Here and are the mean and standard deviation of the observations at some point , respectively.
Assume we have a probability distribution over the solutions , then using Bayes’ Theorem, the posterior can be computed as . The likelihood is obtained by marginalizing over the solutions as:
where .
The distribution induced by FCNNs can be interpreted as a Delta distribution, where the function learned by the network outputs a specific value for a given input . In contrast, BNNs naturally provide a distribution over solutions through their posterior predictive, thus Eq. (24) results in a marginalization over the posterior predictive distribution .
We use a uniform distribution to aim for an uninformative prior for . In the same way Chantada et al. [ [11] did, to define the likelihood , we assume the observations are normally distributed around the true solution, i.e., .
Having defined the prior and likelihood, we can apply a sampling algorithm to approximate . We use the emcee Python package [Foreman-Mackey et al., 2013] which implements the samplers introduced by Goodman and Weare [2010].
Experiments on Cosmology Models
This section specifies the cosmological equations we used to test our methodology. These equations were solved with PINNs by Chantada et al. [ [11]. For brevity, we describe the CDM and Parametric Dark Energy models. The details of Quintessence and gravity (or HS for the name of the authors Hu and Sawicki) are provided in Appendix § 16. However, Table 1 lists the variables and parameters of each cosmological model.
| Equation | Type | Variables | Parameters |
| ΛCDM | Linear Equation | ||
| CPL | Linear Equation | ||
| Quintessence | Non-linear System | ||
| HS | Non-linear System |
Table 1. Cosmology Equations Variables and Parameters. Parameters Marked With * are Inputs in the Bundle Solution, The Remainder are Needed to Compute the Hubble Parameter.
CDM The equation and initial conditions are
where is a parameter. Having a solution to this equation, the Hubble parameter can be obtained as
here is also a parameter.
Parametric Dark Energy We refer to this model as CPL for the names of the authors Chevallier, Polarski and Linder [13] (Linder 2003). The equation and initial conditions are
where , and are parameters. Having a solution to this equation, the Hubble parameter can be obtained as
here is also a parameter.
For brevity, we provide the error bounds computation details in Appendix § 11 of the Supplementary Material.
Forward Problems We trained using methods from [11], then built a dataset to train the BNNs. We compared homoscedastic and error-bounds-based heteroscedastic variance for CDM and CPL equations, while providing homoscedastic variance results for Quintessence and HS. The networks were trained using regular PINNs and Solution Bundles, referred to as Forward and Bundle, respectively, with implementation details in Appendix § 17 of the Supplementary Material. We provide the complete implementation in a code repository.3
We evaluated the NN solutions by calculating the Median Relative Error (MRE) against analytical solutions for CDM and CPL, and numerical solutions for Quintessence and HS, using a Runge-Kutta method. We also computed the median residual, and miscalibration area (MA) [14] to assess uncertainty quality. Results are summarized in Table 2, with additional metrics in Table 13 to Table 15.
| Equation | Method | Median RE | Median Residual | Miscal. Area |
| CDM | FCNN | 0.001 | 0.0 | - |
| BBB | 0.978 | 0.147 | 0.491 | |
| HMC | 0.084 | 0.198 | 0.4 | |
| NLM + 2S | 0.018 | 8.157 | 0.183 | |
| BBB + 2S | 0.035 | 0.963 | 0.143 | |
| HMC + 2S | 0.004 | 0.197 | 0.123 | |
| NLM + 2S + EB | 0.002 | 10.783 | 0.063 | |
| BBB + 2S + EB | 0.047 | 2.476 | 0.05 | |
| HMC + 2S + EB | 0.003 | 0.272 | 0.098 | |
| CPL | FCNN | 0.0 | 0.001 | - |
| BBB | 0.128 | 0.014 | 0.199 | |
| HMC | 0.0 | 0.01 | 0.317 | |
| BBB + 2S | 0.063 | 0.006 | 0.15 | |
| HMC + 2S | 0.004 | 0.005 | 0.255 | |
| BBB + 2S + EB | 0.033 | 0.003 | 0.177 | |
| HMC + 2S + EB | 0.011 | 0.004 | 0.145 | |
| Quint. | FCNN | 0.007 | 0.0 | - |
| BBB | 0.094 | 0.012 | 0.151 | |
| HMC | 0.002 | 0.005 | 0.147 | |
| NLM + 2S | 0.096 | 0.175 | 0.136 | |
| BBB + 2S | 0.12 | 0.011 | 0.119 | |
| HMC + 2S | 0.016 | 0.002 | 0.048 | |
| HS | FCNN | 0.001 | 0.0 | - |
| BBB | 0.393 | 0.083 | 0.449 | |
| HMC | 0.226 | 0.01 | 0.455 | |
| NLM + 2S | 0.259 | 1.666 | 0.315 | |
| BBB + 2S | 0.296 | 0.13 | 0.396 | |
| HMC + 2S | 0.286 | 0.345 | 0.486 |
Table 2. Evaluation Metrics of All Bundle Networks and Equations in the Testing Region. Here we Use 2S for Two-step and EB for Error Bounds.
| Equation | Method | Forward Q10 | Q20 | Q30 | Q40 | Q50 | Q60 | Q70 | Q80 | Q90 | Q100 | Bundle Q10 | Q20 | Q30 | Q40 | Q50 | Q60 | Q70 | Q80 | Q90 | Q100 |
| ΛCDM | FCNN | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.162 | 0.394 | 0.558 | 0.669 | 0.746 | 0.0 | 0.0 | 0.0 | 0.001 | 0.001 | 0.017 | 0.248 | 0.48 | 0.647 | 0.819 |
| ΛCDM | NLM | 0.0 | 0.0 | 0.001 | 0.001 | 0.007 | 0.184 | 0.418 | 0.577 | 0.685 | 0.759 | 0.001 | 0.002 | 0.003 | 0.006 | 0.018 | 0.058 | 0.32 | 0.554 | 0.701 | 0.843 |
| ΛCDM | BBB | 0.0 | 0.0 | 0.0 | 0.001 | 0.004 | 0.162 | 0.397 | 0.56 | 0.671 | 0.748 | 0.0 | 0.0 | 0.001 | 0.001 | 0.002 | 0.017 | 0.236 | 0.47 | 0.639 | 0.814 |
| ΛCDM | HMC | 0.001 | 0.001 | 0.002 | 0.004 | 0.019 | 0.228 | 0.443 | 0.593 | 0.696 | 0.767 | 0.001 | 0.001 | 0.002 | 0.003 | 0.007 | 0.051 | 0.212 | 0.415 | 0.597 | 0.799 |
| ΛCDM | NLM + EB | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.17 | 0.406 | 0.569 | 0.679 | 0.754 | 0.0 | 0.0 | 0.001 | 0.001 | 0.002 | 0.017 | 0.184 | 0.381 | 0.537 | 0.717 |
| ΛCDM | BBB + EB | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.156 | 0.391 | 0.559 | 0.666 | 0.75 | 0.001 | 0.002 | 0.004 | 0.005 | 0.007 | 0.025 | 0.254 | 0.49 | 0.657 | 0.835 |
| ΛCDM | HMC + EB | 0.0 | 0.0 | 0.0 | 0.0 | 0.004 | 0.202 | 0.432 | 0.58 | 0.69 | 0.765 | 0.0 | 0.0 | 0.001 | 0.001 | 0.002 | 0.033 | 0.152 | 0.353 | 0.541 | 0.78 |
| CPL | FCNN | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.001 | 0.003 | 0.006 | 0.013 | 0.0 | 0.0 | 0.0 | 0.001 | 0.001 | 0.017 | 0.248 | 0.48 | 0.647 | 0.819 |
| CPL | BBB | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.001 | 0.003 | 0.006 | 0.011 | 0.0 | 0.001 | 0.002 | 0.006 | 0.073 | 0.302 | 0.684 | 2.283 | 98.738 | 9.53e+08 |
| CPL | HMC | 0.0 | 0.0 | 0.0 | 0.0 | 0.001 | 0.008 | 0.022 | 0.041 | 0.066 | 0.095 | 0.001 | 0.002 | 0.004 | 0.007 | 0.033 | 0.13 | 0.363 | 1.711 | 100.003 | 8.31e+08 |
| CPL | BBB + EB | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.001 | 0.004 | 0.009 | 0.002 | 0.004 | 0.007 | 0.014 | 0.034 | 0.239 | 0.743 | 2.333 | 21.77 | 9.01e+08 |
| CPL | HMC + EB | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.01 | 0.038 | 0.078 | 0.124 | 0.173 | 0.002 | 0.004 | 0.006 | 0.01 | 0.021 | 0.305 | 0.999 | 28.567 | 6.67e+05 | 3.88e+26 |
| Quint. | FCNN | 0.0 | 0.0 | 0.0 | 0.0 | 0.001 | 0.006 | 0.039 | 0.103 | 0.171 | 0.223 | 0.001 | 0.001 | 0.002 | 0.004 | 0.007 | 0.012 | 0.021 | 0.039 | 0.077 | 0.26 |
| Quint. | NLM | 0.003 | 0.006 | 0.009 | 0.016 | 0.034 | 0.058 | 0.094 | 0.16 | 0.237 | 0.288 | 0.014 | 0.027 | 0.042 | 0.065 | 0.096 | 0.145 | 0.211 | 0.325 | 0.708 | 164.163 |
| Quint. | BBB | 0.001 | 0.002 | 0.003 | 0.005 | 0.012 | 0.027 | 0.067 | 0.129 | 0.197 | 0.918 | 0.001 | 0.003 | 0.005 | 0.008 | 0.013 | 0.02 | 0.034 | 0.057 | 0.104 | 24.699 |
| Quint. | HMC | 0.012 | 0.02 | 0.026 | 0.043 | 0.065 | 0.135 | 0.218 | 0.29 | 0.348 | 1.31 | 0.001 | 0.003 | 0.005 | 0.008 | 0.015 | 0.026 | 0.044 | 0.071 | 0.119 | 18.676 |
| HS | FCNN | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.162 | 0.394 | 0.558 | 0.669 | 0.746 | 0.0 | 0.0 | 0.0 | 0.001 | 0.001 | 0.017 | 0.248 | 0.48 | 0.647 | 0.819 |
| HS | NLM | 0.003 | 0.007 | 0.01 | 0.015 | 0.026 | 0.905 | 8.203 | 23.657 | 40.486 | 147.148 | 0.078 | 0.135 | 0.182 | 0.213 | 0.247 | 0.635 | 3.403 | 16.619 | 88.025 | 1.33e+09 |
| HS | BBB | 0.002 | 0.003 | 0.003 | 0.005 | 0.008 | 0.022 | 0.031 | 0.042 | 0.119 | 0.831 | 0.039 | 0.089 | 0.143 | 0.23 | 0.429 | 0.715 | 1.434 | 3.463 | 9.211 | 7.52e+05 |
| HS | HMC | 0.121 | 0.305 | 0.521 | 0.674 | 0.742 | 1.308 | 2.71 | 7.066 | 16.963 | 59.125 | 0.067 | 0.123 | 0.169 | 0.217 | 0.294 | 0.368 | 0.629 | 2.291 | 8.942 | 9.06e+05 |
Table 13. Error Quantiles Of The NN Solutions Relative To The Analytical Solution For ΛCDM And CPL, And The Numerical Solution For Quintessence And HS.
| Equation | Method | MRE | Mean Residual | Miscal. Area | RMS Cal. | MA Cal. | Sharpness | NLL | CRPS | Check | Interval | Acc. MAE | Acc. RMSE | Acc. MDAE | Acc. MARPD |
| CDM | FCNN | 0.178 | 0.0 | - | - | - | - | - | - | - | - | - | - | - | - |
| CDM | BBB | 0.94 | 0.199 | 0.491 | 0.566 | 0.486 | 0.076 | 67151.127 | 24.692 | 12.347 | 257.601 | 24.73 | 36.873 | 14.224 | 181.346 |
| CDM | HMC | 0.196 | 5.169 | 0.4 | 0.455 | 0.396 | 0.822 | 139.806 | 10.309 | 5.161 | 102.634 | 10.61 | 22.142 | 0.752 | 25.336 |
| CDM | NLM + 2S | 0.206 | 8.278 | 0.183 | 0.211 | 0.182 | 0.45 | 604.068 | 12.215 | 6.111 | 124.943 | 12.369 | 25.205 | 0.032 | 29.855 |
| CDM | BBB + 2S | 0.204 | 5.386 | 0.143 | 0.173 | 0.141 | 0.487 | 935.006 | 11.829 | 5.918 | 121.119 | 11.965 | 24.362 | 0.092 | 28.573 |
| CDM | HMC + 2S | 0.171 | 5.446 | 0.123 | 0.148 | 0.122 | 1.4 | 39.06 | 10.346 | 5.182 | 100.22 | 10.809 | 22.873 | 0.011 | 23.62 |
| CDM | NLM + 2S + EB | 0.145 | 9.714 | 0.063 | 0.074 | 0.063 | 25.004 | −0.532 | 5.74 | 2.898 | 26.943 | 9.357 | 20.003 | 0.015 | 19.212 |
| CDM | BBB + 2S + EB | 0.198 | 5.17 | 0.05 | 0.058 | 0.05 | 25.008 | 1.647 | 7.004 | 3.536 | 31.722 | 11.421 | 23.284 | 0.294 | 26.712 |
| CDM | HMC + 2S + EB | 0.168 | 5.104 | 0.098 | 0.122 | 0.097 | 25.033 | −0.243 | 6.36 | 3.212 | 28.814 | 10.597 | 22.323 | 0.029 | 23.026 |
| CPL | FCNN | 0.062 | 0.001 | - | - | - | - | - | - | - | - | - | - | - | - |
| CPL | BBB | 0.683 | 1410.627 | 0.2 | 0.222 | 0.198 | 5777.129 | −2.261 | 3545.896 | 1777.486 | 33236.555 | 3770.007 | 76032.127 | 0.005 | 28.948 |
| CPL | HMC | 0.362 | 1722.466 | 0.317 | 0.341 | 0.314 | 1.05e+05 | −6.292 | 1324.918 | 668.959 | 7053.056 | 1969.836 | 41625.811 | 0.0 | 13.055 |
| CPL | BBB + 2S | 2.751 | 818.487 | 0.15 | 0.164 | 0.149 | 2121.18 | 8.885 | 5054.062 | 2529.02 | 51204.587 | 5148.735 | 96419.681 | 0.004 | 37.724 |
| CPL | HMC + 2S | 15.533 | 2213.885 | 0.255 | 0.272 | 0.252 | 2.92e+05 | −5.211 | 2891.45 | 1459.777 | 18215.13 | 2540.452 | 45826.617 | 0.0 | 31.464 |
| CPL | BBB + 2S + EB | 2.09e+05 | 9.58e+08 | 0.177 | 0.212 | 0.175 | 2.85e+09 | 26693.418 | 2.68e+08 | 1.35e+08 | 2.10e+09 | 3.09e+08 | 1.23e+10 | 0.003 | 61.241 |
| CPL | HMC + 2S + EB | 2.35e+05 | 7.49e+05 | 0.145 | 0.165 | 0.143 | 2.89e+06 | 90.949 | 2.74e+05 | 1.38e+05 | 2.06e+06 | 3.20e+05 | 1.03e+07 | 0.001 | 47.367 |
| Quintessence | FCNN | 0.024 | 0.027 | - | - | - | - | - | - | - | - | - | - | - | - |
| Quintessence | BBB | 0.128 | 0.079 | 0.148 | 0.193 | 0.147 | 0.004 | 7.61e+09 | 0.017 | 0.009 | 0.159 | 0.019 | 0.041 | 0.002 | nan |
| Quintessence | HMC | 0.009 | 0.019 | 0.147 | 0.165 | 0.146 | 0.007 | 7.61e+09 | 0.002 | 0.001 | 0.009 | 0.002 | 0.007 | 0.0 | nan |
| Quintessence | NLM + 2S | 0.39 | 0.33 | 0.136 | 0.158 | 0.135 | 0.006 | 51.905 | 0.039 | 0.019 | 0.375 | 0.04 | 0.099 | 0.002 | 24.652 |
| Quintessence | BBB + 2S | 0.159 | 0.12 | 0.119 | 0.165 | 0.118 | 0.004 | 7.61e+09 | 0.027 | 0.014 | 0.265 | 0.029 | 0.064 | 0.002 | nan |
| Quintessence | HMC + 2S | 0.041 | 0.037 | 0.048 | 0.054 | 0.047 | 0.014 | 8.50e+09 | 0.005 | 0.003 | 0.026 | 0.007 | 0.02 | 0.0 | nan |
| HS | FCNN | 0.178 | 0.0 | - | - | - | - | - | - | - | - | - | - | - | - |
| HS | BBB | 0.663 | 0.136 | 0.449 | 0.518 | 0.445 | 0.015 | 5.90e+12 | 0.264 | 0.132 | 2.649 | 0.27 | 0.343 | 0.227 | nan |
| HS | HMC | 0.408 | 0.152 | 0.455 | 0.52 | 0.45 | 0.041 | 5.90e+12 | 0.126 | 0.064 | 1.003 | 0.145 | 0.193 | 0.125 | nan |
| HS | NLM + 2S | 3740.057 | 2.27e+06 | 0.315 | 0.363 | 0.312 | 0.027 | 20707.105 | 0.38 | 0.19 | 3.926 | 0.384 | 0.551 | 0.264 | 41.024 |
| HS | BBB + 2S | 0.417 | 0.361 | 0.396 | 0.454 | 0.392 | 0.049 | 5.90e+12 | 0.2 | 0.101 | 1.824 | 0.216 | 0.349 | 0.113 | nan |
| HS | HMC + 2S | 2.739 | 3.456 | 0.486 | 0.561 | 0.482 | 0.003 | 5.98e+12 | 0.136 | 0.068 | 1.401 | 0.137 | 0.201 | 0.096 | nan |
Table 15. Metrics of the NN Bundle Solutions.
For the CPL model, we utilized a reparameterization from [11] that separates equation parameters from Bundle Network training, although this method is incompatible with Neural Linear Models (NLM).
Inverse Problems For the inverse problem, we used 30 measurements of the Hubble parameter from the Cosmic Chronometers (CC) method [16] (Simon et al. 2005; Stern et al. 2010; Moresco et al. 2012; Moresco 2015; Moresco et al. 2016). Each measurement includes a tuple , indicating redshift, observed mean Hubble parameters, and their standard deviation. The CC dataset is available in Table 9 of the Supplementary Material, with Eq. (41) used as the likelihood of observations.
| Ref. | |||
| 0.09 | |||
| 0.17 | |||
| 0.27 | |||
| 0.4 | |||
| 0.9 | [Simon et al., 2005] | ||
| 1.3 | |||
| 1.43 | |||
| 1.53 | |||
| 1.75 | |||
| 0.48 | [Stern et al., 2010] | ||
| 0.88 | |||
| 0.1791 | |||
| 0.1993 | |||
| 0.3519 | |||
| 0.5929 | [Moresco et al., 2012] | ||
| 0.6797 | |||
| 0.7812 | |||
| 0.8754 | |||
| 1.037 | |||
| 0.07 | |||
| 0.12 | |||
| 0.2 | |||
| 0.28 | [16] | ||
| 1.363 | |||
| 1.965 | [Moresco, 2015] | ||
| 0.3802 | |||
| 0.4004 | |||
| 0.4247 | [Moresco et al., 2016] | ||
| 0.4497 | |||
| 0.4783 |
Table 9. Measurements Of The Hubble Parameter H Using The Cosmic Chronometers Technique
We estimated equation parameters using the Solution Bundles from the forward step and performed inference with the emcee package [Foreman-Mackey et al., 2013], running 32 chains for 10,000 steps, resulting in 320,000 samples per parameter. Table 11 and Table 12 show the results and their concordance with values found in the literature, respectively.
| Equation | Method | ||||||
| CDM | FCNN | - | - | - | - | ||
| CDM | BBB | - | - | - | - | ||
| CDM | HMC | - | - | - | - | ||
| CDM | NLM + 2S | - | - | - | - | ||
| CDM | BBB + 2S | - | - | - | - | ||
| CDM | HMC + 2S | - | - | - | - | ||
| CDM | NLM + 2S + EB | - | - | - | - | ||
| CDM | BBB + 2S + EB | - | - | - | - | ||
| CDM | HMC + 2S + EB | - | - | - | - | ||
| CPL | FCNN | - | - | ||||
| CPL | BBB | - | - | ||||
| CPL | HMC | - | - | ||||
| CPL | NLM + 2S | - | - | ||||
| CPL | BBB + 2S | - | - | ||||
| CPL | HMC + 2S | - | - | ||||
| CPL | NLM + 2S + EB | - | - | ||||
| CPL | BBB + 2S + EB | - | - | ||||
| CPL | HMC + 2S + EB | - | - | ||||
| Quint. | FCNN | - | - | - | |||
| Quint. | BBB | - | - | - | |||
| Quint. | HMC | - | - | - | |||
| Quint. | NLM + 2S | - | - | - | |||
| Quint. | BBB + 2S | - | - | - | |||
| Quint. | HMC + 2S | - | - | - | |||
| HS | FCNN | - | - | - | |||
| HS | BBB | - | - | - | |||
| HS | HMC | - | - | - | |||
| HS | NLM + 2S | - | - | - | |||
| HS | BBB + 2S | - | - | - | |||
| HS | HMC + 2S | - | - | - |
Table 11. Parameters Mean And Standard Deviation Estimation Of All Cosmology Models.
| Equation | Method | ||||||
| ΛCDM | FCNN | - | - | - | - | ||
| ΛCDM | BBB | - | - | - | - | ||
| ΛCDM | HMC | - | - | - | - | ||
| ΛCDM | NLM | - | - | - | - | ||
| ΛCDM | BBB | - | - | - | - | ||
| ΛCDM | HMC | - | - | - | - | ||
| ΛCDM | NLM + EB | - | - | - | - | ||
| ΛCDM | BBB + EB | - | - | - | - | ||
| ΛCDM | HMC + EB | - | - | - | - | ||
| CPL | FCNN | - | - | ||||
| CPL | BBB | - | - | ||||
| CPL | HMC | - | - | ||||
| CPL | NLM | - | - | ||||
| CPL | BBB | - | - | ||||
| CPL | HMC | - | - | ||||
| CPL | NLM + EB | - | - | ||||
| CPL | BBB + EB | - | - | ||||
| CPL | HMC + EB | - | - | ||||
| Quint. | FCNN | - | - | - | - | ||
| Quint. | BBB | - | - | - | - | ||
| Quint. | HMC | - | - | - | - | ||
| Quint. | NLM | - | - | - | - | ||
| Quint. | BBB | - | - | - | - | ||
| Quint. | HMC | - | - | - | - | ||
| HS | FCNN | - | - | - | |||
| HS | BBB | - | - | - | |||
| HS | HMC | - | - | - | |||
| HS | NLM | - | - | - | |||
| HS | BBB | - | - | - | |||
| HS | HMC | - | - | - |
Table 12. Smallest Number Of Sigmas Within Which The Results From [18, 1] (Motta et al. 2021) Fall.
Discussion
The FCNN consistently achieves the lowest median RE and mean residual across all equations, outperforming Bayesian methods in terms of accuracy. This highlights a tradeoff between equipping PINNs with uncertainty quantification and maintaining accuracy. In this work, our primary focus is on uncertainty rather than pure accuracy, as a well-calibrated model with higher error is generally more desirable than an uncalibrated model with low error. Properly calibrated uncertainties enable a meaningful assessment of prediction reliability.
From Table 2, we observe that the baseline Bayesian methods—BBB and HMC with a residual likelihood—exhibit significantly higher errors compared to the deterministic network, particularly for the CPL and HS equations. This effect is especially pronounced for BBB, which fails to approximate the CDM solution. Additionally, both methods exhibit high miscalibration areas, indicating that their uncertainty estimates are poorly calibrated.
Introducing our two-step (2S) method substantially improves calibration, as evidenced by the reduction in miscalibration areas across all cases. For instance, applying 2S to BBB in the CDM equation reduces the miscalibration area from 0.491 to 0.143.
Further incorporating error bounds into the two-step method enhances uncertainty calibration even further. Notably, BBB + 2S + EB achieves the lowest miscalibration area (0.05) for the CDM equation, while HMC + 2S + EB provides the best calibration in CPL (0.145). However, certain cases exhibit excessively large mean residuals, such as in CPL, where BBB + 2S + EB results in a residual of . This suggests that while error bounds improve calibration, they may introduce numerical instability in the metrics due to some samples’ extremely large errors.
For the Quintessence equation, HMC + 2S achieves the best calibration (0.048) while maintaining a low median RE (0.016), demonstrating an effective balance between accuracy and uncertainty quantification. In contrast, for the HS equation, while the two-step method improves calibration, overall performance remains suboptimal, with high median RE and residuals persisting across all Bayesian approaches.
In Table 3 and Table 4, we present results separately for the training and OOD regions. In the training region, the two-step approach consistently improves both accuracy and miscalibration, and the addition of error bounds further enhances calibration across most equations. For example, in the CDM case, combining two steps with error bounds yields the lowest miscalibration area among all methods, indicating effective uncertainty correction when the model operates within its training distribution.
| Equation | Method | Median RE | Median Residual | Miscal. Area |
| ΛCDM | FCNN | 0.0 | 0.0 | - |
| ΛCDM | BBB | 0.961 | 0.12 | 0.491 |
| ΛCDM | HMC | 0.041 | 0.07 | 0.358 |
| ΛCDM | NLM + 2S | 0.003 | 4.212 | 0.402 |
| ΛCDM | BBB + 2S | 0.008 | 0.238 | 0.269 |
| ΛCDM | HMC + 2S | 0.001 | 0.038 | 0.307 |
| ΛCDM | NLM + 2S + EB | 0.001 | 4.211 | 0.016 |
| ΛCDM | BBB + 2S + EB | 0.01 | 0.228 | 0.248 |
| ΛCDM | HMC + 2S + EB | 0.001 | 0.014 | 0.251 |
| CPL | FCNN | 0.0 | 0.001 | - |
| CPL | BBB | 0.052 | 0.016 | 0.161 |
| CPL | HMC | 0.0 | 0.009 | 0.482 |
| CPL | BBB + 2S | 0.024 | 0.009 | 0.085 |
| CPL | HMC + 2S | 0.001 | 0.008 | 0.436 |
| CPL | BBB + 2S + EB | 0.007 | 0.005 | 0.14 |
| CPL | HMC + 2S + EB | 0.001 | 0.008 | 0.159 |
| Quint. | FCNN | 0.003 | 0.0 | - |
| Quint. | BBB | 0.059 | 0.005 | 0.09 |
| Quint. | HMC | 0.001 | 0.003 | 0.279 |
| Quint. | NLM + 2S | 0.063 | 0.097 | 0.326 |
| Quint. | BBB + 2S | 0.047 | 0.002 | 0.165 |
| Quint. | HMC + 2S | 0.006 | 0.0 | 0.179 |
| HS | FCNN | 0.0 | 0.0 | - |
| HS | BBB | 0.373 | 0.162 | 0.426 |
| HS | HMC | 0.257 | 0.121 | 0.43 |
| HS | NLM + 2S | 0.244 | 0.201 | 0.252 |
| HS | BBB + 2S | 0.284 | 0.094 | 0.387 |
| HS | HMC + 2S | 0.279 | 0.111 | 0.427 |
Table 3. Evaluation Metrics of All Bundle Networks and Equations in the Training Region. Here we Use 2S for Two-step and EB for Error Bounds.
| Equation | Method | Median RE | Median Residual | Miscal. Area |
| ΛCDM | FCNN | 0.374 | 0.027 | - |
| ΛCDM | BBB | 0.986 | 0.168 | 0.495 |
| ΛCDM | HMC | 0.316 | 11.979 | 0.444 |
| ΛCDM | NLM + 2S | 0.449 | 10.569 | 0.43 |
| ΛCDM | BBB + 2S | 0.363 | 12.672 | 0.495 |
| ΛCDM | HMC + 2S | 0.31 | 12.054 | 0.424 |
| ΛCDM | NLM + 2S + EB | 0.287 | 14.778 | 0.113 |
| ΛCDM | BBB + 2S + EB | 0.375 | 10.695 | 0.155 |
| ΛCDM | HMC + 2S + EB | 0.329 | 11.463 | 0.168 |
| CPL | FCNN | 0.033 | 0.0 | - |
| CPL | BBB | 0.373 | 0.013 | 0.357 |
| CPL | HMC | 0.082 | 0.012 | 0.152 |
| CPL | BBB + 2S | 0.59 | 0.001 | 0.495 |
| CPL | HMC + 2S | 0.275 | 0.001 | 0.072 |
| CPL | BBB + 2S + EB | 0.958 | 0.001 | 0.216 |
| CPL | HMC + 2S + EB | 0.648 | 0.001 | 0.194 |
| Quint. | FCNN | 0.022 | 0.016 | - |
| Quint. | BBB | 0.125 | 0.089 | 0.349 |
| Quint. | HMC | 0.006 | 0.011 | 0.021 |
| Quint. | NLM + 2S | 0.138 | 0.335 | 0.334 |
| Quint. | BBB + 2S | 0.221 | 0.13 | 0.377 |
| Quint. | HMC + 2S | 0.038 | 0.03 | 0.096 |
| HS | FCNN | 0.374 | 0.027 | - |
| HS | BBB | 0.374 | 0.161 | 0.427 |
| HS | HMC | 0.257 | 0.121 | 0.43 |
| HS | NLM + 2S | 6.999 | 0.592 | 0.412 |
| HS | BBB + 2S | 2.124 | 1.616 | 0.452 |
| HS | HMC + 2S | 0.885 | 0.984 | 0.487 |
Table 4. Evaluation Metrics of All Bundle Networks and Equations in the OOD Region. Here we Use 2S for Two-step and EB for Error Bounds.
In the OOD region, results are more mixed. For CDM, the combination of two steps and error bounds significantly reduces miscalibration. However, in the CPL model, applying two steps increases miscalibration for BBB but reduces it for HMC; adding error bounds reverses this behavior—improving BBB but slightly worsening HMC. As shown in Figure 26, this is likely because FCNN closely tracks the ground truth in the OOD region, leading to narrow error bounds, while BBB and HMC tend to drift from the true function, which error bounds fail to capture accurately. For the more complex equations, Quintessence and HS, the benefits of the two-step method are less consistent, and no clear advantage is observed over the baseline approaches.

Figure 26. Examples Of CPL Bayesian Solutions Obtained Using The Bundle Solver With Error Bounds. Analytic Solutions Are Presented In Dotted Lines.
In Table 11 we can see how the Bayesian methods provide tighter intervals than deterministic nets. This is due to observations being more likely under the distributions generated by Bayesian methods. These uncertainties can be propagated through the approximated solution to obtain solution distributions that account for the uncertainties in the equation parameters.
Table 12 shows the level of agreement of our results with the literature. Most of our results are in an agreement of or . ΛCDM is an exception, where we observe higher disagreement due to the tight bounds obtained and discrepancy in the means.
Overall, our results demonstrate that leveraging error bounds within a two-step framework significantly enhances uncertainty quantification, particularly in calibration. However, the observed tradeoff between calibration and numerical stability suggests the need for further refinement, especially for highly complex equations such as HS.
Among Bayesian approaches, HMC generally achieves superior accuracy and calibration, but its computational cost is substantial. BBB, on the other hand, performs well when combined with our two-step procedure, offering a more computationally efficient and flexible alternative. There is considerable potential for improving BBB by adopting more expressive variational posterior distributions. Finally, NLM also demonstrates strong performance while being the least expensive method, though its applicability is limited by the underlying distributional assumptions.
References
Yashar Akrami, Renata Kallosh, Andrei Linde, and Valeri Vardanyan. The landscape, the swampland and the era of precision cosmology. Fortschritte der Physik, 67 (1-2):1800075, January 2019. ISSN 0015-8208, 1521-3978. doi: 10.1002/prop.201800075. URL http://arxiv.org/abs/1808.09440. arXiv:1808.09440 [astro-ph, physics:gr-qc, physics:hep-ph, physics:hep-th, physics:math-ph].
C. Armendariz-Picon, V. Mukhanov, and Paul J. Steinhardt. Dynamical Solution to the Problem of a Small Cosmological Constant and Late-Time Cosmic Acceleration. Physical Review Letters, 85(21):4438–4441, November 2000. doi: 10.1103/PhysRevLett.85.4438. URL https://link.aps.org/doi/10.1103/PhysRevLett.85.4438. Publisher: American Physical Society.
Eli Bingham, Jonathan P. Chen, Martin Jankowiak, Fritz Obermeyer, Neeraj Pradhan, Theofanis Karaletsos, Rohit Singh, Paul Szerlip, Paul H. Skrfsl, and Noah D. Goodman. Pyro: Deep Universal Probabilistic Programming, Oc-
Supplementary Material
Pablo Flores; Olga Graf; Pavlos Protopapas; Karim Pichara
Enforcing IC/BC
Two-dimensional Dirichlet Boundary Value Problem
In the Dirichlet problem, also known as first boundary value problem, the values of the solution function at the boundaries are known [6]. In this case the re-parameterization is
where
Error Bounds Computation
First Order Linear ODE with Constant Coefficient
A first-order linear ODE with constant coefficient has the general form
As shown by Liu et al. [2022], the error of a PINN solution to Eq. (29) can be bounded as
when the initial conditions are satisfied i.e . Here, is an upper bound on the residuals
where can be any of the forms , , .
Algorithm 1 Tight Error Bounds
Input: Domain , residual network , an expression for we will call , an expression for we will call , number of partitions , number of points in each partition .
Output: A set of times and error bounds at those times .
Initialize
for do
▷ Implementation of Eq. (37)
end for
Note: returns an array of points equally spaced in the range .
First Order Linear ODE with Nonconstant Coefficient
A first-order linear ODE with nonconstant coefficient has the general form
As shown by Liu et al. [2022], when the initial conditions are satisfied, the error of a PINN solution to Eq. (32) can be bounded as
Where , and is an upper bound on the residuals
where can be any of the forms , , .
Tight Bounds Computation
In Section 2.6, we described how to obtain a bound using the global maximum residual in . However, we can compute a tighter error bound by partitioning the domain .
The tight bound for the first-order ODE with nonconstant coefficients turns out to be
To use the partitions , we define the maximum local residual
and we compute the bounds as
where and . Algorithm 1 in the Supplementary Material shows the implementation of tight bounds computation.
NLM Details
We now provide details on the NLM derivation presented in Section 4.1.1.
we have written and instead of and respectively, to simplify notation. In Eq. (38) and Eq. (39),
Computing Predictive Uncertainty
The computation of predictive uncertainty is straightforward as it is the standard deviation of the posterior predictive distribution. We can obtain it by applying the law of total variance
where and is the sample mean of the network outputs.
The latter approximation applies to BBB and NUTS; for BBB, the samples are taken from the variational posterior, and for NUTS, we use the samples of the true posterior the method yields. We have the analytical expression for NLM as shown in Eq. (38).
Statistical Analysis
It may also be the case that the observed values are a function of the solution. In that scenario, the dataset would become , where and are the mean and standard deviation of the observed function, respectively. Here is a function of the true solution and possibly other parameters , which can also be included in the set of parameters to be estimated. In a similar way to Eq. (24), we can compute the likelihood:
Proofs
Proposition F.1. Given a differential equation of the form for some function and an initial condition . The error of an approximation of is:
if the approximation satisfies the ICs, where .
Proof. Let us take some approximate solution to the DE
where is the approximation, is the true solution and is an error term. We can do the same for the first derivative of the solution. Using Newton’s notation:
Using the definition of
Since is the derivative of the true solution, , thus . Substituting that in Eq. (43), we get
Integrating both sides with respect to :
If , which is the case for our PINNs because we enforce ICs, then
Cosmology Models
CDM Error Bounds Computation
Error Bounds Computation Since this model is a first-order linear system with non-constant coefficients, it is possible to compute its error bounds. To compute the error bounds with Algorithm 1 we need an expression for and . In the CDM model, we have , thus
then
which are the inputs needed for Algorithm 1.
Parametric Dark Energy Error Bounds Computation
Once again, we need to find an expression for the inputs to Algorithm 1. CPL’s equation is also a first-order linear with a non-constant coefficient equation, so the procedure is the same as for CDM. First, we have
we can then simplify the expression as
Finally, the integral turns out to be
Where is the exponential integral defined as . We used computational tools to find the antiderivative of .
Quintessence
The Quintessence [10, 2, 17] (Zlatev et al. 1999) system of equations is
with the following initial conditions
where , are parameters. Given a solution to the system, the Hubble parameter is computed as
Here is also a parameter.
Gravity
The gravity [15, 7] model, which we refer to as HS for the authors Hu and Sawicki [2007] consists of a system of 5 equations.
where
The initial conditions are
where , are the system parameters. Given a solution to the system, the Hubble parameter is computed as
Here is also a parameter.
Implementation Details
As described in § 6, we followed the implementation from [11] to train the FCNNs in the first step. Architecture and hyperparameter details are shown in Table 5 to Table 8. NLM shares FCNN details since it builds on FCNN.
| Equation | Input Dim. | Output Dim. | Hidden Units | Activation | Iterations | Samples per Dim. in a Batch | Learning Rate |
| CDM | 1 | 1 | (32, 32) | Tanh | 100,000 | 64 | 0.001 |
| CPL | 1 | 2 | (32, 32) | Tanh | 100,000 | 128 | 0.001 |
| Quintessence | 1 | 1 | (32, 32) | Tanh | 100,000 | 32 | 0.001 |
| HS | 1 | 1 | (32, 32) | Tanh | 600,000 | 32 | 0.001 |
Table 5. Implementation Details For FCNN.
| Equation | Input Dim. | Output Dim. | Hidden Units | Activation | Posterior Samples | Tune Samples | Samples per Dim. | Prior Std. | Likelihood Std. |
| CDM | 1 | 1 | (32, 32) | Tanh | 10,000 | 1,000 | 32 | 1 | 0.1 |
| CPL | 1 | 2 | (32, 32) | Tanh | 10,000 | 1,000 | 128 | 1 | 0.01 |
| Quintessence | 1 | 1 | (32, 32) | Tanh | 10,000 | 1,000 | 32 | 1 | 0.005 |
| HS | 1 | 1 | (32, 32) | Tanh | 10,000 | 1,000 | 32 | 1 | 0.005 |
Table 8. Implementation Details For HMC.
We used Pytorch [Paszke et al., 2019] for FCNNs, Pyro [3] for BNNs, and Neurodiffeq [12] for aiding in PINNs training.
| Equation | Samples per Dim. | Likelihood Std. |
| CDM | 100 | 0.1 |
| Quintessence | 32 | 0.005 |
| HS | 32 | 0.005 |
Table 6. Implementation Details For NLM.
| Equation | Input Dim. | Output Dim. | Hidden Units | Activation | Iterations | Samples per Dim. | Prior Std. | Learning Rate | Likelihood Std. |
| CDM | 1 | 1 | (32, 32) | Tanh | 20,000 | 64 | 1 | 0.001 | 0.1 |
| CPL | 1 | 2 | (32, 32) | Tanh | 20,000 | 128 | 1 | 0.001 | 0.01 |
| Quintessence | 1 | 1 | (32, 32) | Tanh | 20,000 | 32 | 1 | 0.001 | 0.005 |
| HS | 1 | 1 | (32, 32) | Tanh | 20,000 | 32 | 1 | 0.001 | 0.005 |
Table 7. Implementation Details For BBB.
Exploration of Solutions, Residuals and Errors
To analyze the behavior of residuals and errors in PINNs, we conducted a systematic data collection process. We trained N deterministic PINNs for I iterations to solve each of the cosmological models under study. Throughout training, we recorded solutions and residuals every 10 iterations, evaluating them on a fixed, equidistant set of T time steps. Detailed specifications for each cosmological model are provided in Table 10.
| Equation | Number of NN (N) | Iterations (I) | Time Steps (T) |
| CDM | 1000 | 1000 | 50 |
| CPL | 1000 | 1000 | 50 |
| Quintessence | 1500 | 1000 | 50 |
| HS | 200 | 5000 | 50 |
Table 10. Implementation Details of Appendix I.
Distribution of Solutions After collecting the data, we generated histograms of the solutions throughout training, as shown in Figure 4 to Figure 12. For reference, we overlaid Gaussian distributions with the sample mean and variance in orange. The distribution of solutions varies across cosmological models, with CDM and CPL being the closest to Gaussian, while HS exhibits noticeable bimodality.
Residuals and Errors Relationship Understanding the relationship between solution errors and residuals is crucial for assessing whether residuals can serve as a reliable source of calibrated uncertainties. Ideally, a perfect correlation between residuals and errors would indicate that residuals effectively capture uncertainty.
In Figure 13 to Figure 16, we plot the absolute, normalized values of relative errors against their corresponding residuals for all cosmological models. The results indicate no clear correlation; in fact, the trend often shows higher errors associated with lower residuals. This behavior aligns with the implicit bias described by Wang et al. [2022], where PINNs exhibit lower convergence rates near initial conditions.

Figure 5. Distribution of from CPL. Samples were collected as described in I. Orange lines show a Gaussian distribution with sample mean and variance.

Figure 6. Distribution of from Quintessence. Samples were collected as described in I. Orange lines show a Gaussian distribution with sample mean and variance.

Figure 7. Distribution of from Quintessence. Samples were collected as described in I. Orange lines show a Gaussian distribution with sample mean and variance.

Figure 8. Distribution of from HS. Samples were collected as described in I. Orange lines show a Gaussian distribution with sample mean and variance.

Figure 9. Distribution of from HS. Samples were collected as described in I. Orange lines show a Gaussian distribution with sample mean and variance.

Figure 10. Distribution of from HS. Samples were collected as described in I. Orange lines show a Gaussian distribution with sample mean and variance.

Figure 11. Distribution of from HS. Samples were collected as described in I. Orange lines show a Gaussian distribution with sample mean and variance.

Figure 14. Relationship Between Solution Errors and Residuals from CPL. Samples were collected as described in I.

Figure 15. Relationship Between Solution Errors and Residuals from Quintessence. Samples were collected as described in I. Colors differentiate variables in the system.
Aditional Results

Figure 17. CDM Bayesian Solutions. The Analytic Solution Is Presented In Dotted Lines.

Figure 18. CDM Bayesian Solutions With Error Bounds. The Analytic Solution Is Presented In Dotted Lines.

Figure 19. CPL Bayesian Solutions. The Analytic Solution Is Presented In Dotted Lines.

Figure 20. CPL Bayesian Solutions With Error Bounds. The Analytic Solution Is Presented In Dotted Lines.

Figure 21. Quintessence Bayesian Solutions Residual Likelihood. The Numerical Solution Is Presented In Dotted Lines.

Figure 22. Quintessence Bayesian Solutions. The Numerical Solution Is Presented In Dotted Lines.

Figure 23. HS Bayesian solutions Residual Likelihood. The Numerical Solution Is Presented In Dotted Lines.

Figure 24. HS Bayesian solutions. The Numerical Solution Is Presented In Dotted Lines.

Figure 25. Examples Of CPL Bayesian Solutions Obtained Using The Bundle Solver. Analytic Solutions Are Presented In Dotted Lines.

Figure 27. Examples of Quintessence Bayesian Solutions Obtained Using The Bundle Solver For The Parameter Value . Numerical Solutions Are Presented In Dotted Lines.

Figure 28. Examples of Quintessence Bayesian Solutions Obtained Using The Bundle Solver For The Parameter Value . Numerical Solutions Are Presented In Dotted Lines.

Figure 29. Examples of Quintessence Bayesian Solutions Obtained Using The Bundle Solver For The Parameter Value . Numerical Solutions Are Presented In Dotted Lines.

Figure 30. Examples of Quintessence Bayesian Solutions Obtained Using The Bundle Solver For The Parameter Value . Numerical Solutions Are Presented In Dotted Lines.

Figure 31. Examples Of HS Bayesian Solutions Obtained Using The Bundle Solver For The Parameter Value . Numerical Solutions Are Presented In Dotted Lines.

Figure 32. Examples Of HS Bayesian Solutions Obtained Using The Bundle Solver For The Parameter Value . Numerical Solutions Are Presented In Dotted Lines.

Figure 33. Examples Of HS Bayesian Solutions Obtained Using The Bundle Solver For The Parameter Value . Numerical Solutions Are Presented In Dotted Lines.

Figure 34. Examples Of HS Bayesian Solutions Obtained Using The Bundle Solver For The Parameter Value . Numerical Solutions Are Presented In Dotted Lines.
| Equation | Method | MRE | Mean Residual | Miscal. Area | RMS Cal. | MA Cal. | Sharpness | NLL | CRPS | Check | Interval | Acc. MAE | Acc. RMSE | Acc. MDAE | Acc. MARPD |
| ΛCDM | FCNN | 0.216 | 0.0 | - | - | - | - | - | - | - | - | - | - | - | - |
| ΛCDM | BBB | 0.955 | 0.154 | 0.491 | 0.566 | 0.486 | 0.101 | 27843.2 | 0.019 | 10.01 | 208.426 | 20.073 | 28.172 | 12.83 | 187.161 |
| ΛCDM | HMC | 0.361 | 3.127 | 0.491 | 0.566 | 0.486 | 0.516 | 319.717 | 11.214 | 5.612 | 113.07 | 11.453 | 19.039 | 2.687 | 49.016 |
| ΛCDM | NLM + 2S | 0.226 | 6.544 | 0.224 | 0.258 | 0.222 | 0.546 | 247.862 | 9.743 | 4.876 | 298.293 | 9.939 | 17.917 | 0.023 | 32.164 |
| ΛCDM | BBB + 2S | 0.29 | 3.807 | 0.185 | 0.222 | 0.183 | 0.3 | 1100.191 | 11.292 | 5.648 | 116.159 | 11.41 | 19.662 | 0.459 | 41.833 |
| ΛCDM | HMC + 2S | 0.23 | 3.842 | 0.203 | 0.235 | 0.201 | 0.634 | 135.058 | 9.739 | 4.875 | 97.661 | 9.977 | 17.878 | 0.075 | 32.568 |
| ΛCDM | NLM + 2S + EB | 0.221 | 6.623 | 0.148 | 0.186 | 0.147 | 17.23 | −0.472 | 5.948 | 3.004 | 25.502 | 9.792 | 17.737 | 0.005 | 31.357 |
| ΛCDM | BBB + 2S + EB | 0.266 | 3.69 | 0.114 | 0.137 | 0.113 | 17.265 | 2.216 | 6.958 | 3.513 | 30.458 | 11.066 | 19.178 | 0.855 | 38.671 |
| ΛCDM | HMC + 2S + EB | 0.222 | 3.841 | 0.111 | 0.138 | 0.11 | 17.251 | −0.208 | 5.953 | 3.006 | 25.627 | 9.788 | 17.707 | 0.055 | 31.387 |
| CPL | FCNN | 0.002 | 0.0 | - | - | - | - | - | - | - | - | - | - | - | - |
| CPL | BBB | 0.008 | 0.014 | 0.359 | 0.394 | 0.355 | 0.023 | −3.196 | 0.006 | 0.003 | 0.036 | 0.006 | 0.011 | 0.001 | 0.766 |
| CPL | HMC | 0.009 | 0.014 | 0.268 | 0.288 | 0.266 | 0.016 | −4.458 | 0.004 | 0.002 | 0.02 | 0.007 | 0.012 | 0.0 | 0.905 |
| CPL | BBB + 2S | 0.036 | 0.026 | 0.103 | 0.114 | 0.102 | 0.019 | −2.284 | 0.021 | 0.01 | 0.123 | 0.026 | 0.043 | 0.004 | 3.444 |
| CPL | HMC + 2S | 0.016 | 0.019 | 0.267 | 0.3 | 0.265 | 0.034 | −3.87 | 0.008 | 0.004 | 0.041 | 0.012 | 0.02 | 0.001 | 1.592 |
| CPL | BBB + 2S + EB | 0.021 | 0.015 | 0.115 | 0.137 | 0.114 | 0.007 | −2.376 | 0.013 | 0.006 | 0.093 | 0.015 | 0.027 | 0.001 | 1.993 |
| CPL | HMC + 2S + EB | 0.158 | 0.257 | 0.389 | 0.443 | 0.385 | 0.07 | 5.18 | 0.093 | 0.047 | 0.7 | 0.11 | 0.292 | 0.0 | 10.464 |
| Quintessence | FCNN | 0.044 | 0.054 | - | - | - | - | - | - | - | - | - | - | - | - |
| Quintessence | BBB | 0.838 | 0.109 | 0.482 | 0.553 | 0.477 | 0.025 | 163.756 | 0.127 | 0.064 | 1.113 | 0.14 | 0.171 | 0.135 | nan |
| Quintessence | HMC | 0.06 | 0.07 | 0.176 | 0.204 | 0.174 | 0.01 | −4.034 | 0.013 | 0.006 | 0.08 | 0.015 | 0.03 | 0.0 | nan |
| Quintessence | NLM + 2S | 0.073 | 0.257 | 0.19 | 0.23 | 0.188 | 0.015 | −3.317 | 0.017 | 0.008 | 0.109 | 0.021 | 0.041 | 0.0 | 9.054 |
| Quintessence | BBB + 2S | 0.201 | 0.147 | 0.128 | 0.181 | 0.126 | 0.004 | 40.068 | 0.036 | 0.018 | 0.352 | 0.038 | 0.068 | 0.002 | nan |
| Quintessence | HMC + 2S | 0.072 | 0.084 | 0.124 | 0.142 | 0.123 | 0.016 | −4.948 | 0.014 | 0.007 | 0.068 | 0.019 | 0.036 | 0.0 | nan |
| HS | FCNN | 0.216 | 0.0 | - | - | - | - | - | - | - | - | - | - | - | - |
| HS | BBB | 1.224 | 0.215 | 0.487 | 0.56 | 0.482 | 0.013 | 2094.883 | 0.324 | 0.162 | 3.284 | 0.33 | 0.378 | 0.347 | nan |
| HS | HMC | 0.268 | 0.128 | 0.44 | 0.512 | 0.436 | 0.013 | 723.293 | 0.138 | 0.069 | 1.326 | 0.144 | 0.169 | 0.148 | nan |
| HS | NLM + 2S | 0.353 | 0.324 | 0.152 | 0.184 | 0.151 | 0.409 | −1.279 | 0.149 | 0.075 | 0.862 | 0.197 | 0.341 | 0.012 | 35.335 |
| HS | BBB + 2S | 0.158 | 0.326 | 0.219 | 0.253 | 0.216 | 0.012 | 59.506 | 0.028 | 0.014 | 0.239 | 0.031 | 0.068 | 0.007 | nan |
| HS | HMC + 2S | 0.262 | 0.212 | 0.265 | 0.304 | 0.263 | 0.021 | 90.284 | 0.024 | 0.012 | 0.182 | 0.028 | 0.066 | 0.006 | nan |
Table 14. Metrics of the NN Forward Solutions.
References
- [1]Yashar Akrami, Renata Kallosh, Andrei Linde, and Valeri Vardanyan. The landscape, the swampland and the era of precision cosmology. Fortschritte der Physik, 67 (1-2):1800075, January 2019. ISSN 0015-8208, 1521-3978. doi: 10.1002/prop.201800075. URL http://arxiv.org/abs/1808.09440. arXiv:1808.09440 [astro-ph, physics:gr-qc, physics:hep-ph, physics:hep-th, physics:math-ph].
- [2]C. Armendariz-Picon, V. Mukhanov, and Paul J. Steinhardt. Dynamical Solution to the Problem of a Small Cosmological Constant and Late-Time Cosmic Acceleration. Physical Review Letters, 85(21):4438–4441, November 2000. doi: 10.1103/PhysRevLett.85.4438. URL https://link.aps.org/doi/10.1103/PhysRevLett.85.4438. Publisher: American Physical Society.
- [3]Eli Bingham, Jonathan P. Chen, Martin Jankowiak, Fritz Obermeyer, Neeraj Pradhan, Theofianis Karaletsos, Rohit Singh, Paul Szerlip, Paul Horsfall, and Noah D. Goodman. Pyro: Deep Universal Probabilistic Programming, Oc- tober 2018. URL http://arxiv.org/abs/1810.09538. arXiv:1810.09538 [cs, stat].
- [4]Christopher M. Bishop. Pattern Recognition and Machine Learning (Information Science and Statistics). Springer-Verlag, Berlin, Heidelberg, July 2006. ISBN 978-0-387-31073-2.
- [5]Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural networks. 32nd International Conference on Machine Learning, ICML 2015, 2:1613–1622, 2015. arXiv: 1505.05424 ISBN: 9781510810587.arxiv.org/abs/1505.05424
- [6]William E Boyce and Richard C DiPrima. Elementary differential equations and boundary value problems. John Wiley & Sons, Chichester, England, 9 edition, October 2008.
- [7]H. A. Buchdahl. Non-Linear Lagrangians and Cosmological Theory. Monthly Notices of the Royal Astronomical Society, 150(1):1–8, September 1970. ISSN 0035-8711. doi: 10.1093/mnras/150.1.1. URL https://doi.org/10.1093/mnras/150.1.1.
- [8]Shengze Cai, Zhiping Mao, Zhicheng Wang, Minglang Yin, and George Em Karniadakis. Physics-informed neural networks (PINNs) for fluid mechanics: a review. Acta Mechanica Sinica, 37(12):1727–1738, December 2021a. ISSN 1614-3116. doi: 10.1007/s10409-021-01148-1. URL https://doi.org/10.1007/s10409-021-01148-1.
- [9]Shengze Cai, Zhicheng Wang, Sifan Wang, Paris Perdikaris, and George Em Karniadakis. Physics-Informed Neural Networks for Heat Transfer Problems. Journal of Heat Transfer, 143(6), April 2021b. ISSN 0022-1481. doi: 10.1115/1.4050542. URL https://doi.org/10.1115/1.4050542.
- [10]R. R. Caldwell, Rahul Dave, and Paul J. Steinhardt. Cosmological Imprint of an Energy Component with General Equation of State. Physical Review Letters, 80(8):1582–1585, February 1998. doi: 10.1103/PhysRevLett.80.1582. URL https://link.aps.org/doi/10.1103/PhysRevLett.80.1582. Publisher: American Physical Society.DOI
- [11]Augusto T. Chantada, Susana J. Landau, Pavlos Protopapas, Claudia G. Scóccola, and Cecilia Garraffo. Cosmological informed neural networks to solve the background dynamics of the Universe. May 2022. URL http://arxiv.org/abs/2205.02945. arXiv:2205.02945 [astro-ph, physics:gr-qc, physics:hep-ph].
- [12]Feiyu Chen, David Sondak, Pavlos Protopapas, Marios Mattheakis, Shuheng Liu, Devansh Agarwal, and Marco Di Giovanni. NeuroDiffEq: A Python package for solving differential equations with neural networks. Journal of Open Source Software, 5(46):1931, February 2020. ISSN 2475-9066. doi: 10.21105/joss.01931. URL https://joss.theoj.org/papers/10.21105/joss.01931.
- [13]Michel Chevallier and David Polarski. Accelerating universes with scaling dark matter. International Journal of Modern Physics D, 10(02):213–223, April 2001. ISSN 0218-2718. doi: 10.1142/S0218271801000822. URL https://www.worldscientific.com/doi/abs/10.1142/S0218271801000822. Publisher: World Scientific Publishing Co.DOI
- [14]Youngseog Chung, Ian Char, Han Guo, Jeff Schneider, and Willie Neiswanger. Uncertainty Toolbox: an Open-Source Library for Assessing, Visualizing, and Improving Uncertainty Quantification, September 2021. URL http://arxiv.org/abs/2109.10254. arXiv:2109.10254 [cs, stat].
- [15]Timothy Clifton, Pedro G. Ferreira, Antonio Padilla, and Constantinos Skordis. Modified gravity and cosmology. Physics Reports, 513(1):1–189, March 2012. ISSN 0370-1573. doi: 10.1016/j.physrep.2012.01.001. URL https://www.sciencedirect.com/science/article/pii/S0370157312000105.DOI
- [16]Zhang Cong, Zhang Han, Yuan Shuo, Liu Siqi, Zhang Tong-Jie, and Sun Yan-Chun. Four new observational H(z) data from luminous red galaxies in the Sloan Digital Sky Survey data release seven. Research in Astronomy and Astrophysics, 14(10):1221, October 2014. ISSN 1674-4527. doi: 10.1088/1674-4527/14/10/002. URL https://dx.doi.org/10.1088/1674-4527/14/10/002.
- [17]Edmund J. Copeland, Andrew R. Liddle, and David Wands. Exponential potentials and cosmological scaling solutions. Physical Review D, 57(8):4686–4690, April 1998. doi: 10.1103/PhysRevD.57.4686. URL https://link.aps.org/doi/10.1103/PhysRevD.57.4686. Publisher: American Physical Society.DOI
- [18]Rocco D’Agostino and Rafael C. Nunes. Measurements of $H_0$ in modified gravity theories: The role of lensed quasars in the late-time Universe. Physical Review D, 101(10):103505, May 2020. ISSN 2470-0010, 2470-0029. doi: 10.1103/PhysRevD.101.103505. URL http://arxiv.org/abs/2002.06381. arXiv:2002.06381 [astro-ph, physics:gr-qc, physics:hep-ph].
- [19]Arka Daw, Jie Bu, Sifan Wang, Paris Perdikaris, and Anuj Karpatne. Mitigating Propagation Failures in PINNs using Evolutionary Sampling, October 2022. URL http://arxiv.org/abs/2207.02338. arXiv:2207.02338 [cs].