Meta-learning PINN loss functions

Apostolos F. Psaros, Kenji Kawaguchi, George Em Karniadakis · DOI

Abstract

We propose a meta-learning technique for offline discovery of physics-informed neural network (PINN) loss functions. We extend earlier works on meta-learning, and develop a gradient-based meta-learning algorithm for addressing diverse task distributions based on parametrized partial differential equations (PDEs) that are solved with PINNs. Furthermore, based on new theory we identify two desirable properties of meta-learned losses in PINN problems, which we enforce by proposing a new regularization method or using a specific parametrization of the loss function. In the computational examples, the meta-learned losses are employed at test time for addressing regression and PDE task distributions. Our results indicate that significant performance improvement can be achieved by using a shared-among-tasks offline-learned loss function even for out-of-distribution meta-testing. In this case, we solve for test tasks that do not belong to the task distribution used in meta-training, and we also employ PINN architectures that are different from the PINN architecture used in meta-training. To better understand the capabilities and limitations of the proposed method, we consider various parametrizations of the loss function and describe different algorithm design options and how they may affect meta-learning performance.

Introduction

Physics-Informed Neural Networks (PINNs) have emerged as a powerful tool for solving partial differential equations (PDEs). However, they are notoriously difficult to tune. Training a PINN involves minimizing a composite loss function that balances PDE residuals, boundary conditions (BCs), and initial conditions (ICs). In practice, researchers often default to Mean Squared Error (MSE) and spend significant time manually tuning the weights of these terms. This "trial-and-error" approach is computationally expensive and often results in sub-optimal convergence because the standard MSE loss landscape for complex PDEs can be riddled with local minima and stiff gradients.

This research addresses the question: Can we "learn" a better loss function? Specifically, the goal is to discover a loss function offline that encodes the underlying physics of a family of PDEs, making it easier and faster to solve new, unseen tasks from that same family.

Methodology

The proposed framework employs a bi-level optimization strategy, a classic meta-learning technique often described as "learning to learn." The process is divided into two distinct loops:

  1. Inner Optimization: A PINN is trained for a few iterations ($J$ steps) on a specific PDE task using a parameterized loss function ($Loss_\eta$).
  2. Outer Optimization: The parameters of the loss function ($\eta$) are updated by differentiating through the entire inner optimization path. The goal is to minimize a meta-objective—typically the MSE on a separate validation set.
Schematic illustration of the proposed meta-learning method for discovering PINN loss functions.

The study explores two primary ways to parameterize the loss:

  • Learned Adaptive Loss (LAL): A specific mathematical form that can represent various standard losses (like Cauchy or Welsch) by tuning shape and scale parameters.
  • FFN-parametrized: Using a small Feed-Forward Network to represent the loss function itself, offering maximum flexibility.

A major contribution of this work is the theoretical derivation of two "desirable properties" for learned losses: the optimal stationarity condition (ensuring stationary points are global minima) and the MSE relation condition (ensuring the loss is zero only when the error is zero). A novel regularization term is introduced to enforce these properties when using the FFN-based loss.

Experimental Setup and Datasets

The method was evaluated on four representative benchmarks involving diverse task distributions:

  1. Discontinuous Function Approximation: A pedagogical example involving noisy, high-frequency signals.
  2. Advection Equation: Solving a (1+1)-dimensional advection problem with varying initial conditions and discontinuous solutions.
  3. Reaction-Diffusion Equation: A 2D nonlinear steady-state problem with varying source terms.
  4. Burgers Equation: The classic nonlinear PDE benchmark, tested across two different viscosity regimes.

Key Insights and Results

Physics Encoding and Generalization

By differentiating through the optimization path, the meta-learned loss function "encodes" information about how the PINN's weights typically evolve when solving a specific class of physics problems. Surprisingly, a loss function meta-learned on a specific PINN architecture generalizes well to different, unseen architectures at test time.

Performance Metrics

  • Superior Accuracy: In function approximation, the LAL-based meta-learned loss achieved a minimum relative error approximately 15% lower than standard MSE.
  • Faster Convergence: For the advection equation, PINNs using the meta-learned loss reached lower error levels in 10,000 iterations than standard MSE-based PINNs did in 50,000 iterations.
  • Out-of-Distribution (OOD) Success: The learned losses remained effective even when tested on PDE parameters outside the range seen during meta-training.

Parameterization Trade-offs

While FFNs are more expressive, the LAL parameterization proved more robust and naturally satisfied the required theoretical conditions for stable training without extra regularization. Additionally, the framework successfully meta-learned the weights ($w_f, w_b, w_{u0}$) of the composite objective, often finding asymmetric loss shapes that prioritize certain constraints (like ICs) more effectively than manual tuning.

Limitations and Future Work

The primary limitation is the computational cost of the offline phase, as differentiating through optimization paths is memory-intensive. The authors also noted that meta-learning works best with simple optimizers like SGD; when using optimizers with "memory" (like Adam), the meta-learner struggles because it only sees a short window of the optimization history.

Future research will focus on improving the framework to better handle complex optimizers, scaling the method to higher-dimensional PDEs, and exploring "online" meta-learning where the loss function continues to adapt during the test phase.

Summary updated

BibTeX
@article{psaros2021meta,
  author = {Apostolos F. Psaros and Kenji Kawaguchi and George Em Karniadakis},
  title = {{Meta-learning PINN loss functions}},
  journal = {Journal of Computational Physics},
  year = {2021},
  doi = {10.1016/j.jcp.2022.111121},
}
Figure