Transformer for Partial Differential Equations' Operator Learning

Zijie Li, Kazem Meidani, Amir Barati Farimani

Introduction

Partial Differential Equations (PDEs) serve as the fundamental mathematical language for describing physical phenomena, ranging from fluid dynamics to electromagnetism. Traditionally, solving these equations requires significant computational resources and specialized numerical grids. While "Neural Operators"—AI models designed to map input functions to PDE solutions—have emerged as a faster alternative, many existing architectures are constrained by rigid inductive biases. For instance, Convolutional Neural Networks (CNNs) typically require structured rectangular grids, while Graph Neural Networks (GNNs) can be sensitive to specific mesh connectivity.

Researchers at Carnegie Mellon University have introduced OFormer (Operator Transformer), a novel deep learning framework that leverages attention mechanisms to overcome these limitations. OFormer is "mesh-agnostic," allowing it to learn complex physical behaviors and predict solutions across varying resolutions and irregular geometries with high precision.

Methodology

OFormer treats operator learning as a sequence-to-sequence task, utilizing a point-based approach that functions independently of the underlying grid structure. The architecture is built upon three primary pillars:

1. Cross-Attention and Spatial Encoding

The core of OFormer is a cross-attention mechanism that decouples the input domain (where sensors are located) from the output domain (where the solution is queried). This allows the model to query the solution at any arbitrary coordinate, regardless of the training data's sampling density. To inject spatial context into the naturally "position-blind" attention mechanism, the authors adapted Rotary Positional Encoding (RoPE) from natural language processing to 1D and 2D spatial domains.

The OFormer architecture for spatial operator learning, utilizing cross-attention to map input observations to query locations.

2. Latent Time-Marching

For time-dependent problems, such as evolving fluid flows, OFormer avoids the memory overhead of predicting high-dimensional frames directly. Instead, it encodes the system state into a compact "latent" space. A shared MLP-based propagator then "marches" the physics forward in time within this latent space before a shared decoder maps the results back to the observable domain.

The latent time-marching strategy for time-dependent systems, where a shared propagator evolves the latent state before decoding.

3. Efficient Linear Attention

To maintain computational efficiency when dealing with large numbers of data points, OFormer utilizes "softmax-free" linear attention (Galerkin or Fourier types). This ensures that the computational cost does not scale quadratically with the sequence length, making it viable for high-resolution simulations.

Experimental Results

The model was rigorously evaluated on both structured and unstructured benchmarks, including the 1D viscous Burgers’ equation, 2D Darcy flow, and 2D incompressible Navier-Stokes equations. It was also tested on complex, irregular geometries like L-shaped and U-shaped domains for Poisson equations.

  • Competitive Performance: On the 2D Navier-Stokes benchmark, OFormer achieved a relative $L_2$ error of 0.0645, slightly outperforming the state-of-the-art Multiwavelet-based Operator (MWT) while utilizing significantly fewer parameters.
  • Zero-Shot Mesh Generalization: OFormer demonstrated superior robustness compared to GNNs when tested on "U-shape" geometries unseen during training, proving its ability to generalize across different mesh topologies.
  • Resolution Invariance: The model maintained consistent error rates across varying resolutions (e.g., from 512 to 8192 points), a significant advantage over traditional CNN-based solvers.
  • Robustness to Sparsity: Notably, OFormer can be trained on full-resolution data and still provide accurate predictions even when 75% of input sensors are randomly removed.

Discussion and Future Work

OFormer represents a significant step toward flexible, mesh-independent neural operators. By treating attention as a learnable integral operator, it aligns closely with the mathematical foundations of PDE solving. However, challenges remain. Like many Transformers, OFormer is data-hungry and can be more computationally expensive than simpler architectures at extreme scales. Additionally, like most data-driven solvers, it faces potential error accumulation in long-term transient simulations.

Future research directions include hybridizing OFormer with physics-informed constraints to enhance long-term stability and reducing the reliance on massive datasets through better pre-training strategies.

Summary updated

BibTeX
@article{li2023transformer,
  author = {Zijie Li and Kazem Meidani and Amir Barati Farimani},
  title = {{Transformer for Partial Differential Equations' Operator Learning}},
  journal = {Trans. Mach. Learn. Res.},
  year = {2023},
  url = {https://openreview.net/forum?id=4ING8sSFdh},
}
Figure