Variational Physics Informed Neural Networks: the role of quadratures and test functions
Abstract
In this work we analyze how quadrature rules of different precisions and piecewise polynomial test functions of different degrees affect the convergence rate of Variational Physics Informed Neural Networks (VPINN) with respect to mesh refinement, while solving elliptic boundary-value problems. Using a Petrov-Galerkin framework relying on an inf-sup condition, we derive an a priori error estimate in the energy norm between the exact solution and a suitable high-order piecewise interpolant of a computed neural network. Numerical experiments confirm the theoretical predictions and highlight the importance of the inf-sup condition. Our results suggest, somehow counterintuitively, that for smooth solutions the best strategy to achieve a high decay rate of the error consists in choosing test functions of the lowest polynomial degree, while using quadrature formulas of suitably high precision.
KeywordsโVariational Physics Informed Neural Networks, quadrature formulas, inf-sup condition, a priori error estimate, convergence rates, elliptic problems
MSC-class 35B45, 35J20, 35Q93, 65K10, 65N20, 68T07
1 Introduction
Exploiting the recent advances in artificial intelligence and, in particular, in deep learning, several innovative numerical techniques have been developed in the last few years to compute numerical solutions of partial differential equations (PDEs). In such methods, the solution is approximated by a neural network that is trained by taking advantage of the knowledge of the underlying differential equation. One of the earliest models involving a neural network was described in [25]: it is based on the concept of Physics Informed Neural Networks (PINN) and it inspired further works such as e.g. [31] or [34], until the recent paper [19] which presents a very general framework for the solution of operator equations by deep neural networks.
In such papers, given an arbitrary PDE coupled with proper boundary conditions, the training of the PINN aims at finding the weights of a neural network such that the associated function minimizes some functional of the equation residual while satisfying as much as possible the imposed boundary conditions. To do so, the neural network is trained to minimize the residual only at a finite set of collocation points and additional terms are added to the loss function in order to force the network to approximately satisfy the boundary conditions. Thanks to the good approximation properties of neural networks, formally proved e.g. in [8], [11], [23], [18], [24] and [10] under suitable assumptions, the PINN approach looks very promising because it is able to efficiently and accurately compute approximate solutions of arbitrary PDEs encoding their structures in the loss function.
Subsequently, the PINN paradigm has been further developed in [14] to obtain the so-called Variational Physics Informed Neural Networks (VPINN). The main differences with respect to the PINN are that the weak formulation of the PDE is exploited, the collocation points are replaced by test functions, and quadrature points are used to compute the integrals involved in the variational residuals. In such a method the solution is still approximated by a neural network, but the test functions are represented by a finite set of known functions or by a second neural network (see [35]); therefore, the technique can be seen as a Petrov-Galerkin method. The method is more flexible than the standard PINN because the integration by parts, involved in the weak formulation, decreases the required regularity of the approximate solution. Furthermore, the fact that the dataset used in the training phase consists of quadrature points significantly reduces the computational cost of the training phase. Indeed, quadrature points are, in general, much fewer than collocation points.
Combining the VPINN with the Finite Element Method (FEM), the authors of [16] developed VarNet, a VPINN that exploits the test functions of the -FEM. Such a work has been then extended in [15] to consider arbitrary high-order polynomials as test functions, as in the version of the FEM. Although the authors of the cited works empirically observed that both PINNs and VPINNs are able to efficiently approximate the desired solution, no proof of a priori error estimates with convergence rates is provided for VPINNs. On the contrary, rigorous a posteriori error analyses are already available (see, for instance, [20]). Recently (see [3]) we derived a posteriori error estimates for the discretization setting considered in this paper.
The purpose of this paper is to investigate how the choice of piecewise polynomial test functions and quadrature formulas influence the accuracy of the resulting VPINN approximation of second-order elliptic problems. One might think that test functions of high polynomial degree are needed to get a high order of accuracy; we prove that this is not the case, actually we indicate that precisely the opposite is true: it is more convenient to keep the degree of the test functions as low as possible, while using quadrature formulas of precision as high as possible. Indeed, for sufficiently smooth solutions, the error decay rate is given by
where is the precision of the quadrature formula and is the degree of the test functions.
Using a Petrov-Galerkin framework, we derive an a priori error estimate in the energy norm between the exact solution and a suitable piecewise polynomial interpolant of the computed neural network; we assume that the architecture of the neural network is fixed and sufficiently rich, and we explore the behaviour of the error versus the size of the mesh supporting the test functions. Our analysis relies upon the validity of an inf-sup condition between the spaces of test functions and the space in which the neural network is interpolated.
Numerical experiments confirm the theoretical prediction. Interestingly, in our experiments the error between the exact solution and the computed neural network decays asymptotically with the same rate as predicted by our theory for the interpolant of the network; however, this behaviour cannot be rigorously guaranteed, since in general the minimization problem which defines the computed neural network is underdetermined, and the computed neural network may be affected by spurious components. Indeed, we show that for a problem with zero data the minimization of the loss function may yield non-vanishing neural networks. With the method proposed in this paper, we combine the efficiency of the VPINN approach with the availability of a sound and certified convergence analysis.
The paper is organized as follows. In Sect. 2 we introduce the elliptic problem we are focusing on, and we also present the way in which the Dirichlet boundary conditions are exactly imposed, which is uncommon in PINNs and VPINNs but can be generalized as in [30]. In Sect. 3 we focus on the numerical discretization; in particular, the involved neural network architecture is described in Sect. 3.1, while the problem discretization and the corresponding loss function are described in Sect. 3.2. Here we also introduce an interpolation operator applied to the neural networks. Sect. 4 is the key theoretical section: through a series of preliminary results, we formally derive the a priori error estimate, the main result being Theorem 4.9. In Sect. 5 we specify the parameters of the neural network used for the numerical tests and the training phase details. We also analyse the consequences of fulfilling the inf-sup condition in connection with the VPINN efficiency. Various numerical tests are presented and discussed in Sect. 6 for two-dimensional elliptic problems. Such tests empirically confirm the validity of the a priori estimate in different scenarios. Furthermore, we compare the accuracy of the proposed method with that of a standard PINN and the non-interpolated VPINN. We also analyse the relationship between the neural network hyperparameters and the VPINN accuracy, and we highlight, with numerical experiments and analytical examples, the importance of the inf-sup condition. In Sect. 7, we show that our VPINN can be easily adapted to solve a parametric nonlinear PDE, with accurate results for the whole range of parameters. Finally, in Sect. 8, we draw some conclusions and highlight the future perspective of the current work.
2 The model boundary-value problem
Let be a bounded polygonal/polyhedral domain with boundary , partitioned into with and .
Let us consider the model elliptic boundary-value problem
(2.1) |
where , satisfy , in for some constant , whereas , for some , and .
Define the spaces , , the bilinear form and the linear form such that
(2.2) |
denote by the coercivity constant of the form , and by , the continuity constants of the forms and . Problem (2.1) is formulated variationally as follows: Find such that
(2.3) |
We assume that we can represent in the form
(2.4) |
for some (known) smooth function and some having the same smoothness of . Let us introduce the affine mapping
(2.5) |
which enforces the given Dirichlet boundary condition. Then, Problem (2.3) can be equivalently formulated as follows: Find such that
(2.6) |
Remark 2.1 (Enforcement of the Dirichlet conditions).
The approach we follow to enforce Dirichlet boundary conditions will allow us to deal with a loss function which is built solely by the residuals of the variational equations. Other approaches are obviously possible: for instance, one could augment such loss function by a term penalizing the distance of the numerical solution from the data on , or adopt a Nitscheโs type variational formulation of the boundary-value problem [22]. Both strategies involve parameters which may need a tuning, whereas in our approach the definition of the loss function is simple and natural, allowing us to focus on the performances of the neural networks.
3 The VPINN-based numerical discretization
In this section, we first introduce the class of neural networks used in this paper, then we describe the numerical discretization of the boundary-value problem (2.6), which uses neural networks to represent the discrete solution and piecewise polynomial functions to enforce the variational equations. An inf-sup stable Petrov-Galerkin formulation is introduced which guarantees stability and convergence, as indicated in Sect. 4; this is the main difference between the proposed method and other formulations, such as [14, 15].
3.1 Neural networks
In this work we only use fully-connected feed-forward neural networks (named also multi-layered perceptrons), therefore the following description is focused on such a class of networks. Since we deal with a scalar equation, a neural network will be a function defined as follows: for any , the output is computed via the chain of assignments
(3.1) | ||||
Here, and , , are matrices and vectors that store the network weights (with and ); furthermore, is the number of layers, whereas is the (nonlinear) activation function which acts component-wise (i.e. for any vector ). It can be noted from equation (3.1), that if , then inherits the same regularity because it can be seen as a composition of functions belonging to . Popular choices include the ReLU () and RePU ( finite) functions, as well as the hyperbolic tangent () if one wants to exploit the maximum of regularity in the solution of interest.
The neural network structure is identified by fixing the number of layers , the integers and the activation function . The entire set of weights that parametrize the network can be logically organized into a single vector . Thus, the neural network structure induces a mapping
(3.2) |
It is convenient to define the manifold
containing all functions that can be generated by the neural network structure .
3.2 The VPINN discretization
We aim at approximating the solution of Problem (2.1) by a generalized Petrov-Galerkin strategy. To this end, let us introduce a conforming, shape-regular triangulation of with meshsize and, for a fixed integer , let be the linear subspace formed by the functions which are piecewise polynomials of degree over the triangulation . Furthermore, let us introduce computable approximations of the forms and by numerical quadratures. Precisely, for any , let be the nodes and weights of a quadrature formula of precision
(3.3) |
on . Assume that is the union of a collection of edges of elements of ; for any such edge , let be the nodes and weights of a quadrature formula of precision on . Then, assuming that all the data , , , , are continuous in each element of the triangulation, we define the approximate forms
(3.4) |
(3.5) |
With these ingredients at hand, we would like to approximate the solution of Problem (2.6) by some satisfying
(3.6) |
Such a problem might be ill-posed when, for computational efficiency, the dimension of the test space is chosen smaller than the dimension of the manifold . In this situation, we get an under-determined problem, with obvious difficulties in deriving stability estimates on some norms of the function . Actually, Problem (3.6) with zero data (i.e., zero , , ) could admit non-zero solutions (see Section 6.3).
To avoid these difficulties, we adopt the strategy of applying a projection (indeed, an interpolation) to the function , mapping it into a finite dimensional space of dimension comparable to that of , and we limit ourselves with estimating some norm of this projection.
To be precise, let us introduce a conforming, shape-regular partition of , which is equal to or coarser than (i.e., each element is contained in an element ) but compatible with (i.e., its meshsize satisfies ). Let the integer be defined by the condition
(3.7) |
Let be the linear subspace formed by the functions which are piecewise polynomials of degree over the triangulation , and let be the subspace of formed by the functions vanishing on . Finally, let be an interpolation operator, satisfying the condition as well as the following approximation properties: for all , ,
(3.8) |
In this framework, assuming the lifting to be continuous in , we replace the target equations (3.6) by the following ones:
(3.9) |
In order to handle this problem with the neural network, let us introduce a basis in , say , and for any smooth enough let us define the residuals
(3.10) |
as well as the loss function
(3.11) |
where are suitable weights. Then, we search for a global minimum of the loss function in , i.e., we consider the following discretization of Problem (2.6): Find such that
(3.12) |
Note that the solution may not be unique; however, a suitable choice of the space may lead to the control of the error in the -norm, as we will see in the sequel.
Remark 3.1 (Discretization without interpolation).
For the sake of comparison, we will also consider the optimization problem in which no interpolation is applied to the neural network functions. In other words, the target equations are those in (3.6), which induce the following definition of loss function
(3.13) |
and the following minimization problem: Find such that
(3.14) |
Note that in this problem the triangulation and the space play no role. Although we will not provide a rigorous error analysis for such discretization, it will be interesting to numerically compare the behaviour of the approaches (i.e., with or without interpolation). This will be done in Section 6.
4 A priori error estimates
Let be any solution of the minimization problem (3.12); let us set
(4.1) |
Recalling the definition (2.4) of the affine mapping , it holds
(4.2) |
note that is a discrete lifting in of the Dirichlet data .
We aim at estimating the error between and . To accomplish this task, we need several definitions, assumptions, and technical results.
Definition 4.1 (norm-equivalence).
Let us denote by the constants in the norm equivalence
(4.3) |
where is such that , and .
Next, we introduce the consistency errors due to numerical quadratures
(4.4) |
(4.5) |
and we provide a bound on these errors. To this end, let us assume that the quadrature rules used in the elements in are obtained by affine transformations from a quadrature rule on a reference element ; similarly, let us assume that the quadrature rules used in the edges on are obtained by affine transformations from a quadrature rule on a reference element .
Assumption 4.2 (Data smoothness).
Let us assume the following smoothness of data:
(4.6) |
where is an integer satisfying
(4.7) |
Consequently, let us introduce the following notation
(4.8) | |||||
(4.9) | |||||
(4.10) |
Property 4.3 (approximation of the forms and ).
Proof.
Both estimates are classical in the theory of finite elements (see, e.g., [6]). As far as (4.11) is concerned, the standard proof given for the case in which the polynomial degree is the same for both arguments, i.e., and , can be easily adapted to the present situation . In this way, one gets , and one concludes by observing that since is a refinement of . โ
Finally, we pose a fundamental assumption.
Assumption 4.4 (inf-sup condition between and ).
The bilinear form satisfies an inf-sup condition with respect to the spaces and , namely there exists a constant , independent of the meshsizes and , such that
(4.13) |
This assumption together with Property 4.3 yields the following result.
Proposition 4.5 (discrete inf-sup condition between and ).
Proof.
We have . Using the bound (4.11) with and observing that , one can find small enough such that, for all , , whence the result with โ
We are ready to estimate the error . Recalling the decomposition (4.2), we use the triangle inequality
(4.15) |
where is a suitable element in the affine subspace . Writing with , one has ; hence, we can apply (4.14) to get
(4.16) |
Recalling the definitions (4.4) and (4.5), it holds
Thus, the numerator in (4.16) is given by
On the other hand, recalling (3.10) we have
(4.17) |
Using the bounds (4.11) and (4.12), we obtain the following inequality
(4.18) |
From now on, we assume that . Then, assumption (3.8) yields the inequalities
(4.19) |
and
(4.20) |
Choosing in (4.18) and using these estimates, we arrive at the following intermediate result, which can be viewed as a mixed a priori/a posteriori error estimate.
Lemma 4.6.
Under the previous assumptions, it holds
Our next task will be bounding the term . To this end, we use the minimality condition (3.12) to get
(4.21) |
On the other hand, since is a weighted -norm in , we can write
where, similarly to (4.17),
For convenience, in analogy with (4.1), let us set
(4.22) |
Thus, recalling (4.3), we obtain
(4.23) |
The numerator can be manipulated as above, using
and
whence, using once more Property 4.3, we get
(4.24) |
In order to bound the terms containing , we introduce the quantity
(4.25) |
which, recalling the definitions (2.4) and (2.5), can be written as
(4.26) |
and we formulate a final assumption.
Assumption 4.7 (smoothness of the solution and the neural network manifold).
Note that (4.27) implies in particular with ; on the other hand, (4.28) implies . (We refer to Remark 4.11 for another set of assumptions on the neural network.)
Recalling (4.22) and using the identity
(4.29) |
we can write
(4.30) |
and, using a standard inverse inequality in for any ,
(4.31) |
Keeping into account (4.19) and (4.20), in order to conclude we need to identify a function for which a bound of the type
(4.32) |
holds true for . The existence of such a function is guaranteed by one of the available results on the approximation of functions in Sobolev spaces by neural networks (see [7, Theorem 5.1, Remark 5.2]; see also [24]), provided the number of layers and the widths of the layers in the chosen satisfy suitable conditions depending on the target accuracy (hence, in our case depending on ). Indeed, suppose one is interested in using meshes with meshsize as small as in the domain (here assumed to satisfy for the sake of simplicity), and let be such that
(4.33) |
where , , and are constants not depending on defined in [7]. Then, a function exists which fulfils (4.32) and is represented as a neural network with the hyperbolic tangent as activation function and two hidden layers with and neurons respectively, satisfying
(4.34) |
where
Substituting (4.32) into (4.30) and (4.31), and using inequalities (4.21) and (4.24), we arrive at the following bound on the loss .
Lemma 4.8.
Under the previous assumptions, it holds
We remark that such a bound, when the involved neural network is comprised of at least two hidden layers and is such that there exists satisfying both (4.33) and (4.34), does not depend on the network hyperparameters.
Concatenating Lemmas 4.6 and 4.8, and using once more , we obtain the following a priori error estimate for the solution of Problem (3.12).
Theorem 4.9 (a priori error estimate).
Remark 4.10 (on the equivalence constants ).
If a classical Lagrange basis is used in (3.10), and the triangulation is quasi-uniform, then for constants weights one has and , whence . On the other hand, if a hierarchical basis is used instead, then , hence, in dimension , whereas , , hence, in dimension .
Thus, the presence of the ratio in (4.35), which originates from the control of the loss function, makes this estimate sub-optimal. However, our numerical experiments in Sect. 6.1 indicate that this adverse effect is not seen in practice. The reason may be related to the decay of the loss function , which is significantly faster than the decay of the approximation error when is reduced, thereby compensating for the growth of ratio. See Remark 6.1. โโ
Remark 4.11 (low-regularity ).
When the condition fails to be satisfied, as for the ReLU activation function, we may provide a different set of assumptions which still lead to an -error estimate as in Theorem 4.9. Precisely, we may assume that and . Then, referring to the first equality in (4.29), one has
with
The conclusion easily follows if is chosen to satisfy the error bound โ, which is possible according to the results in [11], [23]. โ
5 Implementation issues
As specified in Section 3.1, we use a fully-connected feed-forward neural network architecture, which is fixed and depends neither on the PDE nor on its discretization. For each simulation, we initialize the neural network with a completely new set of weights, which is important to show that our results are not initialization dependent. The activation function is the hyperbolic tangent. It has been proven in [7] that such neural networks with two hidden layers enjoy exponential converge properties with respect to the number of weights. Nevertheless, in order to simplify the training and enrich the space in which we seek the numerical solution, we consider five layers (namely, with the notation of Section 3.1) with 50 neurons each ( ). We also highlight that it is always possible to approximate the identity function with a neural network with a single layer with just one neuron. The best approximation obtainable with a neural network with more than two layers is thus more accurate than the one computable with a neural network with just two layers, because, in the worst possible case, the -layers neural network can be obtained by combining an -layers identity neural network with a suitable 2-layers neural network. Numerical tests have been performed to investigate the influence of the activation function on the model accuracy; we observed that all the commonly used activation functions led to equivalent results, thus we omit such a comparison from the present work. We remark that the hyperparameters and have been chosen to obtain a neural network sufficiently large to satisfy condition (4.32) on all grids used in our experiments. Numerical evidence that the neural network best approximation error is negligible when compared with other sources of error is presented in Sect. 6.2.
In order to compute the results shown in Section 6, we compared various state of the art optimizers to find the most efficient way to minimize the loss function. We observe that most of the momentum-based first-order methods have similar performances (the presented results are computed with the ADAM optimizer [17]), but it is convenient to use a learning rate scheduler in order to reduce the learning rate during the process. We tested both cyclical learning rate schedulers and exponential learning rate schedulers [29], the differences were very subtle and we thus choose to adopt the most common exponential learning rate scheduler and decided not to report images about such a comparison. To further reduce the loss function we also use the BFGS method and its limited-memory version: the L-BFGS method [33].
The Dirichlet boundary conditions are imposed via the mapping defined in (2.5). The construction of the function is particularly simple when is a convex polygon, since in this case can be defined as the product of the linear polynomials which vanish on each Dirichlet edge; this is precisely how we define in the numerical examples discussed in the next session. In other geometries, one can build either as described in [30], or by using a level-set method, or even by training an auxiliary neural network to (approximately) vanish on . Similarly, in order to obtain an analytical expression of the extension of the Dirichlet data , one can train another neural network to (approximately) match the values of on or use a data transfinite interpolation [27].
5.1 VPINN efficiency and the inf-sup condition
In Sect. 3 we introduced a discretization method in which the loss function is built by a piecewise polynomial interpolation of the neural network; on the other hand, we also mentioned in Remark 3.1 the possibility of building the loss function directly from the (non-interpolated) neural network.
From the theoretical point of view, only the former approach can be considered mathematically reliable, since the error control is based on the validity of an inf-sup condition, as detailed in Sect. 4. On the contrary, if the neural network is used without interpolation, one usually gets an under-determined system, for which the error control may be problematic. In fact, for instance, the discrete solution with zero data may not be identically zero, as documented in Sect. 6.3, which rules out uniqueness. Nonetheless, there is empirical evidence (see, e.g., [36, 28, 13, 32]) that non-interpolated neural networks do succeed in computing accurate solutions even in complex scenarios. Actually, in the next section we will provide numerical evidence that the two approaches are always (in the considered cases) comparable in terms of rate of convergence and, when the solution is regular, smaller errors are obtained minimizing the same loss function without interpolation.
From the computational point of view, the two approaches have comparable advantages and disadvantages. Let us first consider non-interpolated VPINNs. The corresponding loss functions can be more easily implemented thanks to the existing deep-learning frameworks, which allow the direct computation of neural network derivatives via automatic differentiation [1]. One only needs to generate a mesh and the corresponding test functions, associate a quadrature rule with each element and assemble all the tensors required to efficiently compute the loss function. The main difference with the interpolated neural network approach is that, in the latter, the interpolation matrices have to be assembled too (see Appendix A.1 for a detailed description of the construction of the interpolation operators), while automatic differentiation is not required. Depending on the problem at hand, this may be an advantage or not. Indeed, the interpolation matrices assembly may be tricky but, using them, all derivatives can be efficiently computed by matrix-vector multiplications that are much cheaper than the entire automatic differentiation procedure, especially when higher order derivatives are required. Therefore, for fast-converging optimization processes, a non-interpolated neural network approach may be efficient and can be more easily implemented; otherwise, each optimization step may be much more expensive than the analogous operation performed with an interpolated neural network. Furthermore, we observed that the training phase is faster when the neural network is interpolated because the procedure converges in fewer steps. This is probably related to the fact that the solution is sought in a significantly smaller space, that can be more easily explored during the training phase.
6 Numerical results
In this section we present several numerical results concerning the VPINN discretization of Problem (2.1) in the square . We will vary the coefficients of the operator, the boundary conditions and the smoothness of the exact solution. For each test case, we vary the degree of the test functions, the order of the quadrature rule and, correspondingly, we choose the polynomial degree of the interpolating functions as , according to (4.7). We only report results obtained with Gaussian rules, as Newton-Cotes formulas of the same order give comparable errors (see [2] for a larger set of numerical experiments about this and other comparisons).
The theoretical results in Sect. 4 suggest that it is convenient to maintain as low as possible; consequently, we only use piecewise linear () or piecewise quadratic () test functions. Recalling condition (3.3), we thus choose or if , and if .
The triangulations we use are generic Delaunay triangular meshes. In order to satisfy the discrete inf-sup condition, we choose and as nested meshes whose meshsizes satisfy . A pair of used meshes is represented in Fig. 1, together with the elemental refinement corresponding to , and .




