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

Towards Cross Domain Generalization of Hamiltonian Representation via Meta Learning

Yeongwoo Song, Hawoong Jeong

TL;DR

This paper introduces a meta-learning framework using Graph Neural Networks (GNNs) to learn a unified representation of Hamiltonian dynamics that generalizes across different physical systems. By training on a distribution of diverse systems (like pendulums and mass-springs), the model can rapidly adapt to entirely new, unseen physics with minimal data, moving beyond traditional system-specific physics-informed models.

What Problem Does This Paper Address?

Deep learning has shown great promise in modeling physics, particularly through "physics-informed" architectures like Hamiltonian Neural Networks (HNNs). However, these models are typically system-specific. A model trained to predict a pendulum's motion cannot easily adapt to a mass-spring system or a chaotic two-body problem because the underlying physical laws and functional forms of their Hamiltonians differ.

The authors tackle the challenge of cross-domain generalization. They aim to move away from models that only generalize across parameters (e.g., different lengths of a pendulum) toward a unified model that understands the "essence" of Hamiltonian mechanics itself, allowing it to adapt to completely different types of physical systems even when data is sparse.

Methods

The researchers combine three powerful concepts to achieve their goal:

  1. Graph Neural Networks (GNNs): Unlike standard feed-forward networks, GNNs can handle varying degrees of freedom. This allows a single architecture to process systems with different numbers of particles or variables.
  2. Hamiltonian Priors: The model incorporates the symplectic structure of Hamiltonian mechanics. It doesn't just predict the next state; it parameterizes a scalar Hamiltonian function ($H$) and uses its gradients to predict time derivatives ($\dot{q}, \dot{p}$) according to Hamilton’s equations.
  3. Model-Agnostic Meta-Learning (MAML): This is the "learning to learn" component. Instead of training the model to be perfect at one task, MAML optimizes for a set of initial weights that can be fine-tuned to a new, unseen physical system in just a few gradient steps.

Technically, they use the Mish activation function for smoother derivatives and a log-cosh loss function to handle varying data scales across different physical domains.

Datasets

The authors constructed a task distribution comprising six distinct physical systems, ranging from simple to chaotic:

  • Mass-Spring: A basic one-particle frictionless system.
  • Pendulum: A slightly more complex periodic system.
  • Hénon-Heiles: Models the chaotic dynamics of a star around a galactic center.
  • Magnetic-Mirror: A complex "magnetic bottle" system.
  • Two-Body & Three-Body: Gravitational systems, with the latter being famously chaotic.

For evaluation, they also tested adaptation on two additional unseen systems: the 2D Harmonic Oscillator and the Kepler system.

Key Insights and Ideas

  • The Hamiltonian Manifold: The core idea is that all these diverse systems share a common underlying structure—they all live on a symplectic manifold. Meta-learning allows the network to discover this shared "Hamiltonian representation" rather than just memorizing specific equations.
  • Representation Similarity: Using Centered Kernel Alignment (CKA), the authors found that the meta-trained model's internal representations are much closer to the final "adapted" state than those of a standard pre-trained model. This suggests the meta-learning process successfully captures the fundamental structure of Hamiltonian dynamics.
  • Distinguishing Meaningful Coordinates: In systems with redundant variables (e.g., a 1D system represented in 2D space), the meta-trained model was significantly better at identifying which coordinates were physically meaningful and which were "surplus," keeping the predicted noise in unnecessary variables to a minimum.

Key Results

  • Superior Adaptation: The meta-trained model consistently outperformed both random initialization (scratch) and standard pre-training. As shown in Figure 2, it achieves lower relative error in both coordinates and energy conservation within just 50 adaptation steps.
Figure 2: The relative error across the adaptation step for the meta-trained, pre-trained, and random- initialized model at adaptation step 50 for the predicted coordinates (top) and energy (bottom). The solid line and the shaded area each represent the average and the standard error of 10 runs.
  • Robust Rollouts: When rolling out predictions over time, the meta-trained model maintained much higher accuracy and better energy conservation compared to baselines, especially for complex systems like the Hénon-Heiles or Magnetic-Mirror.
Figure 1: The relative error throughout the time rollout for the meta-trained, pre-trained, and random- initialized model at adaptation step 50 for the predicted coordinates (top) and energy (bottom). The solid line and the shaded area each represent the average and the standard error of 10 runs.
  • Internal Consistency: CKA analysis (Figure 4) confirmed that the meta-trained model requires very little internal "re-wiring" to adapt to new physics, proving it has learned a highly generalized starting point.
Figure 4: The measured CKAs in the last layer between the model before adapting (i.e. right after finishing meta-training or pre-training), and during the adaptation up to 1000 steps. The CKA values are transformed to 1-CKA to make a clearer visualization. The solid line and the shaded area each represent the average and the standard error of 10 runs.

Limitations and Future Work

  • Conservative Systems Only: The current framework relies on Hamilton's equations, which assume energy conservation. The authors noted that the model struggles to adapt to dissipative systems (like a damped oscillator) where these equations are violated.
  • Scaling to Many-Body Systems: While the model showed promise on two-body and three-body systems, the authors admit that the results were "suboptimal" and require further refinement of training conditions to handle the complexities of many-particle chaotic dynamics.
  • Integrator Sensitivity: The choice of numerical integrator (LSODA vs. symplectic integrators) impacts long-term energy conservation, a factor that could be further explored for long-duration simulations.

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