{'fraction_non_alphanumeric': 0.03016169154228856, 'fraction_numerical': 0.009224709784411277, 'mean_word_length': 4.899419137878325, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
HyperPINN: Learning parameterized differential equations with physics-informed hypernetworks

Many types of physics-informed neural network models have been proposed in recent years as approaches for learning solutions to differential equations. When a particular task requires solving a differential equation at multiple parameterizations, this requires either re-training the model, or expanding its representation capacity to include the parameterization -- both solution that increase its computational cost. We propose the HyperPINN, which uses hypernetworks to learn to generate neural networks that can solve a differential equation from a given parameterization. We demonstrate with experiments on both a PDE and an ODE that this type of model can lead to neural network solutions to differential equations that maintain a small size, even when learning a family of solutions over a parameter space.


Introduction
The recent successes of deep learning approaches in diverse domains have motivated many works exploring their application to physical systems, including approximating the solutions to differential equations [2,3,6,7,9,11]. In many applications such as shape optimization, topology optimization or design prototyping, approximate solutions with fast iteration times might be preferred over guaranteed accurate, yet computationally complex, ones. In these cases, machine learning models might offer an interesting alternative to traditional methods. Moreover, the usage of data-driven methods allows for the incorporation of data into the solution, which can be useful in domains where only noisy or partial measurements are available, or where the underlying physics are not fully known [4,10,12].
Physics-informed neural networks (PINNs) [9] have been recently proposed as a method for employing neural networks as function approximators to the solution of differential equations, while allowing the incorporation of the underlying physical knowledge in the form of a physics-informed loss. In their standard formulation, PINNs fit the solution to a single parameterization of a differential equation. Thus, when working in a domain that requires evaluating the solutions at multiple parameterizations, this requires either (1) re-training the model multiple times to find the solution at each parameterization, or (2) including the parameterization explicitly as an input to the neural network model (e.g., [1]). Given that training is the most expensive part of the process, having to repeat the learning procedure for every parameterization can greatly increase the computational cost of the method. Conversely, augmenting the model to take into account the parameters requires increasing the capacity of the neural network, as it now has to both approximate the solution function and model the parameter space, thus also increasing the computational cost at inference time.
In this work, we propose looking at the problem of learning parameterized families of differential equations as a meta-learning problem, where the given parameters and initial/boundary conditions define a task, which can then be solved by a neural network. Under this framework, we propose the HyperPINN, which uses a hypernetwork [5] to learn to model the parameter space of a differential equation, taking as input a given parameterization and producing as output a main network that approximates the solution function at that specific parameterization. By separating this task into two parts, the complexity of modeling the parameter space is "offloaded" to the hypernetwork, which is only evaluated once for every parameterization. Importantly, this allows the main network, which is evaluated at every time-space point, to remain small. We demonstrate this approach with experiments on a PDE and an ODE, using both "standard" PINNs [9] and multistep neural networks [8].

Methods
Let us assume a differential equation in the general form N [t, x, u(t, x); λ] = 0, defined by the (possibly non-linear) differential operator N [·; λ], which can contain time and space derivatives, and is parameterized by some list of parameters λ ∈ R d . Refer to Appendix A.1 for a complete definition.
Physics-Informed Neural Networks Physics-informed neural networks [9] are a method for approximating the solution to differential equations using neural networks (NNs). In this method, a neural networkû(t, x; θ), with learned parameters θ, is trained to approximate the solution function u to the differential equations. Importantly, PINNs employ not only a standard "supervised" data loss, but also a physics-informed loss, which consists of the differential equation residual defined by N . Refer to Appendix A.2 for further details.
Multistep Neural Networks Multistep neural networks [8] are a related method, in which a neural network model is used to approximate the time-derivative of a dynamical system. Instead of using the differential equation residiuals, the loss for the multistep neural network is derived directly from the formulation for traditional multistep methods. Refer to Appendix A.3 for further details.
Hypernetworks Hypernetworks [5] are a recently proposed meta-learning method in which learning is broken down into two separate networks: a main network and a hypernetwork. The main network performs the desired task, in the same way a neural network would normally be employed. The parameters for this network, however, are not learned directly at training time. Instead, the parameters for the main network are generated, at evaluation time, by the hypernetwork. That is, for a hypernetwork f h that takes an input x h , and a main network f m that takes as input x m , we have where θ h are the learnable parameters. This ability to generate neural networks allows the hypernet to meta-learn a space of tasks defined by x h , outputting an appropriate main network for each task.
HyperPINN In this work, we propose the HyperPINN, which combines the previously described physics-informed architectures with hypernetworks in order to learn parameterized families of differential equations. A HyperPINN has a hypernetwork that, given a certain parameterization, generates a main network that approximate the solution to the corresponding differential equation.
Following the general differential equation definition above, we want to have a hypernetwork that maps a parameterization λ into an approximation of the differential equation given by a neural network. Following the hypernetwork formulation in Equation 1, a HyperPINN could consist of Here f h is the hypernetwork with learneable parameters θ h , andû is the approximate solution. These parameters can be trained using a standard supervised loss, but also physics-informed losses such as the ones in Equations 6 or 9. Appendix A.4 contains a schematic representation of the HyperPINN.

Experiments
We evaluate the application of HyperPINNs to both an example PDE problem, the 1D Burgers' PDE, and an example ODE problem, the Lorenz system, using both a PINN and a multistep neural network.

1D Burgers' equation
The 1D Burgers' PDE, with solution u(t, x), a function of time t and spatial coordinate x, is given by This equation has a viscosity parameter ν, which can cause the underlying solution u to exhibit different behavior depending on its value. For low values, such as ν = 0.001, the solution develops a characteristic shock. For higher values, such as ν = 0.1, the solution is smooth. In order to test the ability of the PINN and the HyperPINN to learn parameterized systems, we performed this experiment by having the parameter ν vary in the range [0.001, 0.1]. For training, a dataset with 100 random points from the initial and boundary conditions was created, with the additional collocation points, used in the physics-informed loss, sampled randomly. For more details refer to Appendix A.5.
We evaluate the HyperPINN and compare it to two PINN baselines. For the HyperPINN, the hypernetwork takes as input the parameter ν and outputs the parameters for a main neural network, which takes as input the space-time coordinates and approximates the solution function u. For the standard PINN baselines, a single network takes as input both the parameter ν and the space time coordinates, and outputs the approximate solution. The summary of the results are shown in Table 1.
The HyperPINN consists of a main network with 6 fully-connected (FC) hidden layers of size 8 (393 parameters) and a hypernetwork with 3 FC hidden layers of size 32 followed by 1 hidden layer of size 16 (9385 parameters). The first baseline, the small PINN baseline, consists of a FC network of approximately the same size as the main network in the HyperPINN, with 6 hidden layers of size 8 (401 parameters). This baseline serves as a comparison point to the main network, which is the one that is evaluated multiple times after the hypernetwork is evaluated once to generate the main network's weights. Qualitatively, we can see in Figure 1 that the HyperPINN learns to approximate the solution function even at a parameter value containing a shock. The small PINN baseline is not able to learn to properly approximate the solution, lacking capacity to fully learn the parameter space.
The second baseline, the large PINN baseline, consists of a FC network of approximately the same size as the full hyper and main networks combined in the HyperPINN, with 10 hidden layers of size 32 (9665 parameters). This baseline serves as a comparison point with the same full capacity as the HyperPINN. It is able to achieve results close to the HyperPINN, but it has a much larger size. As a consequence, the large PINN has a runtime of 158µs for performing a single prediction, whereas the main network in the HyperPINN has a runtime of 86µs for performing the same prediction, which is faster than even the small PINN. That is, for a similar number of parameters, the HyperPINN is able to surpass the performance of a large network while keeping the main network as efficient as a small one, by offloading the task of learning the parameter space to the hypernetwork. All times were measured on an NVIDIA Tesla V100 GPU.

Lorenz system
To show this method works with diverse physics-informed approaches, in this experiment we use a multistep neural network to learn the time-derivative of the Lorenz system right-hand side in Equation This equation has parameters (σ, β, ρ). In order to test the ability of the PINN and the HyperPINN to learn parameterized systems, we performed this experiment with σ = 10, ρ varying in the range We compare the HyperPINN with two baselines, a small and a large multistep neural network. The HyperPINN consists of a main FC network with one hidden layer of size 16 (115 parameters) and a FC hypernetwork with 2 hidden layers of size 16 and 8 (1406 parameters). The small baseline consists of a FC network with one hidden layer of size 16 (214 parameters). The large baseline consists of a FC network with one hidden layer of size 256 (3334 parameters). In the HyperPINN, the hypernetwork takes as input the parameters (σ, β, ρ) and outputs the parameters for a main network, which takes as input the state (x, y, z) and outputs the time-derivative (ẋ,ẏ,ż). In the baselines, a single network takes as input both the parameters and the state, and outputs the time-derivative.
Note that when performing integration using the learned model, it is expected that the system will deviate from the ground truth. Given the chaotic nature of the system, even minuscule deviations from the true time-derivative compound over time when performing integration, causing large errors even when the correct qualitative behavior is captured. Nevertheless, when compared to the baselines, the HyperPINN achieves lower error in predicting the trajectories of the system. While the HyperPINN achieves an aggregate squared error over all test trajectories of 17.5, the small baseline has an error of 39.4, and the large baseline has an error of 20.6. Importantly, when analyzing the results qualitatively, we can see that the HyperPINN achieves this lower error by more accurately capturing the qualitative behavior of the system at different parameter values. In comparison, the baselines frequently mistake one type of behavior for another, as exemplified in Figure 2.
Particularly, the HyperPINN achieves better performance than the small baseline with a similarly sized main network. In comparison to the large baseline, the HyperPINN is able to approximate the solution at diverse parameters and initial conditions while using a much smaller sized main network, which is repeatedly evaluated for integration at test time.

Conclusion
We have presented an approach to learning parameterized families of differential equations that separates the learning task into two parts. By using a separate hypernetwork to learn the parameter space, the main network that approximates the differential equation solution can remain small. This approach allows physics-informed neural networks to scale up more efficiently to learn parameterized families of differential equations at once, instead of having to be re-trained for every parameterization, without losing their compactness and efficiency. In this work, we demonstrated this approach on simple ODE and PDE problems. In the future, we intend to apply this method to more complex domains, such as higher dimensional problems and more diverse initial or boundary conditions.

A Appendix
A.1 Differential equations A general differential equation is given by where N [·; λ] is an arbitrary (possibly non-linear) differential operator, which can contain time and space derivatives, and is parameterized by some list of parameters λ ∈ R d . Here, t is the time variable ranging up to time T , x is the D-dimensional spatial variable in some domain Ω ⊆ R D , with boundary ∂Ω, and u(t, x) is the solution function to the differential equation. For a solution to be defined, initial and boundary conditions need to be provided. These can assume different forms, but in general initial conditions define u(0, x) for x ∈ Ω, and boundary conditions define u(t, x) for x ∈ ∂Ω and t ∈ [0, T ].
For a concrete example of this formulation, refer to Equation 3, in which N is a non-linear operator containing first and second derivatives that defines the left-hand side of the equation, and λ = ν. The initial and boundary conditions are given in Equation 10.

A.2 Physics-informed neural networks
Physics-informed neural networks [9] are a method for approximating the solution to differential equations using neural networks (NNs). In this method, a neural networkû(t, x; θ), with learned parameters θ, is trained to approximate the solution function u to the differential equations.
Importantly, PINNs employ not only a standard "supervised" data loss, but also a physics-informed loss, which consists of the differential equation residual defined by N . Thus, for a given optimization hyper-parameter α, the training loss consists of where D is a dataset containing ground-truth values for u (e.g., from simulation data) at points (t i , x i ), and C is a set of collocation points at which to evaluate the differential equation residual (which does not require ground-truth solution data). While the data in D can be used to enforce the initial and boundary conditions, the physics-informed loss term regularizes the search space, penalizing functionsû that do conform to the differential equations, reducing the need for simulation data.

A.3 Multistep neural networks
Multistep neural networks [8] are a related method, in which a neural network model is used to approximate the time-derivative of a dynamical system. Instead of using the differential equation residuals, the loss for the multistep neural network is derived directly from the formulation for traditional multistep methods. That is, for a general dynamical system where f is some arbitrary (linear or non-linear) function of x ∈ R D , a two-step linear multistep method, with timestep ∆t, gives us the relation If we want to train a neural networkf (·; θ) to approximate the time derivative f , this relation can then be used to define a residual loss over a dataset of points x n sampled from a given trajectory f h (λ; θ h ) θ m λ f m (t, x; θ m ) û t, x Figure 3: Diagram for the HyperPINN. The hypernetwork, represented in orange, takes as input the parameterization and outputs the parameters for the main network. The main network, represented in blue, takes as input a space-time coordinate and outputs its prediction using the parameters provided by the hypernetwork. Figure 3 contains a schematic representation of the hyper and main networks that compose the HyperPINN. The hypernetwork takes as input the parameterization and outputs the parameters for the main network. The main network takes as input a space-time coordinate and outputs its prediction using the parameters provided by the hypernetwork.

A.4 HyperPINN
For the case Burgers' PDE, λ corresponds to the parameter ν in the PDE, and the main network outputs and approximation of the solution u. For the case of the Lorenz ODE, λ corresponds to the parameters (σ, β, ρ). When using the multistep neural network approach, the main network takes as input the spatial coordinates (x, y, z) and outputs the time-derivative (ẋ,ẏ,ż).
Here, θ h are the learned parameters. These are trained using a loss on the predictions of the main network, which can then be optimized with gradient-based methods using conventional automatic differentiation packages, since all operations are differentiable. If employing a stochastic gradient descent method, batches of randomly sampled parameter-input pairs can be used. The loss can consist of a regular supervised loss, with a ground truth for the main network prediction for each given parameterization and inputs. Moreover, physics-informed losses can also be used, such as the PINN loss or the multistep loss defined above, in order to make the training more data-efficient.
A dataset of size 100 was generated with 50 points sampled randomly uniformly at different positions from the initial timestep (t = 0) and 50 points sampled randomly uniformly at diverse timesteps from the boundary (x = −1 or x = 1). Since these values do not change with the parameterization, values of the parameter ν are sampled randomly uniformly from the range [0.001, 0.1] at training time to form the training data points. The collocation points are sampled randomly uniformly from the time-space domain, with accompanying values for ν also sampled randomly uniformly.
Example solutions for different parameter values are shown in Figure 4.

A.6 Lorenz system
For the Lorenz experiment, we sampled 100 different initial conditions randomly uniformly from [−10, 10] 3 for each of 30 different parameter values in the ranges described in Section 3.2.
We computed trajectories of 25s duration with ∆t = 0.01 using the Runge-Kutta 45 integrator. Evaluation is performed using a separate set of 100 trajectories, sampled from the same range of parameters and initial conditions, but using different values from the training set.
Example trajectories for different initial conditions and parameter values are shown in Figure 5.