Adversarial Uncertainty Quantification in Physics-Informed Neural Networks

We present a deep learning framework for quantifying and propagating uncertainty in systems governed by non-linear differential equations using physics-informed neural networks. Specifically, we employ latent variable models to construct probabilistic representations for the system states, and put forth an adversarial inference procedure for training them on data, while constraining their predictions to satisfy given physical laws expressed by partial differential equations. Such physics-informed constraints provide a regularization mechanism for effectively training deep generative models as surrogates of physical systems in which the cost of data acquisition is high, and training data-sets are typically small. This provides a flexible framework for characterizing uncertainty in the outputs of physical systems due to randomness in their inputs or noise in their observations that entirely bypasses the need for repeatedly sampling expensive experiments or numerical simulators. We demonstrate the effectiveness of our approach through a series of examples involving uncertainty propagation in non-linear conservation laws, and the discovery of constitutive laws for flow through porous media directly from noisy data.


Introduction
Recent advances in machine learning and data analytics have yielded transformative results across diverse scientific disciplines, including image recognition [1], natural language processing [2], cognitive science [3], and genomics [4]. In all aforementioned areas, the volume of data has increased substantially compared to even a decade ago, but analyzing big data is expensive and time-consuming. Data-driven methods, which have been enabled by the availability of sensors, data storage, and computational resources, are taking center stage across many disciplines of science. We now have highly scalable solutions for problems in object detection and recognition, machine translation, text-to-speech conversion, recommender systems, and information retrieval [2]. All of these solutions attain state-of-the-art performance when trained with large amounts of data.
However, more often than not, in laboratory experiments and large-scale simulations aiming to elucidate and predict complex phenomena, a large number of quality and error-free data is prohibitively costly to obtain. Under this setting, purely data-driven approaches for machine learning present difficulties when the data is scarce relative to the complexity of the system. The vast majority of state-of-the art machine learning techniques (e.g., deep neural nets, convolutional networks, recurrent networks, etc. [5]) are lacking robustness and fail to provide any guarantees of convergence or quantify the error/uncertainty associated with their predictions. Hence, the ability to learn in a robust and sample-efficient manner is a necessity in these datalimited domains. Even less well understood is how one can constrain such algorithms to leverage domain-specific knowledge and return predictions that satisfy certain physical principles (e.g., conservation of mass, momentum, etc.).
These shortcomings often generate skepticism and disbelief among applied mathematicians and engineers regarding the solid grounding of purely data-driven machine learning approaches. In recent work, Raissi et. al. [6,7,8,9,10] set foot exactly at this relatively unexplored interface between applied mathematics and contemporary machine learning by revisiting the idea of penalizing the loss function of deep neural networks using differential equation constraints, as first put forth by Psichogios and Ungar [11] and Lagaris et. al. [12]. This line of work has empirically demonstrated how such physics-informed constraints regularize learning in small data regimes, can lead to the discovery of governing equations and reduced-order models, as well as enable the prediction of complex dynamics from incomplete models and incomplete data. Despite a series of impressive results in canonical problems, Raissi et. al. [6,7] have also pointed out cases in which the training phase of these algorithms faces severe difficulties for reasons that are cur-rently poorly understood. In lack of supporting theory on convergence and a-posteriori error estimation, this naturally poses the need for for scalable algorithms for uncertainty quantification.
A literature review of the current state-of-the-art in uncertainty quantification reveals a subtle dichotomy between different communities. On one hand, researchers in applied mathematics and scientific computing predominately rely on mathematical models that are rigorously derived from first physical principles. At the dawn of exascale computing, such models have enabled the accurate simulation of increasingly more complex phenomena (see for e.g., [13,14]). They have also enabled in-silico systematic studies in which the behavior of a system can be probed in a controlled fashion for different conditions, parameter settings, external inputs, etc. [15]. The latter aims to both elucidate the key mechanisms that govern the behavior of a system, but also characterize the robustness of the resulting predictions with respect to epistemic and aleatory uncertainty [16]. However, despite the fact that much progress has been made over the last two decades, the most popular methods for scientific computing under uncertainty, such as polynomial chaos expansions [17,18,19], sparse grid quadratures [20,21], multi-level/multi-fidelity Monte Carlo sampling [22,23], proper orthogonal decomposition [24,25], and Gaussian process regression models [26,27,28], all face severe limitations in view of the non-Gaussian likelihoods and high-dimensional posterior distributions commonly encountered in realistic applications.
On the other hand, the recent explosive growth of machine learning research has put forth new effective ways of learning and manipulating complex high-dimensional probability distributions. Inference tools like variational auto-encoders [29] and generative adversarial networks [30], formulated on top of flexible building blocks such as feed-forward/convolutional/recurrent neural networks [5] have introduced highly scalable solutions, albeit for problems where not much prior information is assumed, but instead, large amounts of data can be obtained at relatively low cost (e.g., image recognition [1], natural language processing [2]). In this work, we aim to leverage recent developments in machine learning to put forth a scalable framework for uncertainty propagation in physical systems for which the cost of data acquisition is high and training data-sets are typically small, but strong prior information exists by means of known governing laws expressed by partial differential equations. Specifically, we construct a class of probabilistic physics-informed neural networks that enables us to obtain a posterior characterization of the uncertainty associated with their predicted outputs. Moreover, we will de-velop a flexible variational inference framework that will allow us to train such models directly from noisy input/output data, and predict outcomes of non-linear dynamical systems that are partially observed with quantified uncertainty. This setting necessitates a departure from the classical deterministic realm of modeling and scientific computation, and, consequently, our main building blocks can no longer be crisp deterministic numbers and governing laws, but instead we must operate with probabilistic models.
This paper is structured as follows. In section 2.1 we provide a brief overview of physics-informed neural networks in sync with the recent developments in [6,7,9,10]. In sections 2.2 and 2.3 we provide an outline of the proposed probabilistic formulation and the proposed variational inference framework. Finally, in section 3 we will demonstrate the effectiveness of our approach through a series of examples involving uncertainty propagation in non-linear conservation laws, and the discovery of constitutive laws for flow through porous media directly from noisy data.

