Skip to content

PirateNets

TL;DR

Deep PINNs train worse than shallow ones because bad initialization of the network derivatives destabilizes the residual loss. PirateNets add a trainable skip α (initialized at 0) to every residual block, so the model starts as a linear map of its embeddings and deepens itself during training. Based on Wang, Li, Chen & Perdikaris, JMLR 2024.

The problem: depth hurts PINNs

For standard MLPs with common initializations, the derivatives of the network — which is what the PDE residual sees — become increasingly pathological with depth. Empirically, PINN accuracy degrades as MLPs get deeper, the opposite of what we expect from deep learning.

The architecture

Input coordinates are first lifted by an embedding Φ(x) (random Fourier features in JAXPI), from which two gating states are computed once:

U=σ(WuΦ(x)+bu),V=σ(WvΦ(x)+bv).

Each residual block l then applies three dense layers with two gating operations (paper, Eqs. 19–24):

f(l)=σ(W1(l)x(l)+b1(l)),z1(l)=f(l)U+(1f(l))V,g(l)=σ(W2(l)z1(l)+b2(l)),z2(l)=g(l)U+(1g(l))V,h(l)=σ(W3(l)z2(l)+b3(l)),x(l+1)=α(l)h(l)+(1α(l))x(l).

PirateNet residual block

The key design is the adaptive skip α(l)R:

  • α(l)=0: the block is an identity map — the whole network reduces to a linear combination of the first-layer embeddings, which is trivially well-conditioned for the residual loss.
  • α(l)=1: a fully nonlinear block with no shortcut.

Initializing α(l)=0 means the model starts shallow and deepens as training demands — the nonlinearities switch on only when they reduce the loss. A PirateNet with L blocks has depth 3L but trains as robustly as a shallow network. The paper additionally proposes a physics-informed least-squares initialization of the final linear layer when data is available.

In JAXPI

python
arch.arch_name = "PirateNet"
arch.num_layers = 2                 # residual blocks (depth 3L)
arch.hidden_dim = 256
arch.nonlinearity = 0.0             # initial alpha for every block
arch.fourier_emb = {"embed_scale": 2.0, "embed_dim": 256}   # must equal hidden_dim

The learned α(l) values can be logged during training (logging.log_nonlinearities = True) — watching them grow is a nice window into how much depth the problem actually needs.

Where it's used

The default architecture of nearly every benchmark; the Taylor–Green multi-stage cascade relies on it at every stage. See Architectures for the other options.

Released under the Apache 2.0 License.