TL;DR
Sanchez-Gonzalez and colleagues built a learned physics simulator. It represents a scene as a graph of particles and predicts how fast each particle speeds up, using messages passed along the edges between neighbouring particles. One architecture, with a single set of hyperparameters, learned water, sand, goop, rigid boxes and their interactions, and the trained models ran on scenes far larger and longer than their training data. The result shows that a simulator can be learned from data rather than engineered for each material.
Builds on: Encoder-Decoder Architecture, Message Passing Neural Network · Leads to: Physics-Informed Neural Network (a contrasting route: learn physics from equations, not from simulated data)
Why it mattered
Physics simulators are expensive. The paper's introduction notes that building one can take years of engineering, that the best are costly to run, and that even good ones can be inaccurate when the underlying physics or its parameters are poorly known. A learned simulator that is fast and general would change how engineers and scientists run experiments.
The model made a strong case for that idea. On its 3D datasets it simulated up to about 20 thousand particles: 13 thousand for Water-3D, 20 thousand for Sand-3D and 14 thousand for Goop-3D, with trajectories of 800, 350 and 300 timesteps. Every one of these used a single architecture with a single set of hyperparameters. The paper argues that most earlier learned simulators were specialised to one task, while this one was general and simpler to implement.
Its recipe, a particle graph, learned message passing and training-time noise, is the part to carry forward from the paper. The sections below explain each part, so that you can read the paper's figures and tables with confidence.
The problem
A simulator is a rule that turns the current state of a system into the next one. Classical particle methods such as smoothed particle hydrodynamics (SPH) for fluids, position-based dynamics (PBD) for interacting and deformable bodies, and the material point method (MPM) for a wide range of materials each encode a physical model by hand. Each one is tuned to a family of materials, and they differ in how particles behave, for example whether particles compress over time.
A learned simulator replaces the hand-written rule with a neural network trained on data. The difficulty is that learned simulators tend to drift. The model is trained on true one-step transitions, so it never sees its own slightly wrong predictions as input. When you run it for hundreds of steps, its errors pile up. The paper calls this error accumulation. Together with large state spaces and complex dynamics, it is one of the difficulties the framework is built to overcome. This is why a simulator is judged not only on one-step accuracy but on whole rollouts over long horizons.
Earlier learned approaches, such as the fluid simulator DPI and the continuous-convolution method CConv, were each built for particular tasks. The paper's goal was a single model that handles every material and every interaction between them.
The paper places its work on top of two earlier lines: a graph-network model for robotic control by Sanchez-Gonzalez and colleagues in 2018, and the DPI fluid simulator by Li and colleagues in 2018. The graph machinery comes from Battaglia and colleagues' 2018 graph networks framework. The particle methods this work is measured against are older still: the paper cites SPH to a 1992 work and MPM to a 1995 work. The paper appeared in 2020, and its central move was to show that one general model, with simple training changes, could replace several specialised simulators.
How it works
Each step below follows the paper's pipeline, in the order it runs. Take a tiny scene: two particles, a fixed connectivity radius, one timestep.
- Input. Each particle has a position, its last C = 5 velocities (estimated from differences of positions), and a material label such as water, sand, goop, rigid or boundary. Velocities are not measured directly; they come from the position history.
- Graph. Connect any two particles whose distance is below the radius R. If the two particles are 0.05 apart and R = 0.1, they get an edge in each direction. Particles further apart than R do not talk directly.
- Encoder. Turn each particle's features into a node vector and each edge's relative offset into an edge vector, both of length 128, using small neural networks. The edge input is the offset between the two particles, which is the same no matter where in the scene they sit.
- Processor. Run M rounds of learned message passing. In each round, every edge updates from its two endpoints, then every node updates from the messages arriving along its edges. The paper uses M = 10 in its main model. Each round lets information travel one edge further through the particle graph.
- Decoder. Read an acceleration out of each particle's final node vector. This is the model's prediction.
- Update. Apply an Euler integrator to advance the particle: first the velocity, then the position, using the predicted acceleration. The next state is then the input to step 1 again.
flowchart LR A["Particle state: positions, past velocities, material"] --> B["Encoder: build graph with radius R"] B --> C["Processor: M rounds of message passing"] C --> D["Decoder: acceleration per particle"] D --> E["Euler update: new velocity, then new position"] E -->|"repeat for each timestep"| A
Two details matter for everything that follows. First, the model predicts accelerations rather than positions, so the physics is carried by the Euler update and the network only has to learn the forces. Second, the graph is rebuilt at each timestep from current positions during rollouts, so the set of neighbours changes as the material moves.
Worked examples
Example 1 (tiny, by hand). One particle has position 0.5, velocity 0.2 and the model predicts acceleration -0.1. Take Δt = 1.
- New velocity: 0.2 + 1 × (-0.1) = 0.1.
- New position: 0.5 + 1 × 0.1 = 0.6.
Interpretation: the model said the particle is slowing down. Its velocity fell from 0.2 to 0.1, so the particle moved less far in the next step. Had the acceleration been positive, the particle would have sped up instead.
Example 2 (standard: the relative encoder). Two particles sit at positions (0.10, 0.20) and (0.13, 0.24), and the radius is R = 0.1.
- Offset from particle 2 to particle 1: (0.10 - 0.13, 0.20 - 0.24) = (-0.03, -0.04).
- Length of the offset: √(0.03² + 0.04²) = √(0.0009 + 0.0016) = √0.0025 = 0.05.
- Edge check: 0.05 is less than 0.1, so the two particles are connected in both directions.
- Edge input: r_12 = (-0.03, -0.04, 0.05).
Interpretation: the edge input describes the pair, not where they are in the scene. Moving both particles by the same amount leaves r_12 unchanged, which is the invariance the paper wanted.
Example 3 (realistic: Water-3D). In the Water-3D dataset the connectivity radius is R = 0.035, from the paper's appendix table. Two water particles 0.05 apart are not connected. Their distance is greater than R, so the graph has no direct edge between them. Messages can reach them only through a chain of intermediate particles, each within R of the next, so the number of message-passing rounds limits how far an influence can travel.
Now the loss, for a particle whose predicted acceleration is (1.0, 0.0) and whose true acceleration is (0.5, 0.5). The difference is (0.5, -0.5) and its squared length is 0.25 + 0.25 = 0.5, so the loss for this particle is 0.5.
Try it: a second particle has predicted acceleration (0.2, -0.1) and true acceleration (0.0, -0.1). What is its squared loss, and which component of the error is responsible?
Answer: the difference is (0.2, 0.0), so the squared length is 0.2² + 0.0² = 0.04. All the error is in the first, horizontal component: the model predicted sideways acceleration where the true acceleration had none, while its vertical prediction was exactly right.
Common mistakes and tradeoffs
- "The network learns the physics equations." It does not. The network learns a function from states to accelerations, and the Euler update is fixed by hand. Nothing in the architecture forces energy or momentum to be conserved; the paper lists stronger physical knowledge, such as Hamiltonian mechanics, as a possible extension.
- "Training on one-step predictions is enough for long rollouts." It is tempting to think that a model accurate at one step will stay accurate. In fact, small one-step errors compound over hundreds of steps, because the model is fed its own errors. The paper's remedy is to corrupt the training inputs with random-walk noise, which improves rollouts even though one-step error rises a little.
- "More message passing is always better." More rounds let interactions travel further and improved both one-step and rollout error in the Goop ablation. The cost grows linearly with M, so use the smallest M that reaches the accuracy you need.
- "A bigger radius is free." A larger R gives more long-range communication and lower error, but the number of edges grows with R, and so does memory and compute.
When to use this approach: many particles, several interacting materials, and enough training trajectories from a trusted simulator. It is useful when you need to simulate quickly at high resolution.
When not to use it: when you have no reliable data to train on, or when you need guarantees such as exact conservation laws, which the architecture does not supply. Classical particle methods remain the reference in those cases.
| Choice | Benefit | Cost |
|---|---|---|
| More message-passing steps M | Longer-range interactions, lower error | Compute grows linearly with M |
| Larger connectivity radius R | More long-range communication | More edges, memory and compute |
| Unshared processor parameters | Better rollout accuracy | M times more parameters |
| Training-time noise | Robust rollouts | Slightly worse one-step error |
The math
A simulator maps a state to the next state. Write the state at step k as X^k, and let d_θ be the learned network. Then the learnable simulator is s_θ(X^k) = Update(X^k, d_θ(X^k)), where Update is the Euler step.
A learned model d_θ that maps a particle state to per-particle accelerations by encoding the particles as a graph, applying M rounds of learned message passing, and decoding each node into an acceleration.
Step 1 in symbols: the input features
The input for particle i at step k is a vector built from its position p_i, its recent velocities and its material features f_i:
Here is velocity, and it is estimated from positions as with the timestep dropped. The integer C = 5 is the number of past velocities the model sees. Because the model needs C velocities, it needs the last C + 1 positions.
Step 2 in symbols: the graph
Particles i and j get an edge when their distance is below the radius R. The edge input is the relative offset and its length:
Using the relative offset rather than absolute positions builds in invariance to where the scene sits. The paper compares this with an absolute variant and finds the relative one clearly better in its ablations.
Step 3 in symbols: the encoder
The encoder applies two multilayer perceptrons, one for nodes and one for edges:
The vectors have size 128. The symbol is a global vector. The paper's implementation has no global latent state; it appends global properties such as external forces to each node input instead.
Step 4 in symbols: the processor
The processor applies M graph network blocks, each with its own parameters in the main model:
Each block is a message-passing step, as in the Graph Neural Network lesson: edges absorb information from their endpoints, and nodes absorb information from their edges. Its cost grows linearly with M, which is why the paper advises the smallest M that still gives good accuracy.
Step 5 in symbols: decoder and Euler update
The decoder reads an acceleration from each final node vector, then the Euler integrator advances the particle with timestep Δt = 1:
The update uses the new velocity to move the position, which the paper calls semi-implicit Euler. This lets the predicted acceleration affect the next position directly.
Step 6 in symbols: the loss
Training compares the predicted acceleration with the true acceleration from the training data, one particle at a time. The loss is the squared distance between the two vectors, averaged over particles and over a mini-batch:
The model is optimised with Adam, with learning rate decaying from 10^-4 to 10^-6. Input velocities are corrupted with a small random-walk noise during training, and the target is adjusted to match. The noise is what makes the model robust to its own mistakes at rollout time, as discussed above.
Results
The main quantitative results are the one-step and rollout mean squared errors on the held-out test trajectories, reported in Table 1 of the paper. The first column is the largest number of particles in the domain, and the second is the trajectory length in timesteps.
| Domain | Particles N | Steps K | One-step MSE (×10^-9) | Rollout MSE (×10^-3) |
|---|---|---|---|---|
| Water-3D (SPH) | 13k | 800 | 8.66 | 10.1 |
| Sand-3D | 20k | 350 | 1.42 | 0.554 |
| Goop-3D | 14k | 300 | 1.32 | 0.618 |
| BoxBath (PBD) | 1k | 150 | 54.5 | 4.2 |
| WaterRamps | 2.3k | 600 | 4.91 | 11.6 |
| FluidShake | 1.3k | 2000 | 2.1 | 20.1 |
| Continuous | 4.3k | 400 | 2.06 | 1.06 |
The paper's Table 1 covers 16 datasets, and the rows above are a selection. Across all 16, one-step errors sit around 10^-9 and rollout errors range from about 0.5 to 20 times 10^-3. Errors are not comparable across datasets because each uses its own scale. The ablations on the Goop dataset (Figure 4) supply the findings on message passing, noise and encoder choice.
The qualitative claims are the ones to check against the figures. Figure 3 shows rollouts that are hard to tell apart from ground truth by eye, and the model stays plausible over thousands of rollout steps. It generalises to an inflow of water that grows the scene to 28 thousand particles, when training used 2.5 thousand, and to a domain 32 times larger in area, with 85 thousand particles and 5000 steps, against training trajectories that were 8 times shorter.
Limits. Mean squared error depends on which particle is which. The paper therefore also reports distributional metrics, optimal transport and maximum mean discrepancy, which compare distributions rather than matching particles. The head-to-head comparison with CConv covers six domains only. The paper only suggests that the approach may apply to mesh-based data such as finite-element meshes, and leaves that as future work. Training took up to a week on large systems and needed model parallelism across 16 TPU cores for the largest graphs.
Reading guide
Read the paper in this order. Each section lists the lessons that cover what it needs.
- Abstract and Section 1 (Introduction). Needs: Graph Neural Network and the idea of a simulator as an update rule.
- Section 2 (Related work). Needs: the names of the particle methods (SPH, PBD, MPM). Skim it; the sections above cover what matters.
- Section 3 (GNS model framework). Needs: Encoder-Decoder Architecture, Message Passing Neural Network, Euler Method. Read it alongside Figure 2, which shows the same pipeline as the walkthrough above.
- Section 4 (Experimental methods). Needs: Feedforward Neural Network and Rectified Linear Unit (ReLU) for the MLPs, Layer Normalization for stability, Mean Squared Error and Adam Optimizer for training, K-Nearest Neighbors for the neighbour search, and Finite Difference Method for velocity estimates.
- Section 5 (Results). Needs: Mean Squared Error for the metric and Ordinary Differential Equation for what a rollout means. Figure 4 and Table 1 are the core evidence.
- Section 6 (Conclusion) and Appendix A. Needs: the Euler update and the one-step loss from the math section above.
- Appendix B (Experimental methods and implementation). Needs: Gradient Descent for the optimiser background, and Random Walk for the noise model.
- Appendix C (Supplementary results). Needs: nothing new. It holds the detailed ablation and hyperparameter results behind Section 5.4.
Read next after this paper: Physics-Informed Neural Network, which takes the opposite route to learned physics by training on equations rather than simulated data.
Check yourself
QuestionWhy does the model predict accelerations instead of directly predicting the next position?Show answer
QuestionA pair of particles is 0.02 apart and the radius is R = 0.035. Are they connected? Compute the distance and say whether the connection would change if the radius were halved.Show answer
QuestionA learned model is trained only on true one-step transitions and then rolled out for 500 steps. Why might its error grow sharply, and what does the paper add to fix it?Show answer
QuestionApplied scenario: a team wants to simulate a granular material with a larger neighbourhood. They double the connectivity radius R and expect the cost to rise only a little. What should they expect, and what does the paper advise?Show answer
Sources
- Sanchez-Gonzalez, A., Godwin, J., Pfaff, T., Ying, R., Leskovec, J., & Battaglia, P. W. (2020). Learning to Simulate Complex Physics with Graph Networks. arXiv:2002.09405. https://arxiv.org/abs/2002.09405
- DOI: https://doi.org/10.48550/arXiv.2002.09405