Physics-informed neural networks
The recent works of Raissi et. al. [6,7,9,10] have demonstrated how classical conservation laws and numerical discretization schemes can be used as structured prior information that can enhance the robustness and efficiency of modern machine learning algorithms, introducing a new class of data-driven solvers, as well as a physics-informed machine learning approach to model discovery. To this end, the authors have considered constructing deep neural networks that return predictions which are constrained by parametrized partial differential equations (PDE) of the form where u(x, t) is represented by a deep neural network parametrized by a set of parameters θ, i.e. u(x, t) = f θ (x, t), x is a vector of space coordinates, t is the time coordinate, and N x is a nonlinear differential operator. As neural networks are differentiable representations, this construction defines a so-called physics informed neural network that corresponds to the PDE residual, i.e.
This new network has the same parameters as the network representing u(x, t), albeit different activation functions due to the action of the differential operator [6,11,12]. From an implementation perspective, this network can be readily obtained by leveraging recent progress in automatic differentiation [31,32]. The resulting training procedure allows us to recover the shared network parameters θ using a few scattered observations of u(x, t), namely {(x i , t i ), u i }, i = 1, . . . , N u , along with a larger number of collocation points {(x i , t i ), r i = 0}, i = 1, . . . , N r , that aim to penalize the PDE residual at a finite set of N r collocation nodes. This simple, yet remarkably effective regularization procedure allows us to introduce the PDE residual as a soft penalty constraint penalty in the likelihood function of the model [6,7], and the resulting optimization problem can be effectively solved using standard stochastic gradient descent without necessitating any elaborate constrained optimization techniques, simply by minimizing the composite loss function where the required gradients ∂L ∂θ can be readily obtained using automatic differentiation [31]. Finally, as the resulting predictions are encouraged to inherit any physical properties imposed by the PDE constraint (e.g., conservation, invariance, symmetries, etc.), this approach showcases how one can approximately encode physical and domain-specific constraints in modern machine learning algorithms and introduce a new form of regularization for learning from small data-sets.

Probabilistic physics-informed neural networks
Here we put forth a probabilistic formulation for propagating uncertainty through physics-informed neural networks using latent variable models of the form This setting encapsulates a wide range of deterministic and stochastic problems, where u(x, t) is a potentially multi-variate field, and z is a collection of random latent variables. The ability to learn such a model from data is the cornerstone of probabilistic scientific computing and uncertainty quantification in physical systems. Knowledge of the conditional probability p(u|x, t, z) subject to domain knowledge constraints introduces a regularization mechanism that limits the space of admissible solutions to a manageable size (e.g., in fluid mechanics problems by discarding any non-realistic flow solutions that violate the conservation of mass principle), thus enables training of probabilistic deep learning algorithms in small data regimes. Moreover, by providing a complete characterization of uncertainty, it enhances the robustness of our predictions, and provides a-posteriori error estimates for assessing model inadequacy. The latter, can also enable downstream tasks such as the formulation of adaptive data acquisition policies for active learning or Bayesian optimization [33] with domain knowledge constraints. Finally, thanks to the structure encoded by the PDE itself, the resulting latent variables z can potentially lead to the extraction of physically relevant and interpretable low-dimensional feature representations, which can subsequently introduce new techniques for nonlinear model order reduction and coarse-graining of complex systems.