6.1 Error decays
Hereafter, we empirically confirm, with numerical experiments, the a priori error estimate established in Sect. 4. We also compare the behavior of the proposed NN with that of other NNs defined by different strategies. In the following, we denote the interpolated VPINN as IVPINN to distinguish it from the non-interpolated VPINN [15], simply denoted as VPINN, and the standard PINN [25].
In the subsequent plots, we report by blue dots the error , where is the interpolated VPINN defined on the mesh as in (4.1), versus the size of the mesh . We also show a blue solid line and a blue dashed one: the former is the regression line fitting the blue dots (possibly ignoring the first ones); its slope in the log-log plane yields the empirical convergence rate. The latter is used as a reference, since its slope corresponds to an error decay proportional to , which is the expected convergence rate of the error as indicated by Theorem 4.9, assuming that the ratio may be neglected (see Remark 6.1). The dashed line represents the best convergence rate we can expect from the proposed discretization scheme.
For comparison, we also report by green dots the error , where is the non-interpolated VPINN defined in Remark 3.1, and by red dots the error , where is the standard PINN proposed in [25], with the same architecture of the used VPINNs and the loss function computed as described in [21]. To obtain a fair comparison, the regularization coefficient and the ratio between the control points inside the domain and the ones on the boundary are chosen as described in [21]. Since we are interested in convergence rates with respect to mesh refinement, but the PINN does not require any mesh, the corresponding errors are computed by training the network with the same numbers of inputs used during the training of ; to be precise, the PINN is trained using the same number of collocation points as the number of interpolation nodes used by the interpolated VPINN.
Furthermore, in order to better analyze the trade-off between the model accuracy and the training efficiency and complexity, we plot the same errors versus the dataset size. Whenever these dots, possibly after a pre-asymptotic phase, sit close to their regression line, we draw it as well in green or red, respectively.
Convergence test #1:
Consider problem (2.1) with and . Let us choose the following operator coefficients
and the data , , and such that the exact solution is
The corresponding error decays with respect to the meshsize are shown in Fig. 2.

