Papers
Topics
Authors
Recent
Search
2000 character limit reached

Hamiltonian Neural Networks

Updated 4 July 2026
  • Hamiltonian Neural Networks are neural models that learn a scalar Hamiltonian to generate dynamics using automatic differentiation and ensure energy conservation.
  • They leverage Hamilton’s equations to replace direct vector field regression, significantly enhancing long-term forecasting accuracy.
  • Extensions include separable, parameter-cognizant, symmetry-aware, and port-Hamiltonian variants, broadening application scopes from oscillators to high-dimensional systems.

Searching arXiv for the cited Hamiltonian Neural Network papers to anchor the article in the research literature. {"query":"Hamiltonian Neural Networks Greydanus (Greydanus et al., 2019) high-dimensional dynamics (Miller et al., 2020) separable Hamiltonian Neural Networks (Khoo et al., 2023) adaptable Hamiltonian neural networks (Han et al., 2021) symplectic learning (David et al., 2021) deconstructing inductive biases (Gruver et al., 2022)", "max_results": 10} Hamiltonian Neural Networks (HNNs) are neural models for dynamical systems that learn a scalar Hamiltonian and recover time evolution by differentiating that scalar through Hamilton’s equations, rather than learning the vector field directly. In canonical coordinates z=(q,p)z=(q,p), this constrains the learned dynamics to Hamiltonian form, makes the model’s continuous-time flow conserve its learned Hamiltonian, and places HNNs within the broader class of structure-preserving or “gray-box” methods in scientific machine learning (Greydanus et al., 2019, Chen et al., 2022). Since their introduction, HNNs have developed from a model for conservative mechanical systems into a broader research program that includes separable, parameter-cognizant, symmetry-aware, constrained, port-Hamiltonian, geometric reduced-order, and backpropagation-free variants (Khoo et al., 2023, Han et al., 2021, Dierkes et al., 2023, T. et al., 2024, Moradi et al., 20 Feb 2025, Aboussalah et al., 21 Jul 2025, Rahma et al., 2024).

1. Origins and research context

The modern HNN literature was catalyzed by “Hamiltonian Neural Networks” (Greydanus et al., 2019), which formulated the basic idea of representing dynamics through a learned scalar energy-like function. That paper framed HNNs as a response to a recurrent failure mode of ordinary neural dynamics models: they can fit short-term trajectories while drifting over long horizons because they have no built-in reason to preserve invariants. In the original formulation, the model “trains faster and generalizes better than a regular neural network,” and the learned flow is “perfectly reversible in time” in the continuous Hamiltonian sense (Greydanus et al., 2019).

The original empirical program combined idealized and observational settings. The paper studied an ideal mass-spring, an ideal pendulum, a real pendulum dataset, a two-body gravitational problem, and a pendulum-from-pixels setting with a latent autoencoder representation. On the two-body problem, both train and test losses were reported as about an order of magnitude lower than the baseline, and energy MSE was lower by several orders of magnitude; in the pixel pendulum experiment, the reported energy metric was 9.3×1039.3\times 10^{-3} for the baseline versus 0.15×1030.15\times 10^{-3} for the HNN (Greydanus et al., 2019).

A later methodological survey organized the expanding field along four overlapping directions: generalized Hamiltonian systems, symplectic integration, generalized input forms, and extended problem settings (Chen et al., 2022). This framing captures a central feature of the literature: HNNs are no longer a single model class but a family of neural dynamical systems that retain the core idea of learning a generator rather than directly regressing motion.

2. Canonical formulation and standard training objective

The standard HNN assumes a Hamiltonian system in canonical coordinates. With generalized coordinates qq, conjugate momenta pp, and Hamiltonian H(q,p)H(q,p), the dynamics are

q˙=Hp,p˙=Hq.\dot q = \frac{\partial H}{\partial p}, \qquad \dot p = -\frac{\partial H}{\partial q}.

In vector form, with z=(q,p)z=(q,p), one writes

z˙=JH(z),\dot z = J \nabla H(z),

where JJ is the canonical symplectic matrix (Greydanus et al., 2019, Chen et al., 2022).

An HNN replaces the unknown Hamiltonian by a neural scalar field 9.3×1039.3\times 10^{-3}0. The network does not directly output 9.3×1039.3\times 10^{-3}1; instead, the vector field is induced by automatic differentiation,

9.3×1039.3\times 10^{-3}2

Training is supervised at the level of derivatives. In the original HNN formulation, the loss is

9.3×1039.3\times 10^{-3}3

with derivatives either given analytically or approximated from trajectories by finite differences (Greydanus et al., 2019). In the high-dimensional formulation of Miller et al., the same idea is written componentwise as

9.3×1039.3\times 10^{-3}4

(Miller et al., 2020).

This construction implies a structural conservation law for the learned model. Along trajectories of the learned continuous-time system,

9.3×1039.3\times 10^{-3}5

