Generalizable Physics Simulation through Compositional Energy Minimization

Alexandru Oarga, Yilun DuNeurIPS 2026

TL;DR

Nature is wonderfully modular: gravity and collisions obey the same pairwise rules whether you are juggling two billiard balls or two thousand. Standard neural physics simulators fail to grasp this modularity, memorizing entire scenes at once and breaking down when the room gets crowded. This paper introduces Compositional Potential Minimization (CPM), a framework that learns individual physical interactions as additive "energy landscapes," allowing a model trained on a handful of particles to effortlessly simulate massive, unseen systems without retraining.

Figure 1: Compositional Generalizable Physics Simulation. We express physical interactions as a composition of learned energy functions. During training, these energy components are learned from small systems. At test time, these learned energies are combined without retraining to model larger systems than those seen during training. Minimizing the composed energy enables zero-shot simulation and prediction in larger systems with an arbitrary number of interacting components.

What Problem Does This Paper Address?

Humans naturally understand physics by breaking scenes into pieces: a ball, a wall, a splash of water, and the forces acting between them. Modern AI physics engines—predominantly built on Graph Neural Networks (GNNs) and feedforward architectures—take a different route. They look at a system's current state and try to predict the next state in a single, monolithic pass.

While these models look brilliant on scenarios that mirror their training data, they rely on fragile shortcuts rather than learning true, underlying physical laws. Toss extra objects into the simulation (an out-of-distribution test), and their predictions quickly devolve into unphysical chaos—trajectories bend bizarrely, fluids compress into unnatural bricks, or errors explode into infinity. How do we get neural networks to disentangle individual forces from raw observations so they can generalize like real physics engines?

Methods

Instead of directly guessing where an object goes next, the authors reframe simulation as finding the bottom of a hill. They propose Compositional Potential Minimization (CPM):

  • Pairwise Energy-Based Models (EBMs): Rather than modeling the whole scene at once, CPM learns a single, shared pairwise potential function $E_\theta(y, x_i, x_j)$ that scores a candidate future state $y$ of object $i$, given its current state $x_i$ and a neighbor's state $x_j$.
  • Additive Composition: Just as classical forces add up, the total energy landscape governing object $i$ is constructed on the fly by summing the learned potentials across all its interacting neighbors.
  • Denoising Diffusion Training: Training EBMs is notoriously tricky. Here, the authors borrow an objective from diffusion models: they corrupt ground-truth future states with Gaussian noise across $T$ noise levels and train the gradient of the summed energy landscape to point straight back toward the clean state.
  • Refined Gradient-Descent Sampling (Novelty): At test time, predicting the next state means rolling a noisy guess down the composed energy landscape. Standard Markov Chain Monte Carlo (MCMC) sampling struggles as landscapes get complex with many particles. Because CPM has the exact gradient of the energy, the authors augment standard Langevin sampling with $S$ inner steps of pure gradient descent at each noise level, locking onto crisp, accurate minima.
Figure 2: Compositional Potential Minimization (CPM). (Left) CPM models interactions acting on object i by learning a pairwise potential Eθ(y, xi, xj) for each object. The total potential P

Datasets

The authors test CPM across four synthetic simulation environments:

  • 2D Elastic Balls: 30,000 trajectories of 4 bouncing balls in a bounded box for training, evaluated out-of-distribution on 12–14 balls.
  • 2D Complex Regimes: Newly adapted 2D stress-tests featuring higher-order potentials (fluid-like smoothed particle hydrodynamics forces) and anisotropic interactions (forces dependent on object orientation and direction).
  • 3D Falling Cubes: A benchmark of three 64-particle rigid cubes stacked vertically and dropped under randomly sampled gravity, tested across varying training dataset sizes (from 200 to 5,000 trajectories).
  • BoxBath Fluid-Rigid Simulation: Generated via NVIDIA FleX, featuring 960 fluid particles sloshing against a 64-particle rigid cube. Evaluated zero-shot on much larger pools of 1,500 and 2,160 fluid particles.

