Learning to Simulate Complex Physics with Graph Networks

Alvaro Sanchez-Gonzalez, Jonathan Godwin, Tobias Pfaff, Rex Ying, Jure Leskovec, Peter W. Battaglia

This paper, a standout from ICML 2020 by researchers at DeepMind, introduces a powerful and general-purpose framework for simulating physical systems using machine learning. By representing physical states as graphs of interacting particles, the authors demonstrate that a single neural network architecture can learn to simulate everything from splashing water to flowing sand and sticky "goop."

At its core, the paper presents Graph Network-based Simulators (GNS), a framework that uses message-passing on particle graphs to learn complex physics. It achieves state-of-the-art accuracy across diverse materials and generalizes remarkably well to systems with 34x more particles and 8x longer durations than those seen during training.

The Challenge of Physical Simulation

Traditional physics simulators—like those used in CGI, engineering, and scientific computing—are marvels of human effort. They are typically hand-coded using complex differential equations tailored to specific materials. For instance, one set of mathematics governs fluid dynamics, while entirely different equations dictate the behavior of rigid solids. Consequently, these simulators are often computationally expensive and notoriously difficult to adapt to "multi-physics" scenarios where different materials interact.

Previous attempts to use Machine Learning (ML) for simulation often struggled with two primary issues:

  1. Generality: Models were usually "overfit" to one specific type of physics (e.g., just fluids) and failed to generalize across material types.
  2. Stability: Small errors in predicting the next frame accumulate over time, eventually causing the simulation to "explode" or become highly unrealistic during long rollouts.

Graph Network-based Simulators (GNS)

The GNS framework overcomes these limitations using an "Encode-Process-Decode" architecture based on Graph Neural Networks (GNNs):

  • Encoder: The physical state is represented as a graph where each particle is a node. Edges are created between particles within a certain "connectivity radius." Crucially, the encoder uses relative positions (the distance and direction between particles) rather than absolute coordinates. This provides a strong inductive bias for spatial invariance—the underlying physics shouldn't change just because the entire experiment is shifted in space.
  • Processor: This acts as the "engine" of the model. It performs $M$ rounds of learned message-passing (typically 10 steps). This allows information about forces and constraints to propagate through the particle graph, effectively "calculating" the local dynamics and resolving complex interactions.
  • Decoder: The decoder extracts dynamics information—specifically, per-particle acceleration—from the final latent graph representation.
  • Integrator: Finally, a simple Euler integrator uses the predicted acceleration to update the particles' positions for the next timestep.

The "Secret Sauce" for Stability: To prevent the accumulation of errors over long rollouts, the authors corrupted the training data with a small amount of random-walk noise. This clever technique forces the model to learn how to "self-correct" when it encounters slightly unrealistic states, ensuring long-term stability.

Datasets and Versatility

The researchers evaluated GNS on a massive variety of 2D and 3D datasets, many of which were newly generated for this work. These included high-resolution splashing water (WATER-3D), granular material with complex friction (SAND-3D), a viscous, plastically deformable material (GOOP-3D), and a classic benchmark involving a rigid cube floating in water (BOXBATH).

Simulations of Water, Goop, and Sand over time

Unlike traditional methods that require different solvers for different materials, GNS uses the exact same hyperparameters to learn fluids, solids, and deformables. The material type is simply passed as a feature to the particles, allowing one model to rule them all.

Key Insights and Results

  • State-of-the-Art Accuracy: GNS outperformed previous leading ML simulators (like CConv and DPI) across almost all metrics.
  • Visual Fidelity: The simulations are visually indistinguishable from "ground truth" simulators to the naked eye, even over thousands of frames.
  • Zero-Shot Scaling: Because the model learns local interactions via the graph, it generalizes to much larger scenes. A model trained on only 2,500 particles can successfully simulate 85,000 particles at test time without further training.
  • Robustness: In the BOXBATH domain, GNS maintained the rigid shape of the floating box perfectly, whereas competing ML models often saw the box "melt" or deform over time.
  • Generalization: The model successfully handled "out-of-distribution" tasks, such as pouring water over complex ramps or into containers it had never seen during training.
  • The Importance of Message-Passing: Ablation studies showed that the number of message-passing steps is the biggest driver of performance. More steps allow the model to resolve long-range interactions and complex constraints, such as the incompressibility of fluids.

Limitations and Future Work

While highly effective, the GNS framework has a few limitations. First, while the neural network itself is fast, rebuilding the graph (finding nearest neighbors for every particle) at every timestep is a computational bottleneck. Second, the paper focuses entirely on mesh-free particle representations; extending this to mesh-based representations (like Finite Element Methods) is a logical next step. Finally, while GNS learns to respect physics visually, it does not strictly guarantee hard physical constraints like the conservation of energy or mass. Future work could involve baking these fundamental physical laws directly into the network architecture.

Summary updated

Abstract

Here we present a machine learning framework and model implementation that can learn to simulate a wide variety of challenging physical domains, involving fluids, rigid solids, and deformable materials interacting with one another. Our framework---which we term "Graph Network-based Simulators" (GNS)---represents the state of a physical system with particles, expressed as nodes in a graph, and computes dynamics via learned message-passing. Our results show that our model can generalize from single-timestep predictions with thousands of particles during training, to different initial conditions, thousands of timesteps, and at least an order of magnitude more particles at test time. Our model was robust to hyperparameter choices across various evaluation metrics: the main determinants of long-term performance were the number of message-passing steps, and mitigating the accumulation of error by corrupting the training data with noise. Our GNS framework advances the state-of-the-art in learned physical simulation, and holds promise for solving a wide range of complex forward and inverse problems.
BibTeX
@inproceedings{sanchezgonzalez2020learning,
  author = {Alvaro Sanchez-Gonzalez and Jonathan Godwin and Tobias Pfaff and Rex Ying and Jure Leskovec and Peter W. Battaglia},
  title = {{Learning to Simulate Complex Physics with Graph Networks}},
  booktitle = {International Conference on Machine Learning},
  year = {2020},
}
Figure