because 9.3×1039.3\times 10^{-3}6 is antisymmetric (Greydanus et al., 2019). The result is exact conservation of the learned Hamiltonian under the model’s own continuous-time flow, not merely conservation encouraged by a penalty term. Standard neural ODE-style baselines, by contrast, learn a vector field 9.3×1039.3\times 10^{-3}7 directly and do not inherit this structure (Chen et al., 2022).

3. Inductive bias, geometric interpretation, and competing explanations

One influential explanation of HNN performance is the “map building perspective” of Miller et al. A conventional feed-forward dynamics model maps the state to the tangent space, that is, to derivative components. An HNN instead maps the state to a single scalar energy surface, and the derivatives are recovered as gradients of that surface. For the one-dimensional harmonic oscillator, the ideal HNN map is the paraboloidal surface

9.3×1039.3\times 10^{-3}8

whereas the standard network learns separate planes for derivative components (Miller et al., 2020). On this view, the burden of learning grows more slowly for HNNs because the representation is organized around a single generating function rather than many outputs.

This argument becomes stronger in higher dimensions in the same paper. On a one-dimensional linear oscillator, the HNN conserves energy within about 9.3×1039.3\times 10^{-3}9, whereas the conventional neural network loses almost 0.15×1030.15\times 10^{-3}0 energy over 0.15×1030.15\times 10^{-3}1. In higher-dimensional tests, HNN forecasting is reported as up to about 0.15×1030.15\times 10^{-3}2 times better than a matched neural baseline for linear oscillators, up to about 0.15×1030.15\times 10^{-3}3 times better for quartic oscillators, and up to about 0.15×1030.15\times 10^{-3}4 times better for a coupled bistable chain; the six-dimensional linear-oscillator error scaling is fit empirically by

0.15×1030.15\times 10^{-3}5

(Miller et al., 2020).

A different line of work disputes the usual interpretation of these gains. “Deconstructing the Inductive Biases of Hamiltonian Neural Networks” argues that, contrary to conventional wisdom, the improved generalization of HNNs is often due to modeling acceleration directly and avoiding artificial complexity from the coordinate system, rather than symplectic structure or energy conservation (Gruver et al., 2022). In that account, the practically decisive bias is second-order mechanics. The paper further reports that true-energy violation correlates strongly with rollout error, and that directly regularizing a neural ODE toward symplecticity yields little to no consistent benefit (Gruver et al., 2022).

The literature therefore contains a substantive conceptual disagreement. One strand emphasizes scalar-generator learning, symplectic structure, and conservation as the dominant source of HNN performance (Greydanus et al., 2019, Miller et al., 2020). Another argues that much of the apparent advantage comes from second-order structure and coordinate simplification, with exact Hamiltonianity being beneficial only in settings where the system and representation genuinely match the assumptions (Gruver et al., 2022). This disagreement has become a central point in the interpretation of HNNs.

4. Discrete-time learning and the role of symplectic numerics

A separate line of research argues that the numerical integrator embedded in training is not an implementation detail but part of what the model learns. “Deep Hamiltonian networks based on symplectic integrators” shows that the network target in a discretized HNet is the Hamiltonian of an inverse modified equation determined by the chosen integrator; non-symplectic integrators cannot guarantee the existence of network targets, whereas symplectic HNets possess network targets and the difference between those targets and the original Hamiltonians depends on the accuracy order of the integrator (Zhu et al., 2020). In the paper’s experiments, the trained network matches the modified Hamiltonian much more closely than the original Hamiltonian.

“Symplectic Learning for Hamiltonian Neural Networks” takes this idea further by reinterpreting the standard finite-difference HNN loss as a forward-Euler training rule. The paper argues that this inserts a non-symplectic discretization into learning and creates an artificial lower bound on the loss. It replaces the usual objective by a symplectic loss based on symplectic Euler or implicit midpoint,

0.15×1030.15\times 10^{-3}6

with 0.15×1030.15\times 10^{-3}7 chosen according to the symplectic scheme. The resulting theory guarantees the existence of an exact modified Hamiltonian 0.15×1030.15\times 10^{-3}8 that the network can learn, and derives post-training corrections that reconstruct the true Hamiltonian from discretized data up to arbitrary order. For implicit midpoint, the leading correction is

0.15×1030.15\times 10^{-3}9

(David et al., 2021).

Recent work extends this symplectic viewpoint to noisy trajectory identification for generalized non-separable systems. “Symplectic Neural Networks for learning Generalized Hamiltonians” trains an HNN through an implicit midpoint integrator, uses a symplectic adjoint for sensitivities, and applies backward-error post-processing so that the modified Hamiltonian becomes a more accurate approximation of the true Hamiltonian without requiring a more accurate discretization of the flow map (Choudhary et al., 25 Jun 2026). A plausible implication is that, for HNNs trained from sampled trajectories rather than analytic derivatives, numerical geometry and statistical learning are tightly coupled.

5. Major extensions of the HNN framework

The methodological survey of neural Hamiltonian dynamics identifies four overlapping axes of variation—generalized Hamiltonian system, symplectic integration, generalized input form, and extended problem setting—and the post-2019 literature can be read as a sequence of targeted extensions along those axes (Chen et al., 2022).