Adversarial inference for joint distribution matching
Following the recent findings of [34] we argue that matching the joint distribution of the generated data p θ (x, t, u) with the joint distribution of the observed data q(x, t, u) by minimizing the reverse Kullback-Leibler divergence KL[p θ (x, t, u)||q(x, t, u)] is a promising approach to train the generative model presented in equation 3. This also implies that the respective marginal and conditional distributions are also encouraged to match. The use of the reverse Kullback-Leibler divergence (in contrast to the maximum likelihood setup) is motivated by examining the following decomposition where h(p θ (x, t, u)) denotes the entropy of the generative model. The second term can be further decomposed as where S p θ and S q denote the support of the distributions p θ (x, t, u) and q(x, t, u), respectively, while S o q denotes the complement of S q . Notice that by minimizing the Kullback-Leibler divergence in equation 4 we introduce a mechanism that is trying to balance the effect of two competing objectives. Specifically, maximization of the entropy term h(p θ (x, t, u))) encourages p θ (x, t, u) to spread over its support set as wide, while the second integral term in equation 5 introduces a strong (negative) penalty when the support of p θ (x, t, u) and q(x, t, u) do not overlap. Hence, the support of p θ (x, t, u) is encouraged to spread only up to the point that S p θ ∩ S q o = ∅, implying that S p θ ⊆ S q o . When S p θ ⊂ S q o the pathological issue of "modecollapse" (commonly encountered in the training of generative adversarial networks [30]) is manifested [35]. This issue is present if one seeks to directly minimize the reverse Kullback-Leibler objective in equation 4 as this provides no control on the relative importance of the two terms. As discussed in [34], we may rather minimize −λh(p θ (x, t, u))) − E p θ (x,t,u) [log(q(x, t, u))], with λ ≥ 1 to allow for control of how much emphasis is placed on mitigating mode collapse. It is then clear that the entropic regularization introduced by h(p θ (x, t, u))) provides an effective mechanism for controlling and mitigating the effect of mode collapse, and, therefore, potentially enhancing the robustness adversarial inference procedures for learning p θ (x, t, u).
Minimization of equation 4 with respect to the generative model parameters θ presents two fundamental difficulties. First, the evaluation of both distributions p θ (x, t, u) and q(x, t, u) typically involves intractable integrals in high dimensions, and we may only have samples drawn from the two distributions, not their explicit analytical forms. Second, the differential entropy term h(p θ (x, t, u))) is intractable as p θ (x, t, u)) is not known a-priori. In the next sections we revisit the unsupervised formulation put forth in [34] and derive a tractable inference procedure for learning p θ (x, t, u)) from scattered observation pairs of u(x, t), namely {(x i , t i ), u i }, i = 1, . . . , N u .

Density ratio estimation by probabilistic classification
By definition, the computation of the Kullback-Leibler divergence in equation 4 involves computing an expectation over a log-density ratio, i.e.
In general, given samples from two distributions, we can approximate their density ratio by constructing a binary classifier that distinguishes between samples from the two distributions. To this end, we assume that N data points are drawn from p θ (x, t, u) and are assigned a label y = +1. Similarly, we assume that N samples are drawn from q(x, t, u) and assigned label y = −1. Consequently, we can write these probabilities in a conditional form, namely where ρ(x, t, u|y = +1) and ρ(x, t, u|y = −1) are the class probabilities predicted by a binary classifier T (x, t, u). Using Bayes rule, it is then straightforward to show that the density ratio of p θ (x, t, u) and q(x, t, u) can be computed as This simple procedure suggests that we can harness the power of deep neural network classifiers to obtain accurate estimates of the reverse Kullback-Leibler divergence in equation 4 directly from data and without the need to assume any specific parametrization for the generative model distribution p θ (x, t, u).

Entropic regularization bound
Here we follow the derivation of Li et. al [34] to construct a computable lower bound for the entropy h(p θ (x, t, u)). To this end, we start by considering random variables (x, t, u, z) under the joint distribution , and δ(·) is the Dirac delta function. The mutual information between (x, t, u) and z satisfies the information theoretic identity where h(x, t, u), h(z) are the marginal entropies and h(x, t, u|z), h(z|x, t, u) are the conditional entropies [36]. Since in our setup x and t are deterministic variables independent of z, and samples of p θ (u|x, t, z) are generated by a deterministic function where h(z) := − log p(z)p(z)dz does not depend on the generative model parameters θ. Now consider a general variational distribution q φ (z|x, t, u) parametrized by a set of parameters φ. Then, Viewing z as a set of latent variables, then q φ (z|x, t, u) is a variational approximation to the true intractable posterior over the latent variables p θ (z|x, t, u). Therefore, if q φ (z|x, t, u) is introduced as an auxiliary inference model associated with the generative model p θ (x, t, u), for which u = f θ (x, t, z) and z ∼ p(z), then we can use equations 7 and 8 to bound the entropy term in equation 4 as Note that the inference model q φ (z|x, t, u) plays the role of a variational approximation to the true posterior over the latent variables, and appears naturally using information theoretic arguments in the derivation of the lower bound.