Expected decay rate: 4.
Obtained decay rate: 4.15.

Expected decay rate: 6.
Obtained decay rate: 6.19.

Expected decay rate: 5.
Obtained decay rate: 5.05.
In subfigure 22.a, where the IVPINN (blue dots) and the VPINN (green dots) are trained with and , we observe that the points are distributed, possibly after an initial preasymptotic phase, along straight lines with slopes very close to . We highlight that the PINN convergence is significantly noisier and that the corresponding error is, on average, about 7 times the IVPINN one. A similar phenomenon can be seen in subfigure 22.b, although the finite precision of the used Tensorflow software prevents convergence to display at full for small values of . In this test we use and and the regression lines for the IVPINN and the VPINN have slopes close to , while the PINN accuracy is again much lower. Finally, the data in subfigure 22.c are obtained with and and the blue regression line slope is 5.05, almost coinciding with .
Such results highlight that, although the VPINN implementation is more complex than the PINN one, the former produces more accurate solutions than the latter, when the exact solution is regular.
In Fig. 3, the same error decays are expressed in terms of the number of training points, i.e., the number of neural network forward evaluations required to construct the loss function in a single epoch. Such an alternative visualization highlights that the performances of the IVPINN and the VPINN are very similar when trained with similar training sets. This is due to the fact that, since we stabilize the VPINN by projecting it on a space of continuous piecewise polynomials, we need fewer interpolation points (input data of the IVPINN) than quadrature points (input data of the VPINN) to evaluate the loss function.