When additional structure of the Hamiltonian is known, several papers hard-code it. “Separable Hamiltonian Neural Networks” assumes additive separability,

qq0

and introduces observational, learning, and inductive biases to enforce it. Across all tested separable systems, all separable HNNs outperform vanilla HNNs on both Hamiltonian regression and vector-field regression, and the authors select HNN-OI as the best overall accuracy/time trade-off (Khoo et al., 2023). “Adaptable Hamiltonian neural networks” instead augments the input with bifurcation or control parameter channels, effectively learning qq1. In the Hénon–Heiles family, training on as few as four parameter values allows prediction across essentially the entire interval qq2, including the onset of chaos as quantified by maximum Lyapunov exponent, minimum alignment index, and chaotic fraction (Han et al., 2021).

Other work extends HNNs beyond energy learning alone. “Hamiltonian Neural Networks with Automatic Symmetry Detection” augments the model with a Lie algebra framework, learning both a Hamiltonian and infinitesimal generators qq3 satisfying approximate invariance qq4. In the pendulum-on-a-cart experiment, the symmetry diagnostic improves from qq5 for HNN to qq6 for SymHNN (Dierkes et al., 2023). “Hamiltonian-based neural networks for systems under nonholonomic constraints” moves beyond unconstrained Hamiltonian mechanics to pseudo-Hamiltonian constrained systems, using three parallel networks to learn the Hamiltonian, the constraints, and the associated multipliers (T. et al., 2024). “Port-Hamiltonian Neural Networks with Output Error Noise Models” broadens the setting further to driven, dissipative, partially observed systems with noisy outputs by replacing canonical HNN dynamics with port-Hamiltonian structure,

qq7

and identifying the latent state through SUBNET and an output-error objective (Moradi et al., 20 Feb 2025).

A further branch emphasizes geometric parameterization and training efficiency. “GeoHNNs: Geometric Hamiltonian Neural Networks” parameterizes inverse inertia on the manifold of symmetric positive-definite matrices via the affine-invariant geometry and combines this with a constrained autoencoder for symplectic latent reduction; on a high-dimensional cloth system, the constrained model achieves mean position error qq8 and mean momentum error qq9, compared with pp0 and pp1 for the unconstrained autoencoder (Aboussalah et al., 21 Jul 2025). “Training Hamiltonian neural networks without backpropagation” replaces end-to-end gradient optimization by sampled hidden features and a least-squares solve for the final linear layer, reporting CPU training more than pp2 times faster than traditional gradient-based HNN optimization and more than four orders of magnitude accuracy in chaotic examples including Hénon–Heiles (Rahma et al., 2024).

6. Applications, limitations, and current status

Applications of HNNs now span both classical benchmarks and domain-specific problems. The original paper demonstrated ideal oscillators, pendula, orbital dynamics, and latent image prediction (Greydanus et al., 2019). High-dimensional conservative forecasting was studied in oscillator families and coupled bistable chains (Miller et al., 2020). Engineering extensions include noisy input–output system identification for a nonlinear coupled mass-spring-damper system and a real cascaded-tanks benchmark, where the OE-pHNN reports test RMS pp3 on the real system (Moradi et al., 20 Feb 2025). A distinct application to rotating machinery uses the learned HNN weights themselves as features for classification on the MaFaulDa dataset, reporting AUC pp4 for binary normal-versus-abnormal classification and pp5 for a six-class problem (Shen et al., 2023).

The standard limitations of HNNs are explicit throughout the literature. Pure HNNs are best suited to conservative mechanical systems with canonical coordinates and access to states or derivatives compatible with Hamilton’s equations (Greydanus et al., 2019, Miller et al., 2020). They do not naturally model dissipation, forcing, friction, contacts, or nonholonomic constraints unless the architecture is altered (Greydanus et al., 2019, T. et al., 2024, Moradi et al., 20 Feb 2025). Extrapolation far outside the training region is poor for both HNNs and standard neural networks in the high-dimensional study of Miller et al. (Miller et al., 2020). The adaptable HNN paper further notes that full canonical state data are required and that performance degrades away from the training parameter region (Han et al., 2021).

The empirical and conceptual debate remains active. Strict Hamiltonian assumptions can be mismatched to practical control systems: on MuJoCo environments, the second-order NODE+SO model outperformed HNN-style models, and HNNs underperformed even plain NODEs on all tested environments (Gruver et al., 2022). Standard HNNs also do not automatically preserve system symmetries, which motivated the development of symmetry-aware variants (Dierkes et al., 2023). At the same time, the continued appearance of separable, parameterized, symplectic, constrained, port-Hamiltonian, and geometric HNNs suggests that the central idea remains robust: many dynamical learning problems benefit from representing motion through a scalar generator and then tailoring the surrounding inductive bias to the actual geometry, constraints, and observation model of the target system (Chen et al., 2022).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Hamiltonian Neural Networks.