Adversarial training objective
By leveraging the density ratio estimation procedure described in section 2.3.1 and the entropy bound derived in section 2.3.2, we can derive the following loss functions for minimizing the reverse Kullback-Leibler divergence with entropy regularization where σ(x) = 1/(1 + e −x ) is the logistic sigmoid function. Notice how the binary cross-entropy objective of equation 10 aims to progressively improve the ability of the classifier T ψ (x, t, u) to discriminate between "fake" samples (x, t, f θ (x, t, z)) obtained from the generative model p θ (x, t, u) and "true" samples (x, t, u) originating from the observed data distribution q(x, t, u).
Simultaneously, the objective of equation 11 aims at improving the ability of the generator f θ (x, t, u) to generate increasingly more realistic samples that can "fool" the discriminator T ψ (x, t, u). Moreover, the encoder q φ (z|x, t, f θ (x, t, z)) not only serves as an entropic regularization term than allows us to stabilize model training and mitigate the pathology of mode collapse, but also provides a variational approximation to true posterior over the latent variables. The way it naturally appears in the objective of equation 11 also encourages the cycle-consistency of the latent variables z; a process that is known to result in disentangled and interpretable low-dimensional representations of the observed data [37], which could be subsequently used as good features for nonlinear model order reduction. In theory, the optimal set of parameters {θ * , φ * , ψ * } correspond to the Nash equilibrium of the two player game defined by the loss functions in equations 10,11, for which one can show that the exact model distribution and the exact posterior over the latent variables can be recovered [30,38]. In practice, although there is no guarantee that this optimal solution can be attained, the generative model can be trained by alternating between optimizing the two objectives in equations 10,11 using stochastic gradient descent as

Adversarial training with physics-informed constrains
In order to learn the physics-informed probabilistic model of equation 3 from data we can extend the adversarial inference framework presented above by appropriately penalizing the loss function of the generator (see equation 11). The available data correspond to scattered observation pairs {(x i , t i ), u i }, i = 1, . . . , N u , originating from known initial or boundary conditions, or any other (potentially noisy) measurements of u(x, t). In analogy to the deterministic setting put for in [6] and summarized in section 2.1, by defining r θ (x, t, z) := ∂ ∂t f θ (x, t, z) + N x f θ (x, t, z) we essentially introduce a new conditional probability model p θ (r|x, t, z) that shares the same parameters as p θ (u|x, t, z), albeit the underlying neural network that serves as its approximation has different activation functions. However, since we would like to encourage every sample u = f θ (x, t, z) produced by the generator to satisfy the PDE constraint, we can simply treat the residual as a deterministic variable, i.e, r θ (x, t, z) = r θ (x, t), and enforce the constraint at a finite set of collocation points N r by simply minimizing the mean square loss Then, the resulting adversarial game for training the physics-informed model of equation 3 takes the form where positive values of β can be selected to place more emphasis on penalizing the PDE residual. For β > 0, the residual loss L P DE (θ) acts as a regularization term that approximately enforces the given physical constraint, and, therefore, encourages the generator p θ (u|x, t, z) to produce samples that satisfy the underlying partial differential equation. Also note that this structured approach also encourages the encoder q φ (z|x, t, f θ (x, t, z)) to learn a set of spatio-temporal latent variables z that are relevant to the underlying physics, possibly opening a new directions for probabilistic model order reduction of complex systems.

Predictive distribution
Once the model is trained we can construct a probabilistic ensemble for the solution u(u|x, t, z) by sampling latent variables from the prior p(z) and passing them through the generator to yield samples u = f θ (x, t, z) that are distributed according to the predictive model distribution p θ (u|x, t, z).
Note that although the explicit form of this distribution is not known, we can efficiently compute any of its moments via Monte Carlo sampling. The cost of this prediction step is negligible compared to the cost of training the model, as it only involves a single forward pass through the generator function f θ (x, t, z). Typically, we compute the mean and variance of the predictive distribution at a new test point (x * , t * ) as where z i ∼ p(z), i = 1, . . . , N s , and N s corresponds to the total number of Monte Carlo samples.

