This repository contains the official implementation of the paper: Resolving Gradient Pathologies in Physics-Informed Neural Networks via Dynamic Gradient Surgery and Adaptive Refinement for Robust Inverse Discovery Under Noise.
Physics-Informed Neural Networks (PINNs) offer a mesh-free alternative to classical numerical solvers by embedding governing partial differential equations (PDEs) directly into the training objective. However, they routinely suffer from two forms of gradient pathology:
- Magnitude Imbalance (Type-I): One loss term dominates the optimization.
- Directional Conflict (Type-II): Satisfying one physical constraint actively degrades another (the "Tug-of-War" problem).
These pathologies become catastrophic in inverse parameter discovery, where sparse, noise-corrupted sensor data must coexist with strict PDE enforcement. This repository provides a unified framework to overcome these challenges.
The canonical PINN objective takes the form: $$\mathcal{L}{\text{total}}=\lambda{\text{pde}}\mathcal{L}{\text{pde}}+\sum{k=1}^{K}\lambda_{k}\mathcal{L}{\text{bc},k}+\lambda{\text{data}}\mathcal{L}_{\text{data}}$$
Our framework couples four synergistic modules to stabilize training and enable robust inverse discovery:
Addresses Type-I magnitude imbalance by tracking the running gradient scale of each loss term using a Forgetful Exponential Moving Average (EMA). The EMA estimate is:
$$\hat{g}_i^{(t)}=\alpha\cdot\hat{g}i^{(t-1)}+(1-\alpha)\cdot g_i^{(t)}$$
where $g_i^{(t)}=|\nabla\theta\mathcal{L}_i^{(t)}|$ and
Resolves Type-II directional conflicts. If gradients conflict ($\nabla_\theta\mathcal{L}i\cdot\nabla\theta\mathcal{L}j<0$), the interfering gradient is projected onto the normal plane of its competitor:
$$\nabla\theta\mathcal{L}i^{*}=\nabla\theta\mathcal{L}i-\frac{\nabla\theta\mathcal{L}i\cdot\nabla\theta\mathcal{L}j}{|\nabla\theta\mathcal{L}_j|2^2+\epsilon}\nabla\theta\mathcal{L}_j$$
Before surgery, GTN normalizes each gradient vector to
Dynamically redistributes collocation points based on the current residual landscape, sampling heavily in regions with high PDE residual magnitude
Ensures physical validity during inverse problems. Rather than a raw parameter, unknown variables (like Reynolds number) are parameterized through a Softplus activation to guarantee positive values:
The framework utilizes Sinusoidal Representation Networks (SIREN), where each hidden layer applies:
float64 precision.
The framework is validated on two canonical benchmarks:
-
Allen-Cahn Equation: A stiff phase-field equation (
$\epsilon=10^{-4}$ ) modeling phase separation dynamics. -
2D Navier-Stokes (Cylinder Flow): Steady incompressible flow around a cylinder at
$Re=100$ .
In inverse parameter estimation (discovering