Expected decay rate: -2.
Obtained decay rate: -1.91.

Expected decay rate: -3.
Obtained decay rate: -2.91.

Expected decay rate: -2.5.
Obtained decay rate: -2.19.
Remark 6.1 (on the quotient ).
Theorem 4.9 indicates that the best possible convergence rate, when the solution is regular enough, is . However, as discussed in Remark 4.10, the quotient is of order when test functions are picked from the Lagrange basis associated with a quasi-uniform triangulation and the weights are equal to 1. In this case, the term in (4.35) reduces the predicted convergence by exactly one order.
On the other hand, in Fig. 2, we have shown cases where the order of convergence is optimal. Such a behavior is related to the fact that the loss decays much faster than expected, in the considered cases, namely at least as . Therefore, when is small enough, the term in Lemma 4.6 can be neglected, and the predicted convergence rate is not affected by the presence of the quotient .
Convergence test #2:
Let us now focus on a less smooth solution, whose regularity is commonly found in domains with reentrant corners. The problem is characterized by , , , , whereas the forcing term and boundary conditions are such that the exact solution is, in polar coordinates,
Since for any , we expect a convergence rate close to ; indeed, and the rate of convergence is always limited by the solution regularity as expected. The error decays are shown in Fig. 4. Notice that the IVPINN is even more stable and accurate than the VPINN trained on the same mesh (i.e., with more input data). The PINN behaves better in this test case than in the previous one, but still the accuracy is worse than the one provided by our IVPINN.