Key Insights and Ideas

  • Force Disentanglement Without Force Labels: CPM is never explicitly told what a "force" or "potential" is—it only ever sees current and next states. Yet, by forcing the architecture to sum pairwise energies, it naturally disentangles individual physical interactions.
  • Zero-Shot Scaling: Because the global landscape is just a sum of identical pairwise functions, scaling from 4 balls to 14—or 960 water particles to 2,160—requires zero retraining. You simply add more terms to the sum at inference time.
  • Test-Time Compute Trades Directly for Accuracy: Running more inner gradient descent steps ($S$) actively lowers the sampled energy and steadily shrinks prediction error, letting users dial up accuracy on harder, crowded scenes.

Key Results

CPM consistently outperforms foundational and state-of-the-art GNN baselines—including Neural Physics Engine (NPE), Graph Network-based Simulators (GNS), Dynamic Particle Interaction Networks (DPI), and symmetry-aware Subequivariant GNNs (SGNN).

  • 2D Bouncing Balls: Out-of-distribution (12–14 balls), CPM cuts position Mean Squared Error (MSE) to 0.6245, beating GNS (0.9206) and nearly halving NPE's error (1.2163), while avoiding the curved-path hallucinations seen in baselines.
  • 3D Cubes & Data Efficiency: With only 200 training trajectories, CPM achieves a rollout MSE ($\times 10^{-2}$) of 0.30 at step 20, more than doubling the accuracy of the runner-up SGNN (0.72) and keeping cubes structurally intact where baselines crumble. With 5,000 samples, CPM drops error to 0.03 vs. SGNN's 0.20.
  • Fluid Scaling (BoxBath): When scaling from 960 training particles to 2,160 test particles, DPI diverges completely (unbounded error) and GNS degrades to 0.0247 MSE, failing to spread water naturally across the floor. CPM stays rock-solid at 0.0103 MSE—even slightly cleaner than its in-distribution score (0.0117).
Figure 3: Qualitative Results of 2D Simulation. We compare our method with the selected baselines in both in-distribution and out-of-distribution settings at rollout timesteps τ=20, τ=40, and τ=60. Our method produces higher-quality predictions in both settings. In-distribution, all methods produce physically consistent trajectories, with CPM achieving the closest agreement with the ground truth. NPE and GNS deteriorate in the out-of-distribution setting.

Limitations and Future Work

There is no free lunch in optimization: because CPM predicts each frame via iterative gradient descent over every interacting pair, inference is computationally expensive and slows down as particle counts grow. To speed things up, the authors suggest exploring progressive distillation (compressing many descent steps into one pass) or learning sparse interaction graphs so distant particles aren't needlessly evaluated. They also note that hierarchical, long-range interactions remain an open frontier, and envision extending CPM to robotics and control—where a goal state could simply be dropped into the sum as one more energy landscape to minimize.

Summary updated

Abstract

Learning the dynamics of interacting physical systems is a central challenge in machine learning for the physical sciences. Prevailing architectures such as Graph Neural Networks (GNNs) and feedforward models often fail to explicitly capture the compositional nature of physical laws. Instead of modeling the forces that govern a system, these networks learn to approximate aggregate state transitions. As a result, they lack a causal understanding of the underlying physical interactions, leading to poor generalization in out-of-distribution systems with varying numbers of entities or novel configurations. In this work, we introduce Compositional Potential Minimization (CPM), a framework that casts simulation as an energy minimization procedure over a composition of learned force potentials. Each force component is represented as a separate, interpretable energy landscape, and interaction dynamics emerge from their addition. Inference in CPM is framed as a global energy minimization problem over an arbitrary number of composed functions. Because CPM learns to disentangle separate forces during training, it enables seamless generalization at test time to larger-scale systems and unseen configurations through straightforward compositions of the learned energy components. Our experiments show that CPM significantly outperforms previous state-of-the-art GNN-based solutions in 2D, 3D, and particle-based simulations.
BibTeX
@inproceedings{oarga2026generalizable,
  author = {Alexandru Oarga and Yilun Du},
  title = {{Generalizable Physics Simulation through Compositional Energy Minimization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=JjtvTbTp56},
}
Figure