Discovering Symbolic Laws Directly from Trajectories with Hamiltonian Graph Neural Networks

Suresh Bishnoi, Ravinder Bhattoo, Jayadeva, Sayan Ranu, N. M. Anoop Krishnan

Introduction

The discovery of physical laws has historically relied on human intuition and first-principles derivation to transform observations into mathematical equations. While modern machine learning excels at predicting the future states of complex systems, these models often function as "black boxes," providing little insight into the underlying governing principles. Furthermore, standard neural networks frequently struggle with generalization—a model trained on a small system may fail when applied to a larger one—and often violate fundamental physical constraints like energy conservation.

To bridge this gap, researchers have introduced Hamiltonian Graph Neural Networks (HGNN). This framework learns complex dynamics directly from raw trajectory data by enforcing the laws of Hamiltonian mechanics within a graph-based architecture. By applying symbolic regression to the learned representations, it is possible to extract the exact mathematical formulas that govern a system's behavior.

Methodology: Hamiltonian Graph Neural Networks

The HGNN architecture is built on two core pillars: graph representations and physics-enforced inductive biases.

Graph Representation

Physical systems are modeled as graphs where nodes represent particles and edges represent their interactions (e.g., springs, gravity, or atomic forces). This allows the model to learn local interaction rules that are independent of the total number of particles in the system, facilitating scalability.

Physics-Enforced Inductive Bias

Unlike standard Graph Neural Networks (GNNs), the HGNN is architecturally constrained to learn a Hamiltonian ($H = T + V$), where $T$ represents kinetic energy and $V$ represents potential energy. Separate Multi-Layer Perceptrons (MLPs) are used to learn these components independently. By enforcing these "hard constraints" through the model's structure rather than just a loss function, the HGNN ensures physical consistency and long-term simulation stability.

The HGNN architecture (a) processes raw node and edge features to learn energy components, which are then used to simulate diverse physical systems (b).

Experimental Evaluation

The model was evaluated across a diverse set of classical and complex physical systems, including n-pendulums, n-springs, and gravitational systems. Notably, it was tested on a Binary Lennard-Jones (LJ) Liquid, a complex 75-particle system used to model liquids and glasses. To test generalization, the researchers also used hybrid "spring-pendulum" systems with unseen topologies.

Key Results and Symbolic Recovery

The HGNN framework demonstrated exceptional performance in both predictive accuracy and interpretability.

Long-term Stability and Generalization

Because the HGNN learns local interaction rules, it exhibits zero-shot generalization. A model trained on a 5-spring system can accurately simulate a 500-spring system without additional training. Moreover, the hard physical constraints prevent the "energy drift" common in standard models, allowing for stable simulations over $10^5$ timesteps.

Symbolic Law Discovery

By analyzing the trained MLPs with symbolic regression (using PySR), the framework successfully "rediscovered" fundamental physical laws from raw data. This includes the kinetic energy formula ($0.5m|v|^2$), harmonic spring potentials, and the complex Lennard-Jones potential ($1/r^{12} - 1/r^6$).

The model achieves near-perfect accuracy in learning the potential energy (PE) of the system, a critical step for symbolic recovery.

Conclusion

Hamiltonian Graph Neural Networks represent a significant step toward automated scientific discovery. By combining the flexibility of deep learning with the rigor of classical mechanics, this framework moves beyond simple prediction toward true understanding. Future work will focus on extending the model to multi-body interactions and incorporating additional symmetries to further improve data efficiency and applicability to complex chemical systems.

Summary updated

BibTeX
@article{bishnoi2024discovering,
  author = {Suresh Bishnoi and Ravinder Bhattoo and Jayadeva and Sayan Ranu and N. M. Anoop Krishnan},
  title = {{Discovering Symbolic Laws Directly from Trajectories with Hamiltonian Graph Neural Networks}},
  journal = {Mach. Learn. Sci. Technol.},
  year = {2024},
  doi = {10.1088/2632-2153/ad6be6},
}
Figure