Expected decay rate: 2/3.
Obtained decay rate: 0.75.

Expected decay rate: 2/3.
Obtained decay rate: 0.75.

Expected decay rate: 2/3.
Obtained decay rate: 0.74.
It is also interesting to analyze the behavior of the loss function and of the error during training as documented in Fig. 5, where the first 3000 epochs are performed with the ADAM optimizer, while the remaining ones with the BFGS optimizer. Such plots correspond to the loss function and the error associated with the dots marked by the black stars in Fig. 44.a. It can be noted that the IVPINN and the VPINN initially converge very fast with the ADAM optimizer; eventually, after the initial phase in which both the loss and the error decrease, the error reaches a constant value despite the loss function keeps diminishing. This implies that there exist other sources of error that prevail when the loss function decays. On the other hand, using a standard PINN, one observes that the convergence of the loss and the error is much slower than for the VPINNs, and the second-order optimizer is needed to converge to an accurate solution. The average epoch execution time is approximately 0.0599 seconds for the PINN, 0.0587 seconds for the VPINN, and 0.0479 seconds for the IVPINN. Such a gain is due to the fact that the model derivatives are computed via automatic differentiation in the non-interpolated models, while the gradient of the IVPINN can be computed by a simple matrix-vector multiplication. Note that the gain increases when higher derivatives are involved in the PDE.



Bottom row: error as a function of the elapsed time.
6.2 How the VPINN dimension affects accuracy
We now focus on the dependence of the error on the neural network dimension. For the sake of simplicity, we fix the problem discretization and vary only the number of layers and the number of neurons in each layer, assuming that each layer contains exactly the same number of neurons. The considered domain, parameters, forcing term and boundary conditions are the ones described in Convergence test #1. The VPINN is trained with piecewise linear test functions () and quadrature rules of order on the finest mesh used to produce Fig. 22.a and on the mesh associated with the blue dot close to the black star in the same figure.
We can observe, in Fig. 6, that the error is very high for small networks, but then it rapidly decreases while increasing the number of neurons in each layer, until a plateau is reached depending on the chosen problem discretization. Essentially, on both meshes, 3 layers with 10 neurons each suffice to achieve the lowest possible discretization error for the given loss function.
This analysis confirms that the error decays reported in Sect. 6.1 are all insensitive to the neural network hyper-parameters, as they have been obtained by a large neural network (5 layers with 50 neurons each). Such results validate the assumption made in Section 4 about the neural network, namely that its dimension โ provided it is sufficiently large โ does not influence the predicted convergence rate.