Advantages and caveats of adversarial learning
Since their recent introduction [30,39,40,41], adversarial learning techniques have provided great flexibility for performing probabilistic computations with arbitrarily complex implicit distributions. Essentially, they have lifted the over-simplified approximations typically used in variational inference (Gaussian approximations, exponential families, etc.) [42], yielding very general and flexible schemes for statistical inference. However, this flexibility comes at a price, as such methods in practice require very careful tuning in order to achieve stable and accurate performance. To this end, recall the training objective defined in equation 15 that introduces an adversarial game between the generator and discriminator networks [30]. In practice, this mini-max optimization problem is solved by alternating stochastic gradient updates between the two competing objectives, and it is highly sensitive on the capacity of the neural networks modeling the generator and discriminator, as well as the relative frequency with which the parameters of each network are updated within each iteration of stochastic gradient descent. To this end, we provide a series of empirical observations and lessons we learned throughout this study that can enhance the robustness and stability of this training procedure: • Changing the relative number of stochastic gradient updates for the generator K g and the discriminator K d is equivalent to changing their neural network architecture. For example, we can reduce the capacity of discriminator by either performing more stochastic gradient updates for the generator, or remove one layer in the neural network architecture of the discriminator.
• Given enough collocation points N r for penalizing the PDE residual, we can obtain robust uncertainty estimates together with precise predictions simply by tuning the capacity of discriminator and generator networks.
• Typically, by fixing the generator, we expect the discriminator to have some capacity so that the model training dynamics remain stable. But, we do not want the discriminator to be very powerful as in that case there will by very little information from the discriminator that can help the generator to improve towards producing more realistic samples (this a common characteristic of adversarial inference procedures [30]).
• For cases with a small number of training data we should reduce the capacity of the discriminator. This can be achieved by either changing the relative frequency of stochastic gradient updates for the generator and discriminator, or by reducing the capacity of the discriminator neural network architecture.

Results
In all examples we have trained the models for 30,000 stochastic gradient descent steps using the Adam optimizer [43] with a learning rate of 10 −4 , while fixing a one-to-five ratio for the discriminator versus generator updates. Moreover, we have fixed the entropic regularization and the residual penalty parameters to λ = 1.5 and β = 1.0, respectively. The proposed algorithms were implemented in Tensorflow v1.10 [32], and computations were performed in single precision arithmetic on a single NVIDIA Tesla P100 GPU card. All data and code accompanying this manuscript will be made available at https://github.com/PredictiveIntelligenceLab/UQPINNs.

A pedagogical example
Let us illustrate the basic capabilities of the proposed methods through a simple example corresponding to the following nonlinear second-order or-dinary differential equation subject to random boundary conditions u(−1), u(1) ∼ N (0, σ 2 n I). For this simple example, the deterministic solution corresponding to σ 2 n = 0 can be readily obtained as u(x) = sin(πx). Given N u observations of u(x) corresponding to different realizations of the random boundary conditions our goal is to obtain a probabilistic representation of the solution p θ (u|x, z) by training a physics-informed generative model of the form u = f θ (x, z), z ∼ p(z) that is constrained by equation 18. To this end, we introduce three deterministic mappings parametrized by deep neural networks, namely f θ (x, z), q φ (x, u), and T ψ (x, u) corresponding to the generator, encoder, and discriminator functions introduced in section 2.3. By construction, we also obtain a physics-informed neural network r θ (x) corresponding to the deterministic residual of equation 18 that will be used to approximately enforce the differential equation constraint at a set of N r = 100 randomly distributed collocation points x ∈ [−1, 1]. All neural networks were chosen to have two hidden layers with 50 neurons in each layer, and a hyperbolic tangent activation function. Moreover, the dimensionality of the latent variables was set to one, i.e. z = z, and we have assumed an isotropic standard normal prior, namely p(z) ∼ N (0, 1). As the training data for u(x) reflects the uncertainty in the boundary conditions, the role of the latent variables z is to enable the propagation of this uncertainty into the predicted solution obtained through the generative model p θ (u|x, z).
Here we have considered two cases corresponding to deterministic and random boundary conditions, namely (i) σ 2 n = 0 (i.e., noise-free data), and (ii) σ 2 n = 0.05 (i.e., %5 Gaussian uncorrelated noise). In all cases, the training data consists of N u = 20 realizations for each boundary point, u(−1), u(1), and a total of N r = 100 collocation points for enforcing the residual of equation 18. Our probabilistic predictions for this example are summarized in figures 1 and 2. Specifically, figure 1(a) shows the generative model predictive mean and two standard deviations, plotted against the exact solution of this problem. Note that this case corresponds to deterministic training data for the boundary conditions, hence the exact solution is deterministic, and the prediction error here is measured as E L 2 = 1.36 · 10 −3 in the relative L 2 norm where N * = 200 denotes the total number of equidistant test points x * in the interval [−1, 1]. Moreover, the variance shown in the inset of figure 1(a) serves as an a-posteriori error estimate that quantifies the uncertainty associated with the generative model predictions. Figure 1(b) shows the resulting prediction and uncertainty estimates corresponding to random boundary conditions, compared against a reference mean solution obtained numerically using a spectral method with 2,000 Monte Carlo samples. In this case, the predictive uncertainty of the generative model reflects the aggregate total uncertainty due to both randomness in the boundary conditions and the inherent epistemic uncertainty in the neural network approximation. As the generative model can return a complete statistical characterization of the solution by means of its conditional probability density p θ (u|x, z), in figure  2 we provide a visual comparison of the one-dimensional marginals between our predictions and the reference Monte Carlo solution corresponding to the spatial locations x = −0.5 and x = 0.5. Albeit simple, this example aims to demonstrate the basic capabilities of the proposed methodology in propagating uncertainty through non-linear partial differential equations. In contrast to previous approaches to inferring solutions of partial differential equations from data [44,45,46,47], the proposed methodology does not rely on Gaussian assumptions, and it can directly tackle nonlinear problems without any need for linearization.

