[Paper Review] Hamiltonian Generative Networks
This paper introduces the Hamiltonian Generative Network (HGN), a deep generative model that learns Hamiltonian dynamics from high-dimensional pixel observations without restrictive domain assumptions. By inferring latent states and unrolling dynamics via Hamiltonian equations, HGN enables reversible, smooth, and controllable trajectory generation, outperforming prior methods like HNN on physical systems and enabling a new normalising flow variant, Neural Hamiltonian Flow (NHF), for expressive density modelling with volume preservation and energy conservation.
The Hamiltonian formalism plays a central role in classical and quantum physics. Hamiltonians are the main tool for modelling the continuous time evolution of systems with conserved quantities, and they come equipped with many useful properties, like time reversibility and smooth interpolation in time. These properties are important for many machine learning problems - from sequence prediction to reinforcement learning and density modelling - but are not typically provided out of the box by standard tools such as recurrent neural networks. In this paper, we introduce the Hamiltonian Generative Network (HGN), the first approach capable of consistently learning Hamiltonian dynamics from high-dimensional observations (such as images) without restrictive domain assumptions. Once trained, we can use HGN to sample new trajectories, perform rollouts both forward and backward in time and even speed up or slow down the learned dynamics. We demonstrate how a simple modification of the network architecture turns HGN into a powerful normalising flow model, called Neural Hamiltonian Flow (NHF), that uses Hamiltonian dynamics to model expressive densities. We hope that our work serves as a first practical demonstration of the value that the Hamiltonian formalism can bring to deep learning.
Motivation & Objective
- To develop a deep learning model capable of learning Hamiltonian dynamics directly from high-dimensional observations such as images, without assuming Newtonian mechanics or restricted physical domains.
- To address the challenge of inferring abstract phase space representations from pixel-level data, enabling the modeling of complex, continuous-time dynamics.
- To demonstrate that Hamiltonian dynamics can be leveraged in machine learning for tasks including sequence generation, representation learning, and density estimation.
- To introduce Neural Hamiltonian Flow (NHF), a normalising flow model based on Hamiltonian dynamics that preserves volume and enables expressive density modeling with interpretability.
- To show that HGN can generate reversible, forward- and backward-compatible trajectories and control rollout speed via integrator time steps.
Proposed method
- HGN uses an encoder to infer the initial latent state (position and momentum) from a sequence of stacked images, mapping pixel observations to phase space.
- The model unrolls the learned Hamiltonian using a leapfrog integrator to simulate continuous-time dynamics, ensuring time reversibility and numerical stability.
- The decoder reconstructs images from the position variables only, with reconstruction loss used during training to align the latent dynamics with observed image sequences.
- The Hamiltonian is parameterized by a neural network that takes latent state variables as input and outputs the total energy, with separate heads for kinetic and potential energy components.
- A modified version of HGN becomes Neural Hamiltonian Flow (NHF), where stacked Hamiltonian flows with learned Hamiltonians act as normalising flows, preserving volume and enabling density estimation.
- The model uses a soft-uniform prior over initial states and integrates flows via leapfrog steps, with the final transformed distribution matching complex, multimodal data distributions.
Experimental results
Research questions
- RQ1Can a deep neural network learn Hamiltonian dynamics directly from high-dimensional image observations without assuming Newtonian mechanics or specific physical constraints?
- RQ2How well can the inferred Hamiltonian preserve energy and ensure time-reversible dynamics during long-horizon rollouts in complex systems?
- RQ3Can the Hamiltonian formalism be effectively adapted to serve as a foundation for expressive normalising flows in generative modeling?
- RQ4To what extent can HGN generalize across diverse physical systems, including those with non-trivial interactions like multi-body systems?
- RQ5Can the learned dynamics be manipulated at test time (e.g., speed-up, slow-down, reverse) while maintaining consistency and reconstruction fidelity?
Key findings
- HGN significantly outperforms HNN on all four tested systems—mass-spring, pendulum, two-body, and three-body—achieving test reconstruction losses of 0.02–0.05 for HGN (deterministic) versus 1.43–28.34 for HNN.
- HGN with leapfrog integration achieves a Hamiltonian variance of 0.68 on the mass-spring, 7.13 on the pendulum, 0.45 on the two-body, and 1.65 on the three-body system (scaled by 1e+4), indicating strong energy conservation.
- HGN successfully generates reversible trajectories: forward, backward, double-speed, and half-speed rollouts are consistent and visually coherent, unlike HNN, which collapses to average image reconstruction.
- Neural Hamiltonian Flow (NHF) learns multimodal densities with multiple attractors, as evidenced by learned potential energy functions with local minima aligned to data modes.
- NHF achieves performance comparable to RNVP normalising flows on a Gaussian mixture dataset, while using fewer parameters and being more computationally efficient due to Hamiltonian structure.
- The model's interpretability is enhanced by decomposing the learned Hamiltonian into kinetic and potential energy terms, revealing clear basins of attraction corresponding to data modes.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.