Velocity-Inferred Hamiltonian Neural Networks: Learning Energy-Conserving Dynamics from Position-Only Data

Rui‐Hua Xu, Zongyu Wu, Luoyao Chen, Georgios Kementzidis, Siyao Wang, Haochun Wang, Yiwei Shi, Yuefan DengarXiv 2025 · DOI · arXiv

TL;DR

Researchers have developed Velocity-Inferred Hamiltonian Neural Networks (VI-HNN), a framework that allows models to learn energy-conserving physical dynamics using only position data. By proving that velocity can serve as a mathematical surrogate for momentum under broad conditions, the authors enable high-fidelity physics simulation in scenarios where measuring forces or impulses is impossible.

What Problem Does This Paper Address?

In the world of "physics-informed" machine learning, Hamiltonian Neural Networks (HNNs) are the gold standard for modeling systems that conserve energy (like a swinging pendulum or orbiting planets). However, HNNs have a major "data tax": they traditionally require both generalized positions ($q$) and canonical momenta ($p$) to function.

In the real world—think satellite tracking or analyzing animal movement—we rarely have sensors that measure momentum directly. We usually just have a sequence of positions over time. While we can estimate velocity from these positions, velocity isn't always the same thing as momentum (especially in complex coordinate systems). This data gap has historically made HNNs difficult to apply to "in-the-wild" datasets.

Methods

The authors introduce VI-HNN, which bridges this gap using a combination of classical mechanics and deep learning:

  1. The Invertibility Proof: The core theoretical contribution is proving that if the relationship between momentum and velocity is "invertible" (a condition met by almost all physical systems with mass), you can swap $p$ for $v$ in the Hamiltonian framework without breaking the underlying physics.
  2. Velocity Inference: Since the model only receives position data $\{q_t\}$, it uses finite-difference methods (like the mid-point rule) to estimate velocities $\{\hat{v}_t\}$.
  3. The Architecture: They train a feedforward neural network to represent the Hamiltonian $H(q, v)$.
  4. Physics-Inspired Loss: Instead of just predicting the next state, the loss function forces the network to obey Hamilton’s equations. It calculates the partial derivatives of the learned Hamiltonian with respect to $q$ and $v$ to ensure the predicted accelerations and velocities match the observed data.

Datasets

The researchers evaluated VI-HNN on four classical "benchmark" physical systems. In all cases, they generated synthetic ground-truth data but only provided the model with noisy position samples:

  • Spring-Mass Oscillator: A simple 1D system.
  • Simple Pendulum: A system where coordinates are angular.
  • Two-Body Problem: Simulating a planet orbiting a star.
  • Three-Body Problem: A notoriously complex and chaotic gravitational system.

Key Insights and Ideas

  • The "Mass Matrix" is Implicit: One of the most elegant parts of this approach is that the model doesn't need to know the masses of the objects or the specific "mass matrix" of the system. It learns the energy landscape directly in $(q, v)$ space.
  • Robustness to Numerical Noise: The authors provide a mathematical proof (Theorem 4.4) showing that small errors in the estimated velocity (from finite differences) don't blow up exponentially. The Lipschitz-bounded nature of neural networks keeps these errors contained.
  • Symplectic Preservation: Even though the model is trained on "surrogate" data, it still captures the "symplectic structure" of the system. This is why it can predict long-term trajectories without the "energy drift" (where the system artificially gains or loses energy) that plagues standard neural networks.

Key Results

The VI-HNN significantly outperformed "baseline" neural networks (which don't have the Hamiltonian constraint) across all tests:

  • Long-term Stability: In the Two-Body Problem, the baseline model's energy error reached over 1685.0, while the VI-HNN stayed at a remarkably low 1.56.
  • Trajectory Accuracy: In the Spring-Mass system, the VI-HNN's test loss was roughly 25% lower than the baseline, and it visually tracked the ground truth long after the baseline had drifted into nonsense.
  • Energy Conservation: In the Three-Body system, the baseline's energy error was nearly 160 times higher than the VI-HNN (95.7 vs 0.59).

Limitations and Future Work

While promising, the authors note several hurdles:

  • Singularities: If a system has a "singular" mass matrix (where the mapping between velocity and momentum breaks down), this method will fail.
  • The Jacobian Correction: The paper notes that a truly rigorous derivation of the velocity-based Hamiltonian requires a "Jacobian correction" in the loss function to stay perfectly symplectic, which is a target for future research.
  • High-Dimensional Scaling: The current tests are on relatively small systems (few degrees of freedom). Scaling this to "N-body" problems with dozens of interacting parts or non-canonical coordinates (like rigid-body rotations) remains an open challenge.

Summary updated

Abstract

Data-driven modeling of physical systems often relies on learning both positions and momenta to accurately capture Hamiltonian dynamics. However, in many practical scenarios, only position measurements are readily available. In this work, we introduce a method to train a standard Hamiltonian Neural Network (HNN) using only position data, enabled by a theoretical result that permits transforming the Hamiltonian $H(q,p)$ into a form $H(q, v)$. Under certain assumptions, namely, an invertible relationship between momentum and velocity, we formally prove the validity of this substitution and demonstrate how it allows us to infer momentum from position alone. We apply our approach to canonical examples including the spring-mass system, pendulum, two-body, and three-body problems. Our results show that using only position data is sufficient for stable and energy-consistent long-term predictions, suggesting a promising pathway for data-driven discovery of Hamiltonian systems when momentum measurements are unavailable.
BibTeX
@misc{xu2025velocity,
  author = {Rui‐Hua Xu and Zongyu Wu and Luoyao Chen and Georgios Kementzidis and Siyao Wang and Haochun Wang and Yiwei Shi and Yuefan Deng},
  title = {{Velocity-Inferred Hamiltonian Neural Networks: Learning Energy-Conserving Dynamics from Position-Only Data}},
  year = {2025},
  eprint = {2505.02321},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.02321},
  howpublished = {arXiv},
}
Figure