Burgers equation
In this example we aim to provide a comprehensive systematic study to quantify the robustness of the proposed methods with respect to different parameter choices. We will do so through the lens of a more challenging canonical problem involving the non-linear time-dependent Burgers equation in one spatial dimension: where the viscosity parameter is chosen as ν = (0.01/π) in order to generate a strongly nonlinear response that leads to the development of shock discontinuities in finite time. This is one of the few nonlinear partial differential equations that admits an exact solution through the Cole-Hopf transformation [48]; a solution that will be subsequently used to test the validity of our predictions.
Here we represent the unknown solution u(x, t) using a physics-informed generative model of the form u = f θ (x, t, z), and we will introduce parametric functions corresponding to a generator f θ (x, t, z), an encoder q φ (x, t, u), and a discriminator T ψ (x, t, u) all constructed using deep feed-forward neural networks. The baseline architectures for the generator and the encoder have 4 hidden layers with 50 neurons per layers, while the discriminator network has 3 hidden layers and 50 neurons per layer. The activation function in all cases is chosen to be a hyperbolic tangent non-linearity. The prior over the latent variables p(z) is chosen again to be a one-dimensional isotropic Gaussian distribution, i.e. z = z, z ∼ N (0, 1).
First we consider a baseline scenario, in which we train our probabilistic model using a data-set comprising of N u = 150 noisy-free input/output pairs for u(x, t) -50 points for the initial condition (see figure 3(a)) and 50 points for each of the domain boundaries -plus an additional N r = 10, 000 collocation points for enforcing the residual of the Burgers equation using the loss of equation 14. All data points were randomly selected within the bounds given in equation 20. The result of this experiment is summarized in 4 where we report the predicted mean solution, as well as the uncertainty associated with this prediction as quantified by two standard deviations of the generative model p θ (u|x, t, z). As the training data for this case is noise-free, the solution to this problem is deterministic, and the resulting uncertainty captured in p θ (u|x, t, z) can be viewed as an a-posteriori error estimate of the neural network approximation error due to the finite number of training data, which is measured as E L 2 = 4.1 · 10 −2 in the relative L 2 norm. As discussed in [49], a higher approximation accuracy can be achieved by training the generative model using a quasi-Newton optimizer (e.g. L-BFGS [50]), however here we chose to use stochastic gradient descent using Adam updates [43] in order to highlight the ability of the proposed method to return uncertainty estimates when the model predictions are not perfectly accurate.
Second, we repeat the same test for a more complicated scenario in which the initial condition has been corrupted by non-additive, non-Gaussian noise as shown in figure 3(b), where the noise variance is larger around x = 0, therefore amplifying the effect of uncertainty on the shock formation. Here the neural network architecture as well as the number and location of training points have been kept fixed as described above, but the initial condition is now corrupted as u(x, 0) = − sin(π(x + 2δ)) + δ, δ = exp(3|x|) , ∼ N (0, 0.1 2 ). (21) The results of this experiment are summarized in figure 5. We observe that the resulting generative model p θ (u|x, t, z) can effectively capture the uncertainty in the resulting spatio-temporal solution due to the propagation of the input noise process through the complex non-linear dynamics of the Burgers equation. As expected, the uncertainty concentrates around the shock. Although we only plot the first two moments of the solution, we must emphasize that the generative model p θ (u|x, t, z) provides a complete probabilistic characterization of its non-Gaussian statistics. In order to further investigate the performance of the proposed methodology for different parameter settings, we have performed a series of comprehensive systematic studies that aim to quantify the sensitivity of the resulting predictions on: (i) the neural network initialization, (ii) the total number of training and collocation points, (iii) the neural network architecture, and (iv) the adversarial training procedure. The results of these systematic studies are provided in Appendix A.

