FLUID-LLM: Learning Computational Fluid Dynamics with Spatiotemporal-aware Large Language Models

Max Zhu, Adrián Bazaga, Pietro LiòarXiv 2024 · DOI

Introduction

Computational Fluid Dynamics (CFD) is a cornerstone of modern engineering, critical for applications ranging from aerospace design to biomedical modeling. However, traditional numerical solvers for the Navier-Stokes equations are computationally expensive, often requiring weeks of supercomputer time. While Machine Learning (ML) surrogates like Graph Neural Networks (GNNs) offer speedups, they often struggle with long-term stability and capturing global dependencies.

FLUID-LLM addresses these challenges by adapting pre-trained Large Language Models (LLMs) to the domain of fluid physics. By treating spatial patches of fluid as "tokens" and incorporating spatiotemporal-aware encoding, the framework achieves significant error reductions—up to 48% compared to state-of-the-art GNNs—while demonstrating emergent "in-context learning" capabilities for physical simulations.

Methodology

The FLUID-LLM pipeline bridges the gap between sequence modeling and multi-dimensional physics through a multi-stage process that adapts the transformer architecture to fluid grids.

  1. Grid Projection & Patching: Irregular simulation meshes are projected onto a regular 2D grid, which is then divided into 16x16 patches, analogous to tokens in a Vision Transformer.
  2. Spatiotemporal Encoding: To preserve physical context, learned embeddings for spatial coordinates ($x, y$) and the timestep ($t$) are added to each patch embedding.
  3. LLM Core: The model leverages pre-trained LLMs (e.g., OPT-125m or OPT-2.7b) fine-tuned via Weight-Decomposed Low-Rank Adaptation (DoRA). This allows the model to inherit the pattern-recognition strengths of language models without full retraining.
  4. Hybrid Decoding: A grid-based decoder using a Graph Attention Network (GATV2Conv) processes the LLM outputs to ensure local spatial consistency and physical validity while the LLM handles high-level temporal evolution.

Experimental Evaluation

The framework was evaluated across three diverse benchmarks:

  • Cylinder Flow: Incompressible fluid around a cylinder creating vortex shedding.
  • Airfoil Flow: Compressible transonic airflows over various wing geometries.
  • Synthetic Wave Evolution: Nonlinear 2D wave equations designed to test in-context learning of physical laws.

Key Results and Insights

FLUID-LLM consistently outperformed established baselines such as MeshGraphNets and DilResNet. On the complex Airfoil dataset, the 2.7-billion parameter variant achieved a 48% lower Root Mean Squared Error (RMSE) at a 150-step horizon compared to the best baseline.

In-Context Learning for Physics

A pivotal discovery was the model's ability to perform in-context learning. By observing a short history of simulation frames, FLUID-LLM can adapt to unseen physical parameters (like Mach numbers or angles of attack) without weight updates.

RMSE decreases as the context length increases, demonstrating the model's ability to learn physical dynamics in-context.

As shown in the figure above, the prediction error (RMSE) significantly decreases as the model is provided with more context steps ($\tau_{init}$), confirming its ability to "learn" specific dynamics on the fly. This behavior mirrors how LLMs learn new linguistic tasks from a few examples in a prompt.

Scaling and Transfer Learning

The research highlights that language pre-training provides a superior initialization for physics tasks compared to random weights. Furthermore, scaling the model size from 125M to 2.7B parameters led to a 42% reduction in long-term prediction error, suggesting that larger foundation models for physics are a promising direction.

Conclusion and Future Work

FLUID-LLM demonstrates that LLMs can be powerful surrogates for complex physical systems. While currently limited by 2D grid dependencies and high VRAM requirements, it paves the way for "Foundation Models for Physics." Future work will focus on scaling these architectures to 3D turbulent flows and handling irregular engineering meshes directly to capture finer geometric details.

Summary updated

BibTeX
@misc{zhu2024fluid,
  author = {Max Zhu and Adrián Bazaga and Pietro Liò},
  title = {{FLUID-LLM: Learning Computational Fluid Dynamics with Spatiotemporal-aware Large Language Models}},
  year = {2024},
  eprint = {2406.04501},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.04501},
}
Figure