6.3 On the importance of the inf-sup condition
In this section we show that the inf-sup condition, assumed in Proposition 4.5 to derive the a priori error estimate, is crucial in order to avoid spurious modes in the numerical solution. To prove such a claim, let us consider the simplest one-dimensional Poissonโs problem with zero forcing term and zero Dirichlet boundary conditions:
(6.1) |
where and . For the sake of simplicity, we use piecewise linear test functions and quadrature rules of order . Note that since both and contain the exact solution , it is always possible to obtain a numerical solution that is identical to the exact one (up to numerical precision).
Let us denote by any discrete solution defined in Sect. 3.2, namely, either a solution obtained by interpolated VPINNs, or a solution obtained by non-interpolated VPINNs. These discrete solutions are represented in Fig. 7 in logarithmic scale to allow a direct comparison. In order to avoid numerical issues due to the logarithmic scale of the plot when gets close to 0, a truncation procedure is applied.


The functions produced by non-interpolated networks are represented in the left plot of Fig. 7. Each one is obtained by minimizing the loss function up to machine accuracy; despite this, when the mesh is fairly coarse the discrete solution is significantly different from the null solution. Indeed, the initial weights in the training process are non-zero, and the minimization process is under-determined, thereby allowing the existence of non-zero global minima. Refining the mesh, the approximation improves up to a maximum precision imposed by the chosen network architecture and the Tensorflow deep learning framework.
Conversely, the plots in the subfigure on the right-hand side of Fig. 7, produced by interpolated networks, clearly indicate that the obtained discrete solutions are numerically zero, irrespective of the meshsize. Note that the case differs from the others since here the interpolation mesh is formed by just one element. The corresponding function is thus differentiable everywhere and the used gradient-based optimizers are able to minimize the loss function more effectively. We highlight that, since and , we have to choose to satisfy the inf-sup condition.
To illustrate the mechanism that may lead to the onset of spurious modes, in Appendix B.2 we provide an analytical example of a neural network which significantly differs from a PDE solution, yet it is a global minimizer of the corresponding loss function.
These results, although obtained in overly simple functional settings, show the potential existence of uncontrolled components in the discrete solutions obtained by non-interpolated neural networks. In more complex scenarios, the presence of spurious modes may be even more pronounced. In practice, as observed in Fig. 2, when the PDE solution is smooth enough non-interpolated solutions appear to be more accurate than the corresponding solutions obtained by interpolated neural networks using the same test functions; however, a rigorous analysis of NN-based discretization schemes should also cope with the presence of spurious components, which we have avoided by resorting to an inf-sup condition. We believe that these observations shed new light on the use of deep learning in numerical PDEs.
7 Application to nonlinear parametric problems
In the previous sections, we investigated the features of the proposed VPINN discretization for the linear boundary-value problem (2.1). Hereafter, we provide an application where the nonlinear nature of neural networks can be exploited at best. It is well known that solving nonlinear PDEs by PINNs or VPINNs comes at little extra cost with respect to linear PDEs, since nonlinearities just impact the computation of the loss function. Similarly, parametric problems can be easily and efficiently handled by neural networks, even when the dependence of the solution upon the parameters is nonlinear. Indeed, it is enough to add as many inputs as the number of parameters in the definition of the network, and train it on a proper subset of the parameter space.
To illustrate the behavior of our VPINN in these situations, let us consider the following nonlinear parametric equation:
(7.1) |
where and are suitably smooth functions, and is an additional parameter. Our goal is to train a neural network to compute the numerical solution for any given value of in a prescribed parametric domain .
We fix , , , and choose and such that the exact solution is
To approximate such a solution in the parametric domain , we consider a neural network with three inputs () and we train it using the loss function:
(7.2) |
where is a finite set of parameter values, and the residuals are defined as in (3.10), considering the new equation. In this numerical test contains equally spaced values .
After the training phase, the neural network can be evaluated at new parameter values to analyze its accuracy. The error diagram is presented in Fig. 8: the blue line is computed as the error between the exact solution and the corresponding numerical solution, while the red dots represent the error associated with parameters in . Despite the small number of parameter values used during training, the model provides accurate solutions for the whole range of parameter values. Note that the error increases for larger values of because the solution is more and more oscillating as increases.