Discovery of constitutive laws for flow through porous media
In our final example, we aim to demonstrate the ability of the proposed methods to discover unknown constitutive relationships directly from data with quantified uncertainty. To this end, we revisit the Darcy flow example put forth in [51] corresponding to a two-dimensional nonlinear diffusion equation with an unknown state-dependent diffusion coefficient where q = 8.25 × 10 −5 m/s and u 0 = −10m are known boundary conditions. In order to benchmark and validate our model predictions we consider a realistic data-set generated using the Subsurface Transport Over Multiple Phases (STOMP) code [52] with the van Genuchten model [53] for K(u) which reads as K(s(u)) = K s s with the following parameter values: K s = 8.25 × 10 −4 m/s, u g = 0, m = 0.469, α = 0.1, L 1 = 10 m and L 2 = 10 m. Our goal is twofold: we aim to construct a physics-informed probabilistic model for p θ (u|x, z), and simultaneously learn the unknown state-dependent diffusion coefficient K(u) directly from data on u(x) (i.e., we assume no measurements of K(u)). To this end, in addition to the three deterministic mappings f θ (x, z), q φ (x, u), and T ψ (x, u) corresponding to the generator, encoder, and discriminator described in section 2.3, here we also introduce another neural network f γ (u) for approximating K(u). The parameters of f γ (u) are essentially inherited by the physics-informed residual network z))∇ x f θ (x, z))] that aims to enforce the residual of equation 22 at the N r collocation points for any set of latent variables z. All neural networks are chosen to have 2 hidden layers with 50 neurons per each, and a hyperbolic tangent activation function, while the probabilistic model for p θ (u|x, z) assumes a two dimensional latent space with an isotropic Gaussian prior, i.e., z ∼ N (0, I).
By construction, our probabilistic model for p θ (u|x, z) can return predictions of the unknown solution u(x) with quantified uncertainty. We can then use this model to propagate uncertainty in our predictions of K(u) via Monte Carlo sampling. Specifically, once the model is trained end-to-end, we can easily generate samples of u(x) from p θ (u|x, z) and propagate them through f γ (u) to obtain a samples for K(u). Essentially this results in an implicit generative model p θ,γ (k|x, z) which can fully characterize uncertainty in our predictions of the unknown state-dependent diffusion coefficient.
Here we also have considered two cases corresponding to noise-free training data and noisy data corrupted by 5% Gaussian uncorrelated noise. In the noise-free case we used N u = 600 scattered measurements of the unknown solution u(x) -200 inside the domain Ω and 100 on each one of the four boundaries -and total number of N r = 10, 000 randomly selected collocation points inside the domain for penalizing the residual of equation 22. For the noisy case we chose N u = 1, 400 scattered measurements of the unknown solution u(x) -1,000 inside the domain Ω and 100 on each one of the four boundaries -while still keeping N r = 10, 000 collocation points. Figure 6 summarizes the results for both cases by showing the predictive mean and two standard deviations of the corresponding generative model p θ,γ (k|x, z), against the reference (deterministic) solution obtained from the Subsurface Transport Over Multiple Phases (STOMP) code [52] with the van Genuchten model [53] (see equation 23). Evidently, the generative model is able to recover a sensible prediction for the unknown state-dependent diffusion coefficient with quantitative uncertainty, even when the training data on u(x) is heavily corrupted by noise. Moreover, notice that k(u) implicitly depends on the spatial coordinates x = (x 1 , x 2 ). In figure 7 we present the resulting prediction for K(u(x 1 , x 2 )) corresponding to the noise-free case, against the reference solution, as well as their point-wise absolute error.
Again we must emphasize that these predictions are obtained without ever observing any data on K(u), while they are accompanied by quantitative estimates that jointly characterize the uncertainty due to noise in the training data for u(x), and the underlying approximation error of the neural networks. This theme of consistently inferring correlated continuous quantities of interest from a small set of measurements by leveraging the underlying laws of physics is a great example of the exciting capabilities that physics informed machine learning has to offer.  Figure 6: Prediction with quantified uncertainty of unknown state-dependent diffusion coefficient K(u) compared against the reference solution obtained from the Subsurface Transport Over Multiple Phases (STOMP) code [52] with the van Genuchten model [53] (see equation 23). (a) Noise-free training data for u(x). (b) Noisy training data for u(x) with noise level of 5%.

