← All projects

Discovering Phase Space Structure in Learned Hamiltonian Systems

Yulong Yang*, Jiayin Liu*, Vineet Bansal, Christine Allen-Blanchette (* equal contribution)

NeurIPS 2026Princeton University, with Prof. Christine Allen-Blanchette

Overview

A pendulum observed through Cartesian positions or video has a simple mechanical description in terms of angles, but those coordinates are not supplied with the observations. Structured Phase Space GAN (SPS-GAN) learns a distribution of motions together with a compact latent description of their dynamics. It combines conditional generation, port-Hamiltonian latent dynamics, and cyclic-coordinate regularization to generate trajectories or videos and reveal the active coordinates underlying the observed motion.

Five plots of decoded points while sweeping one active latent direction: points move radially for the two-body system, along the orbit and radially for the three-body system, and each pendulum arm swings separately for the double pendulum
Changing one learned coordinate direction at a time reveals the structure of the motion. Decoded sweeps show interpretable mechanical variables: (a) radial distance for the two-body system; (b) orbital angle and radial scale for the three-body system; (c) the two angles of the double pendulum. Color marks position along each sweep; these are decoded states, not time sequences.

Key idea

SPS-GAN starts with more latent coordinate–momentum pairs than the system needs, then regularizes their contribution to the dynamics. Given system information \(\xi\), such as identity or physical parameters, a phase-space map transforms a random motion code \(\epsilon_m\) into an initial state \(z_0=(q_0,p_0)=f(\epsilon_m,\xi)\). A port-Hamiltonian network evolves this state, and a decoder maps the resulting trajectory to Cartesian positions or video frames. Adversarial training makes the generated sequences match the observed distribution.

SPS-GAN architecture: a motion sample and system information pass through a phase-space map to an initial state, a port-Hamiltonian neural network rolls it out, and the rollout is decoded by a trajectory generator or an image generator
A motion sample \(\epsilon_m\) and system information \(\xi\) pass through the phase-space map \(f\) to give an initial phase-space state \(z_0\). A port-Hamiltonian network conditioned on \(\xi\) (with optional input \(u\)) rolls it out to \(z_1, \dots, z_T\), which is decoded into (a) a Cartesian trajectory or (b) video frames.

The mechanical principle. A coordinate \(q_i\) is cyclic when the Hamiltonian does not depend on it. In a conservative system this makes its conjugate momentum constant: \(\dot p_i=-\partial H_\theta/\partial q_i=0\). For dissipative or forced systems, momentum can change for other reasons. SPS-GAN separates these contributions through

\[\dot q=\nabla_p H_\theta,\qquad \dot p=-\nabla_q H_\theta-D_\phi\nabla_p H_\theta+F_\psi.\]

Here \(H_\theta(z,\xi)\) is the learned Hamiltonian, \(D_\phi(\xi)\succeq0\) models dissipation, and \(F_\psi(u,\xi)\) models the effect of input \(u\). Removing these non-conservative contributions isolates the Hamiltonian dependence on each coordinate:

\[r_i=\dot p_i+[D_\phi\nabla_p H_\theta-F_\psi]_i =-\frac{\partial H_\theta}{\partial q_i},\qquad L_{\mathrm{cyclic}}=\lambda_{\mathrm{cyclic}}\sum_i|r_i|.\]

This penalty encourages sparse dependence on the learned coordinates while the adversarial objective requires the model to reproduce the motion. Separate penalties on \(D_\phi\) and \(F_\psi\) discourage unnecessary dissipation and forcing. For conservative systems, both terms are set to zero.

Results

We evaluate two linked questions: whether the learned coordinates expose the system's structure, and whether trajectories decoded from that representation follow the observed dynamics. The results below correspond to arXiv v3.

Recovering the active coordinates

The main experiments start with 10 coordinate–momentum pairs. After training, we apply principal component analysis (PCA) to the learned coordinate trajectories \(q_{0:T}\) from 4,096 sampled rollouts. The smallest number of components explaining more than 95% of the variance matches the expected active dimension in all 11 evaluated settings (Table 4).

Dimension alone does not explain what a coordinate means. In the opening figure, varying one active PCA direction while holding the others and the momenta fixed reveals radial separation, orbital angle, or pendulum angle. The same procedure applied to a model trained on real single-pendulum video changes the generated pendulum angle:

Five generated frames of a real pendulum video while sweeping the active latent direction: the pendulum bob moves steadily from left to right
The same sweep on real video: moving along the active latent direction swings the generated single pendulum through its angle.

What makes the representation compact?

On the two-body experiment, removing the cyclic-coordinate loss increases the recovered active dimension from 1 to 3 and raises trajectory MSE from \(3.07\times10^{-3}\) to \(4.40\times10^{-2}\). Removing the phase-space map or replacing the structured dynamics also worsens both measurements:

SPS-GANWithout
cyclic loss
Without
phase-space map
Dynamics replaced
by SympNet
Dynamics replaced
by GRU
Trajectory MSE ↓\(\boldsymbol{3.07\times10^{-3}}\)\(4.40\times10^{-2}\)\(4.93\times10^{-2}\)\(4.43\times10^{-3}\)\(1.60\times10^{-1}\)
Active dimension (target: 1)13723

Paper, Table 5. All variants use the same two-body evaluation setting.

Generating accurate trajectories

SPS-GAN samples a motion rather than predicting from a prescribed initial condition. For evaluation, we initialize the simulator and predictive baselines from the first generated state and compare their rollouts. Under this protocol, SPS-GAN trained per system has the lowest MSE on four of five conservative systems. A single conditional model trained jointly on all five, cSPS-GAN, remains competitive with models trained on individual systems.

Four x-y plots in which generated trajectories (solid) lie almost on top of ground-truth trajectories (dotted), from one model trained jointly on five systems
Generated trajectories (solid) and simulator rollouts (dotted) from the same initial state. Panels show single pendulum, double pendulum, two-body, and three-body motion. These examples come from cSPS-GAN, one conditional model trained jointly on five systems, including mass-spring.
Mass-springSingle pend.Double pend.Two-bodyThree-body
SPS-GAN\(6.16\times10^{-4}\)\(\boldsymbol{4.29\times10^{-4}}\)\(\boldsymbol{3.25\times10^{-2}}\)\(\boldsymbol{3.07\times10^{-3}}\)\(\boldsymbol{1.26\times10^{-3}}\)
cSPS-GAN (joint)\(9.88\times10^{-4}\)\(5.11\times10^{-4}\)\(3.33\times10^{-2}\)\(4.46\times10^{-3}\)\(2.61\times10^{-3}\)
HNN\(3.53\times10^{-4}\)\(6.27\times10^{-4}\)\(1.25\times10^{-1}\)\(3.61\times10^{-3}\)\(2.81\times10^{-3}\)
LatentODE\(\boldsymbol{1.13\times10^{-4}}\)\(9.27\times10^{-4}\)\(4.66\times10^{-2}\)\(1.98\times10^{-2}\)\(1.37\times10^{-3}\)

Trajectory MSE, lower is better. Selected rows from Table 1; bold marks the best result in the full table. HNN and LatentODE are supervised predictive baselines.

The mass-spring system is the exception: LatentODE achieves lower error. With dissipation and forcing enabled, SPS-GAN also has the lowest MSE in the damped-pendulum and forced-Duffing comparisons (Table 2).

Generating videos with consistent dynamics

On rendered videos, SPS-GAN has the lowest Fréchet Video Distance (FVD) among the compared models on all five systems. To check physical consistency separately, we extract particle centroids from generated frames and measure energy variation along the resulting trajectories:

Mass-springSingle pend.Double pend.Two-bodyThree-body
SPS-GAN25.6340.5724.1287.1289.08
HGAN45.6891.6473.21105.851981.10
HGN385.08688.12331.94830.91451.40
Energy variation from extracted trajectories (ΔE)
SPS-GAN2.33%2.89%6.83%5.96%3.47%
Simulator videos1.64%2.62%6.32%6.11%3.57%

Paper, Table 3. The first three rows report FVD (lower is better), with models trained per system. Simulator ΔE is a reference for centroid-extraction error, rather than zero.

The energy measurements are close to those obtained from simulator videos using the same extraction procedure, which provides a physical check alongside FVD.

Frames of real and generated videos of a single pendulum (left) and a double pendulum (right): SPS-GAN frames follow the real motion, HGAN frames are distorted, HGN frames collapse to a static image
Real-world video comparison: single pendulum (left), double pendulum (right). Rows show real recordings, SPS-GAN, HGAN, and HGN; columns progress through time within each system.

For real pendulum videos, SPS-GAN captures the motion, while HGN collapses to a static frame and HGAN fails to reproduce the dynamics. The single-pendulum energy measurement is 2.9% for generated videos and 2.7% for the real recordings.

Joint conditional generation also supports variation in physical and visual parameters. Across the three variation settings below, cSPS-GAN has FVDs of 135.25–182.15, below the reported HGN scores even for individual fixed-parameter systems.

Three pairs of generated frame strips of mass-spring and two-body systems with different object colors and sizes
Conditional generation of mass-spring and two-body videos with (i) physics and color varied (FVD 182.15), (ii) only physics varied (FVD 135.38), and (iii) only color varied (FVD 135.25).

Scope

SPS-GAN assumes dynamics that admit a port-Hamiltonian representation. The coordinate sweeps and PCA results provide empirical evidence of interpretable, compact representations in the evaluated systems; they do not establish unique recovery of canonical coordinates for arbitrary dynamics. The trajectory comparisons test consistency from sampled initial states, and the multi-body dimension counts refer to reduced motion families: radial two-body dynamics and an equilateral three-body configuration.