8 Conclusions
We have investigated VPINN methods for elliptic boundary-value problems, in what concerns the choice of test functions and quadrature rules. The aim was the derivation of rigorous a priori error estimates for some projection of the neural network solution. The neural network is trained using as test functions finite-element nodal Lagrange basis functions of degree on a mesh , where Gaussian quadrature rules of order are applied in each element of . For a fixed neural network architecture with tanh activation function, we studied how the error in the energy norm depends upon the mesh parameter , for different values of and .
Error control was obtained for the finite-element interpolant of degree of the neural network on an auxiliary mesh ; such an interpolation enters also in the definition of the residuals which are minimized through the loss function. A key ingredient in the error control is the validity of an inf-sup condition between the spaces of test functions and interpolating functions. Indeed, the neural network solution might be affected by spurious modes due to the under-determined nature of the minimization problem, as we documented for a problem with zero data; instead, the onset of such modes is prevented by the adopted interpolation procedure.
Our analysis reveals that the convergence rate in the energy norm is at least of order for sufficiently smooth functions, and it increases to when the value of the loss function obtained by minimization is sufficiently small. The main message stemming from the analysis is that it is convenient to choose test functions of the lowest degree in order to get the highest convergence rate for a fixed quadrature rule. Furthermore, for smooth solutions the convergence rate may be arbitrarily increased by increasing the precision of the quadrature rule, although the realization of this theoretical statement is hampered in practice by the finite precision of machine arithmetics.
We also investigated the influence of the neural network hyperparameters on the overall accuracy of the discretization, and we found that a small network with few layers and neurons suffices to reach accuracies of practical interest. To stay on the safe side, we used a larger network in our experiments, thereby obtaining results that are essentially independent of the network hyperparameters.
For the sake of comparison, we also implemented a standard VPINN without projection upon piecewise polynomials, as well as a standard PINN trained with the same number of inputs as those used in training our VPINN. Interestingly, we experimentally observed that in general the error decay rate for the non-interpolated neural network solution replicates the one theoretically predicted for the interpolated network. The PINN solutions appear to be less accurate and noisier than the interpolated VPINNโs.
We have shown that interpolated VPINNs are able to efficiently solve nonlinear parametric problems without the need for additional nonlinear solvers or globalization methods, due to their intrinsic nonlinear nature. The VPINN can be trained in an off-line phase on a subset of the parameter domain and then efficiently evaluated on-line on any other parameter value. This is a key difference between the proposed method and standard numerical techniques such as FEM, even if the solution is sought in the same finite dimensional space. Indeed, the latter would require some iterative technique to handle nonlinearities, as well as some form of interpolation/extrapolation to get the solution for the whole range of parameters. All this is provided for free by the NN machinery.
Possible extensions of this work are related to the investigation of more advanced neural networks architectures to improve the method accuracy and efficiency [26, 9] or to more complex problems. Indeed, neural networks are known to be able to manage very high-dimensional problems, overcoming the so-called curse of dimensionality, therefore we expect them to be able to efficiently solve parametric PDEs with multiple parameters [9] or high-dimensional PDEs [12, 19]. Other possible applications are related, for instance, to inverse problems [4] or integration between PDEs and data [5].
Declarations. The authors performed this research in the framework of the Italian MIUR Award โDipartimenti di Eccellenza 2018-2022โ granted to the Department of Mathematical Sciences, Politecnico di Torino (CUP: E11G18000350001). The research leading to this paper has also been partially supported by the SmartData@PoliTO center for Big Data and Machine Learning technologies. SB was supported by the Italian MIUR PRIN Project 201744KLJL-004, CC was supported by the Italian MIUR PRIN Project 201752HKH8-003. The authors are members of the Italian INdAM-GNCS research group.
The authors have no relevant financial or non-financial interests to disclose.
The datasets generated during and/or analysed during the current study are available from the corresponding author on reasonable request.
References
- [1] A.ย G. Baydin, B.ย A. Pearlmutter, A.ย A. Radul, and J.ย M. Siskind, Automatic differentiation in machine learning: a survey, Journal of machine learning research, 18 (2018).
- [2] S.ย Berrone, C.ย Canuto, and M.ย Pintore, Variational Physics Informed Neural Networks: the role of quadratures and test functions, arXiv preprint arXiv:2109.02095v1, (2021).
- [3] S.ย Berrone, C.ย Canuto, and M.ย Pintore, Solving pdes by variational physics-informed neural networks: an a posteriori error analysis, arXiv preprint arXiv:2205.00786, (2022).
- [4] Y.ย Chen, L.ย Lu, G.ย E. Karniadakis, and L.ย D. Negro, Physics-informed neural networks for inverse problems in nano-optics and metamaterials, Opt. Express, 28 (2020), pp.ย 11618โ11633.
- [5] Z.ย Chen, Y.ย Liu, and H.ย Sun, Physics-informed learning of governing equations from scarce data, Nature communications, 12 (2021), pp.ย 1โ13.
- [6] Ph.ย Ciarlet, The Finite Element Method for Elliptic Problems, vol.ย 40 of Classics in Applied Mathematics, Society for Industrial and Applied Mathematics (SIAM), Philadephia, 2002.
- [7] T.ย De Ryck, S.ย Lanthaler, and S.ย Mishra, On the approximation of functions by tanh neural networks, Neural Networks, (2021).
- [8] D.ย Elbrรคchter, D.ย Perekrestenko, P.ย Grohs, and H.ย Bรถlcskei, Deep neural network approximation theory, IEEE Transactions on Information Theory, 67 (2021), pp.ย 2581โ2623.
- [9] H.ย Gao, L.ย Sun, and J.-X. Wang, Phygeonet: physics-informed geometry-adaptive convolutional neural networks for solving parameterized steady-state pdes on irregular domain, Journal of Computational Physics, 428 (2021), p.ย 110079.
- [10] L.ย Gonon and C.ย Schwab, Deep ReLU neural networks overcome the curse of dimensionality for partial integrodifferential equations, arXiv preprint arXiv:2102.11707, (2021).
- [11] I.ย Gรผhring, G.ย Kutyniok, and P.ย Petersen, Error bounds for approximations with deep ReLU neural networks in norms, Analysis and Applications, 18 (2020), pp.ย 803โ859.
- [12] J.ย Han, A.ย Jentzen, and E.ย Weinan, Solving high-dimensional partial differential equations using deep learning, Proceedings of the National Academy of Sciences, 115 (2018), pp.ย 8505โ8510.
- [13] W.ย Ji, W.ย Qiu, Z.ย Shi, S.ย Pan, and S.ย Deng, Stiff-pinn: Physics-informed neural network for stiff chemical kinetics, The Journal of Physical Chemistry A, 125 (2021), pp.ย 8098โ8106.
- [14] E.ย Kharazmi, Z.ย Zhang, and G.ย Karniadakis, VPINNs: Variational Physics-Informed Neural Networks For Solving Partial Differential Equations, arXiv preprint arXiv:1912.00873, (2019).
- [15] E.ย Kharazmi, Z.ย Zhang, and G.ย E. Karniadakis, -VPINNs: Variational physics-informed neural networks with domain decomposition, Computer Methods in Applied Mechanics and Engineering, 374 (2021), p.ย 113547.
- [16] R.ย Khodayi-Mehr and M.ย Zavlanos, VarNet: Variational neural networks for the solution of partial differential equations, in Learning for Dynamics and Control, PMLR, 2020, pp.ย 298โ307.
- [17] D.ย P. Kingma and J.ย Ba, Adam: a method for stochastic optimization, arXiv preprint arXiv:1412.6980, (2014).
- [18] G.ย Kutyniok, P.ย Petersen, M.ย Raslan, and R.ย Schneider, A theoretical analysis of deep neural networks and parametric PDEs, Constructive Approximation, (2021), pp.ย 1โ53.
- [19] S.ย Lanthaler, S.ย Mishra, and G.ย E. Karniadakis, Error estimates for DeepONets: a deep learning framework in infinite dimensions, Transactions of Mathematics and Its Applications, 6 (2022). tnac001.
- [20] S.ย Mishra and R.ย Molinaro, Estimates on the generalization error of physics-informed neural networks for approximating a class of inverse problems for PDEs, IMA Journal of Numerical Analysis, (2021).
- [21] S.ย Mishra and R.ย Molinaro, Estimates on the generalization error of physics-informed neural networks for approximating PDEs, IMA Journal of Numerical Analysis, (2022).
- [22] J.ย A. Nitsche, Uber ein Variationsprinzip zur Losung Dirichlet-Problemen bei Verwendung von Teilraumen, die keinen Randbedingungen unteworfen sind, Abh. Math. Sem. Univ., Hamburg, 36 (1971), pp.ย 9โ15.
- [23] J.ย A. Opschoor, P.ย C. Petersen, and C.ย Schwab, Deep ReLU networks and high-order finite element methods, Analysis and Applications, 18 (2020), pp.ย 715โ770.
- [24] J.ย A. Opschoor, C.ย Schwab, and J.ย Zech, Exponential ReLU DNN expression of holomorphic maps in high dimension, Constructive Approximation, (2021), pp.ย 1โ46.
- [25] M.ย Raissi, P.ย Perdikaris, and G.ย Karniadakis, Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations, Journal of Computational Physics, 378 (2019), pp.ย 686โ707.
- [26] R.ย Rodriguez-Torrado, P.ย Ruiz, L.ย Cueto-Felgueroso, M.ย C. Green, T.ย Friesen, S.ย Matringe, and J.ย Togelius, Physics-informed attention-based neural network for hyperbolic partial differential equations: application to the buckleyโleverett problem, Scientific Reports, 12 (2022), pp.ย 1โ12.
- [27] V.ย Rvachev, T.ย Sheiko, V.ย Shapiro, and I.ย Tsukanov, Transfinite interpolation over implicitly defined sets, Computer Aided Geometric Design, 18 (2001), pp.ย 195โ220.
- [28] F.ย Sahliย Costabal, Y.ย Yang, P.ย Perdikaris, D.ย E. Hurtado, and E.ย Kuhl, Physics-informed neural networks for cardiac activation mapping, Frontiers in Physics, 8 (2020), p.ย 42.
- [29] L.ย N. Smith, Cyclical learning rates for training neural networks, in 2017 IEEE winter conference on applications of computer vision (WACV), IEEE, 2017, pp.ย 464โ472.
- [30] N.ย Sukumar and A.ย Srivastava, Exact imposition of boundary conditions with distance functions in physics-informed deep neural networks, Comput. Methods Appl. Mech. Engrg., 389 (2022), pp.ย Paper No. 114333, 50.
- [31] A.ย Tartakovsky, C.ย Marrero, P.ย Perdikaris, G.ย Tartakovsky, and D.ย Barajas-Solano, Learning parameters and constitutive relationships with physics informed deep neural networks, arXiv preprint arXiv:1808.03398, (2018).
- [32] C.ย L. Wight and J.ย Zhao, Solving allen-cahn and cahn-hilliard equations using the adaptive physics informed neural networks, Communications in Computational Physics, 29 (2021), pp.ย 930โ954.
- [33] S.ย Wright, J.ย Nocedal, etย al., Numerical optimization, Springer Science, 35 (1999), p.ย 7.
- [34] Y.ย Yang and P.ย Perdikaris, Adversarial uncertainty quantification in physics-informed neural networks, Journal of Computational Physics, 394 (2019), pp.ย 136โ152.
- [35] Y.ย Zang, G.ย Bao, X.ย Ye, and H.ย Zhou, Weak adversarial networks for high-dimensional partial differential equations, Journal of Computational Physics, (2020), p.ย 109409.
- [36] E.ย Zhang, M.ย Yin, and G.ย E. Karniadakis, Physics-informed neural networks for nonhomogeneous material identification in elasticity imaging, arXiv preprint arXiv:2009.04525, (2020).
Appendix
Appendix A.1 Construction of the interpolation operator
In this section we provide details on the practical construction of the operator introduced in Section 3.2.
Since is the linear subspace of containing all the piecewise polynomial of degree defined over , there exists a Lagrange basis such that , which is associated with a corresponding set of points . The basis functions satisfy the relations . Therefore, the operator maps the generic function to the function , uniquely identified by the vector , where .
In order to evaluate the function at the required quadrature points during the loss function computation or the final evaluation, one just needs to compute the quantities
In practice, it is more convenient to introduce the sparse matrix such that . This allows us to evaluate the interpolated function at each quadrature point with a matrix-vector multiplication as follows:
(A.1.1) |
In the same way, the derivatives of can be computed, at the same points, as
(A.1.2) |
where and . Defining the matrix such that , it is possible to compute all the required derivatives simply by replacing by on the right hand side of (A.1.1). In this way, the VPINN derivatives can be computed without relying on automatic differentiation, further improving the method efficiency during training.
Appendix B.2 An example of โspuriousโ neural network
Consider again the boundary-value problem (6.1), which admits the null solution. We are interested in solving this problem by a plain PINN (VPINN) solver. To train the network, we choose a set of control (quadrature) points,
satisfying . Using the architecture defined in (3.1), it is possible to construct a ReLU neural network with just a single hidden layer and 3 neurons with the following weights:
where, for any fixed index , we denote by the mean of two consecutive nodes, and by the difference between and , for some . The function represented by this set of weights is:
(B.2.1) | ||||
An example of such a function is shown in Fig. 9.

It is easily seen that for any , therefore the PINN (VPINN) loss function is exactly equal to 0. However, this does not ensure the accuracy of the approximation, in fact .
Note that it is possible to define larger networks with analogous properties. Moreover, the same phenomenon can be observed with any sigmoid activation function, exploiting the fact that the accuracy in the evaluation of both the activation function and the loss function is bounded by machine precision. We also highlight that the phenomenon can be partially alleviated by introducing a regularization term in the loss function; however, it adds noise to the optimization process, possibly resulting in losses of accuracy when the PDE solution is characterized by large gradients.
This proves that it is not possible to guarantee the inf-sup stability for standard PINNs or VPINNs, and that spurious modes cannot be controlled simply minimizing the loss function. On the contrary, the interpolation operator proposed in this paper acts as a VPINN stabilizer, preventing the onset of spurious components in the solution.