Conclusions
We presented a class of probabilistic physics-informed neural networks that are capable of approximating arbitrary conditional probability densities, while being constrained to generate samples that approximately satisfy given partial differential equations. Moreover, we have derived a flexible regularized adversarial inference framework that enables the end-to-end training of such models directly from noisy and incomplete measurements. Uncertainty in the system inputs and/or outputs is captured through a set of latent variables that are relevant to the underlying physics, and could possibly open new directions for probabilistic model-order reduction of complex systems. These developments allow us to perform probabilistic computations for uncertain systems, train deep generative models in small data regimes, handle complex noise processes, and seamlessly carry out uncertainty propagation studies for physical systems without the need for repeated evaluation of experiments and numerical simulations.
Although the proposed adversarial inference framework provides great flexibility for performing probabilistic computations and approximating arbitrarily complex and high-dimensional probability distributions, it relies on carefully tuning the interplay between the generator and discriminator networks. This is a known limitation of adversarial algorithms, and, although several works have led to improvements [54,55], it still largely remains an open research problem. An alternative path for enhancing the robustness of the inference procedure, while not compromising its ability to handle complex probability distributions, comes through the use of invertible transformations and flow-based generative models [56,57]. Future work will examine the applications of such models in the context of physics-informed neural networks with the goal of robustifying the proposed methods and scaling them to more realistic systems.
Relative L 2 error 4.1e-02 7.9e-02 4.4e-02 4.0e-02 3.8e-02 3.2e-02 5.7e-02 4.7e-02 6.5e-02 4.0e-02 3.5e-02 3.5e-02 6.4e-02 4.0e-02 4.9e-02 Appendix A.2. Sensitivity with respect to the total number of training and collocation points In this study our goal is to quantify the sensitivity of our predictions with respect to the total number of training and collocation points N u and N r , respectively. As before, we have considered noise-free data sets, and fixed the architecture for generator neural networks to include 4 hidden layers with 50 neurons each and discriminator neural networks to include 3 hidden layers with 50 neurons each, a hyperbolic tangent activation function, and a normal Xavier initialization [58] for all network weights and zero initialization for all network biases. The results of this study are summarized in table A.2, indicating that as the number of collocation points are increased, a more accurate prediction is obtained. This observation is in agreement with the original results of Raissi et. al. [6,7] for deterministic physics-informed neural networks, indicating the role of the residual loss as an effective regularization mechanism for training deep generative models in small data regimes. Appendix A.3. Sensitivity with respect to the neural network architecture In this study we aim to quantify the sensitivity of our predictions with respect to the architecture of the neural networks that parametrize the generator, the discriminator, and the encoder. Here we have fixed the number of noise-free training data to N u = 150 and N r = 10000, and we kept the number of layers for discriminator to always be one less than the number of layers for generator (e.g., if the number of layers for generator is two then the number of layers for discriminator is one, etc.). In all cases, we have used a hyperbolic tangent non-linearity and a normal Xavier initialization [58]. In table A.3 we report the relative L 2 prediction error for different feed-forward architectures for the generator, discriminator, and encoder (i.e., different number of layers and number of nodes in each layer). The general trend suggests that as the neural network capacity is increased we obtain more N g N n 20 50 100 2 4.2e-01 3.8e-01 5.7e-01 3 6.5e-02 3.5e-02 2.1e-02 4 9.3e-02 4.7e-02 5.4e-02 Table A.3: Relative L 2 prediction error for different feed-forward architectures for the generator, encoder, and the discriminator. The total number of layers of the latter was always chosen to be one less than the number of layers for generator.  accurate predictions, indicating that our physics-informed constraint on the PDE residual can effectively regularize the training process and safe-guard against over-fitting. We note number of neurons in each layer as N n and number of layers for generator (encoder) as N g .
Appendix A.4. Sensitivity with respect to the adversarial training procedure Finally, we test the sensitivity with respect to the adversarial training process. To this end, we have fixed the number of noise-free training data to N u = 150 and N r = 10000, and the neural network architecture to be the same as Appendix A.2, and we vary the total number of training steps for the generator K g and the discriminator K d within each stochastic gradient descent iteration. The results of this study are presented in table A.4 where we report the relative L 2 prediction error. These results reveal the high sensitivity of the training dynamics on the interplay between the generator and discriminator networks, and pinpoint on the well known peculiarity of adversarial inference procedures which require a careful tuning of K g and K d for achieving stable performance in practice.