MeshMask: Physics-Based Simulations with Masked Graph Neural Networks

Paul Garnier, Vincent Lannelongue, Jonathan Viquerat, Elie Hachem

TL;DR

MeshMask adapts the "masked autoencoder" revolution from Natural Language Processing and Computer Vision to the realm of physics. By hiding up to 40% of a mesh during pre-training, the model is forced to learn underlying fluid dynamics rather than just memorizing local patterns. This approach results in a staggering 60% improvement in long-term simulation accuracy and achieves state-of-the-art results on complex 3D datasets.

What Problem Does This Paper Address?

Simulating computational fluid dynamics (CFD) is notoriously expensive, often requiring hours or days of computation on supercomputers. While Graph Neural Networks (GNNs) have emerged as a fast alternative, they face two major hurdles:

  1. Error Accumulation: In long-term simulations, small errors in a single time-step snowball, eventually causing the simulation to diverge from reality or "explode."
  2. Data Hunger: Training a high-fidelity GNN typically requires massive amounts of simulation data for every new geometry or physical scenario.

The authors identify that standard GNNs often rely too heavily on their immediate neighbors. This "local-only" focus makes them fragile when predicting complex, non-linear flows over extended periods.

Methods

To overcome these limitations, the researchers introduce a pre-training strategy called MeshMask, inspired by models like BERT and Masked Autoencoders (MAE).

The MeshMask architecture demonstrating the masking process, asymmetric encoder-decoder, and W-cycle processor.
  • Masking Strategy: During pre-training, the model randomly removes a fraction of nodes (and their associated edges) from the input mesh. To ensure the model can still "see" across the resulting gaps, $K$-hop edges are used to maintain connectivity.
  • Asymmetric Architecture: The system employs a heavy Encoder to process the visible nodes and a lightweight Decoder to reconstruct the full mesh. The hidden nodes are represented by a learnable [MASKED] token before decoding.
  • Gated MLPs: Standard Multi-Layer Perceptrons in the GNN blocks are replaced with Gated MLPs. Common in modern Transformers, this architecture helps the model better gate and process complex physical features.
  • Multi-Grid Approach: The model utilizes a "W-cycle" multi-grid structure, allowing it to process information at multiple spatial scales. This is essential for capturing both large vortices and fine-grained turbulence.

Datasets

The model was rigorously evaluated on seven diverse CFD datasets:

  • Standard Benchmarks: Flow around a cylinder, a flapping flag, an airfoil, and multiple "Bezier" shapes.
  • 3D-Aneurysm (New): A challenging new dataset introduced in this paper featuring 3D simulations of blood flow in intracranial aneurysms. This represents a massive step up in complexity, with meshes exceeding 250,000 nodes and 3 million edges.
  • 2D-Aneurysm: A simplified 2D version used for rapid iteration and testing.

Key Insights and Ideas

  • The "Sweet Spot" of Masking: Unlike Computer Vision (where 75% masking is common) or NLP (15%), the authors found that a 25% to 40% node masking ratio is optimal for physics. This forces the model to "fill in the blanks" using physical principles like mass and momentum conservation without losing the underlying geometric structure.
Visual comparison of different masking ratios on a cylinder flow simulation, highlighting the optimal balance found at lower ratios compared to vision models.
  • Forcing Global Understanding: By removing local neighbors, the GNN is forced to retrieve information from distant parts of the mesh. This mimics how traditional numerical solvers propagate information across a domain.
  • Transfer Learning Works for Physics: One of the most significant findings is that pre-training on a mix of datasets (e.g., Cylinder + Bezier) makes the model a "physics generalist." When fine-tuned on a new task, this pre-trained model reaches high accuracy 33% faster and requires less data than a model trained from scratch.
  • Stability over Precision: Interestingly, masking doesn't significantly improve 1-step prediction error, but it drastically improves rollout stability. It teaches the model to be robust against the small perturbations that usually lead to simulation failure over time.

Key Results

  • SOTA Performance: MeshMask achieved State-of-the-Art results across all seven evaluated datasets.
  • 60% Accuracy Boost: Compared to previous top-tier models like MeshGraphNet, MeshMask improved long-term (all-rollout) prediction accuracy by up to 60%.
  • Scaling to 3D: The model successfully handled the 250k-node 3D Aneurysm dataset, a scale that typically causes standard GNNs to struggle with memory constraints or convergence issues.
  • Efficiency: While the Gated MLPs increase the parameter count, the inference time remains comparable to baseline models, making it highly viable for real-time engineering applications.

Limitations and Future Work

  • Parameter Count: The use of Gated MLPs and larger encoders increases the memory footprint during training, requiring more VRAM (up to 16GB for the largest models).
  • Noise Sensitivity: Finding the "perfect" amount of random noise to add during training (to simulate solver inaccuracies) remains tricky, especially in 3D environments where flow magnitudes vary wildly.
  • Future Directions: The authors suggest exploring "block masking" (removing entire contiguous chunks of the mesh) and applying this technique to other fields like structural mechanics or weather forecasting. They also aim to scale the architecture to industrial-scale meshes with millions of nodes.

Summary updated

BibTeX
@inproceedings{garnier2025meshmask,
  author = {Paul Garnier and Vincent Lannelongue and Jonathan Viquerat and Elie Hachem},
  title = {{MeshMask: Physics-Based Simulations with Masked Graph Neural Networks}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=bFHR8hNk4I},
}
Figure