NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Towards Cross Domain Generalization of Hamiltonian Representation via Meta Learning

Yeongwoo Song, Hawoong Jeong

TL;DR

Researchers have developed a framework that uses meta-learning to discover a "universal language" for Hamiltonian dynamics. By combining Graph Neural Networks (GNNs) with Model-Agnostic Meta-Learning (MAML), their model can adapt to entirely new physical systems—moving from a simple pendulum to complex chaotic magnetic mirrors—with just a few data points and minimal gradient steps.

The Challenge: Cross-Domain Generalization

Deep learning has made huge strides in physics, particularly through Hamiltonian Neural Networks (HNNs). These models are powerful because they bake "physics priors"—like the law of conservation of energy—directly into their architecture. However, they suffer from a major "silo" problem: they are highly system-specific.

If you train an HNN on a mass-spring system, it becomes an expert on springs but remains useless for predicting a pendulum or a planetary orbit. In machine learning, this is known as a lack of cross-domain generalization. Most existing "generalized" physics models only handle variations within the same system (e.g., different masses or lengths). This paper tackles the much harder challenge of learning a representation that generalizes across entirely different functional forms of physical laws.

Methodology: GNNs meet MAML

The authors propose a two-pronged approach to bridge the gap between different physical domains:

  1. Graph Neural Networks (GNNs): To handle systems with different numbers of particles or degrees of freedom, the authors represent physical states as graphs. This allows the model to accept a flexible input size, unlike standard feed-forward networks.
  2. Meta-Learning (MAML): They employ Model-Agnostic Meta-Learning. Instead of training the model to solve one specific system, the "outer loop" of the algorithm trains the model to find a parameter initialization that is "easy to update." When the model encounters a new, unseen physical system (the "inner loop"), it only needs a tiny amount of data ($K=50$ points) and a few gradient steps to adapt.

The loss function is based on the Hamiltonian gradient, which forces the network to respect the symplectic geometry of the phase space (essentially ensuring energy is conserved). They also found that using the mish activation function and a log-cosh loss provided better stability than traditional choices like tanh.

Experimental Setup & Datasets

The researchers curated a task distribution of six distinct physical systems, ranging from simple to highly complex:

  • Simple: Mass-spring and Pendulum.
  • Chaotic/Complex: Hénon-Heiles (star dynamics) and Magnetic-mirror systems.
  • Multi-body: Two-body and Three-body gravitational systems.

They generated 10,000 trajectories for each system. Crucially, they evaluated the model using a "held-out" approach—training on three types of systems and testing its ability to adapt to a fourth, entirely unseen type.

Key Insights and Ideas

  • The "Essence" of Hamiltonians: The most striking finding is that meta-learning captures the underlying structure of Hamiltonian mechanics itself, rather than just memorizing specific equations. The model learns that some conserved quantity exists and how it relates to the state's evolution.
  • Identifying Redundant Coordinates: In experiments where "surplus" coordinates were added (like tracking $y$-axis movement for a 1D spring), the meta-trained model was significantly better at "ignoring" the noise and identifying which variables actually mattered for the dynamics.
  • Representation Stability: Using Centered Kernel Alignment (CKA) analysis, the authors showed that the meta-trained model’s internal representations change very little during adaptation compared to baselines.
Representation stability measured by 1-CKA over adaptation steps.

This stability suggests the meta-learning phase successfully builds a "foundation" of physical knowledge that only needs slight "fine-tuning" for new domains.

Key Results

  • Fast Adaptation: The meta-trained model consistently outperformed both "pre-trained" (standard multi-task learning) and "randomly initialized" (scratch) models.
Relative error in coordinates and energy over adaptation steps.

As shown above, it achieved lower relative error in both predicted coordinates and energy conservation within just 50 adaptation steps.

  • Superior Accuracy in Chaos: For complex systems like the Hénon-Heiles or magnetic mirrors, the meta-trained model captured the overall qualitative behavior of the trajectories where other models failed or drifted significantly.
  • Data Efficiency: The model proved highly robust even when the "test" data for the new system was extremely sparse, showcasing the power of the learned physics prior.

Limitations and Future Directions

The authors are transparent about two main hurdles:

  1. Conservative vs. Dissipative Systems: The current framework assumes all systems are conservative (energy is constant). When tested on a damped mass-spring system (where energy is lost to friction), the model struggled because the damping term violates the fundamental Hamiltonian equations the model relies on.
  2. Scaling to Multi-Body Systems: While the model showed promise on two-body and three-body problems, the accuracy was lower than on single-particle tasks. The authors note that the training conditions (like learning rates and adaptation steps) for these high-dimensional, chaotic systems need further refinement.

By moving beyond system-specific models, this work represents a significant step toward a "Foundation Model" for physical dynamics, capable of stepping into a laboratory and learning the laws of a new experiment almost instantly.

Summary updated

BibTeX
@inproceedings{song2024towards,
  author = {Yeongwoo Song and Hawoong Jeong},
  title = {{Towards Cross Domain Generalization of Hamiltonian Representation via Meta Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=AZGIwqCyYY},
}
Figure