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

Towards Cross Domain Generalization of Hamiltonian Representation via Meta Learning

Yeongwoo Song, Hawoong Jeong · DOI

Abstract

Recent advances in deep learning for physics have focused on discovering shared representations of target systems by incorporating physics priors or inductive biases into neural networks. While effective, these methods are limited to the system domain, where the type of system remains consistent and thus cannot ensure the adaptation to new, or unseen physical systems governed by different laws. In this work, we take a significant leap forward by targeting cross domain generalization within the field of Hamiltonian dynamics. We model our system with a graph neural network (GNN) and employ a meta learning algorithm to enable the model to gain experience over a distribution of systems and make it adapt to new physics. Our approach aims to learn a unified Hamiltonian representation that is generalizable across multiple system domains, thereby overcoming the limitations of system-specific models. We demonstrate that the meta-trained model captures the generalized Hamiltonian representation that is consistent across different physical domains. Overall, through the use of meta learning, we offer a framework that achieves cross domain generalization, providing a step towards a unified model for understanding a wide array of dynamical systems via deep learning.

Introduction: The Challenge of Cross-Domain Generalization

In the burgeoning field of "AI for Physics," most models are specialists. A Hamiltonian Neural Network (HNN) might learn to simulate a pendulum perfectly, but it will fail completely if asked to simulate a mass-spring system. Even "generalized" models usually only handle variations within a single system type, such as changing the length of a pendulum.

This research addresses the challenge of cross-domain generalization, where different physical systems are governed by entirely different functional forms of Hamiltonians. The goal is to create a "foundation model" for classical mechanics that understands the underlying geometric essence of Hamiltonian dynamics—the symplectic manifold—rather than just memorizing specific equations of motion.

Methodology: GNNs and Meta-Learning

The researchers employ a two-pronged strategy to achieve this generalization:

  1. Graph Neural Networks (GNNs): Physical states are represented as graphs. Because GNNs operate on nodes and edges, they naturally handle systems with different degrees of freedom (e.g., varying numbers of particles or coordinates) without requiring structural changes to the model.
  2. Model-Agnostic Meta-Learning (MAML): Instead of training on a single system, the model is trained on a distribution of systems to find an optimal set of initial weights. These weights serve as a "generalized Hamiltonian representation" that can be adapted to a brand-new physical law in just a few gradient steps.

The model minimizes a "Hamiltonian loss" to enforce the symplectic structure of the equations of motion. Notably, the authors found that using the Mish activation function provided more stable gradients for these derivative-heavy physics losses compared to standard choices like Tanh.

Key Results: Accuracy and Adaptation

The meta-trained model consistently outperformed baselines in both accuracy and speed of adaptation. While standard HNNs (randomly initialized) struggle to learn complex systems like the Hénon-Heiles within a limited number of steps, the meta-learning approach reaches high accuracy almost immediately.

Relative error in coordinates and energy as a function of adaptation steps across four physical domains.

Qualitative analysis of the predicted trajectories confirms that the meta-trained model captures the true dynamics of unseen systems far more effectively than pre-trained or randomly initialized models. This is particularly evident in chaotic systems like the magnetic mirror, where the meta-trained model's predictions closely track the ground truth over time.

Comparison of predicted trajectories against ground truth for mass-spring (a), pendulum (b), Hénon-Heiles (c), and magnetic-mirror (d) systems.

Insights and Discussion

  • The Physics Prior in Meta-Initialization: Centered Kernel Alignment (CKA) analysis revealed that the internal representations of the meta-trained model are much closer to the "correct" physics of an unseen system than a standard pre-trained model.
  • Variable Identification: In experiments with redundant coordinates, the meta-trained model was significantly better at identifying physically meaningful variables and ignoring noise.
  • Data Efficiency: By understanding the underlying "rules" of Hamiltonian conservation, the model requires very few data points ($K=50$) to adapt to new systems.

Limitations and Future Work

The model is currently limited to conservative systems; adaptation failed when tested on dissipative systems (e.g., springs with friction) because the underlying Hamiltonian assumption was violated. Additionally, while promising, accuracy in chaotic many-body systems remains a target for future refinement. Future work will also focus on testing the framework on noisy, real-world experimental data.

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