LeHami: Symplectic Latent Dynamics for World Models

Romina Yalovetzky1,*, Randall Balestriero2, Yann LeCun1,3

1Courant Institute, New York University  ·  2Brown University  ·  3AMI Labs

*Corresponding author: romina.yalovetzky@nyu.edu

The problem Joint-embedding predictive architectures (JEPAs) learn world models directly in latent space, but unconstrained autoregressive predictors may contract the latent distribution over long rollouts. This contraction is a form of collapse, and it is a problem because each prediction is fed back as the next input: even a slight per-step contraction compounds over the horizon, progressively shrinking the latent distribution until distinct states can no longer be told apart.

The method We introduce Symplectic Hamiltonian JEPA (LeHami), which replaces the standard predictor with an action-conditioned Hamiltonian flow over a structured latent state (q, p) integrated using an exactly symplectic leapfrog step. We obtain the momentum-like component from temporal derivatives of the learned position-like representation, providing an explicit second-order state for prediction and control. The idea comes from physics, where Hamiltonian mechanics governs dynamics through a single scalar H and preserves phase-space volume at every step. Machine-learning methods have since learned the Hamiltonian from data, such as Hamiltonian Neural Networks (Greydanus et al., 2019), Symplectic ODE-Net (Chen et al., 2019) and Hamiltonian Generative Networks (Toth et al., 2019). LeHami brings this prior to JEPA world models, learned end to end from pixels and integrated exactly symplectically.

The guarantee Because the leapfrog step is symplectic, this construction preserves phase-space volume at every rollout step as a consequence. This tackles the problem of collapse directly: it rules out uniform contraction, asymptotically stable fixed points, and merging of distinct latent states, independently of the learned parameters or action sequence.

The results On the conservative pendulum, LeHami preserves latent volume along the rollout, whereas LeWM (Maes et al., 2026), the unconstrained JEPA world model we compare to, contracts it steadily, losing log-volume linearly with the horizon. Consistent with this, LeHami predicts velocity better throughout and angle better at long horizons. The learned flow also supports accurate integration at unseen sub-frame step sizes and numerical time reversal. On the actuated pendulum, LeWM reaches the goal angle more often, but it captures signed velocity only when its temporal window is explicitly untied. LeHami instead captures the full state, angle and signed velocity alike, by construction, paving the way towards velocity-constrained planning and FLOP-efficient replanning. These results show how geometric structure can provide inference-time guarantees that are complementary to representation regularization in latent world models.

Contributions
  • Symplectic latent world model (LeHami): We introduce an end-to-end trainable JEPA framework equipped with a learned separable Hamiltonian predictor over a canonical latent split (q, p). We prove that its volume-preserving step eliminates three specific collapse modes during evaluation rollouts across arbitrary horizons and actions.
  • Continuous-time & time reversibility: We show that a single trained predictor Hφ acts as a continuous vector field, enabling sub-frame time integration without performance degradation and achieving numerical time-reversal with round-trip error below 10−4 % without architectural modifications.
  • Complete physics representation & principled planning: By construction rather than by architectural tuning, LeHami represents the full state through exact geometric structure. Across conservative and actuated pendulum environments, we empirically show that LeHami accurately recovers full system dynamics. This paves the way towards compute-efficient planning to goals that specify the full physical state: position and velocity.

The idea, from the intuition

Think of a pendulum. Its angle alone does not tell you what happens next: you also need how fast it is swinging. Physics bundles the two into a phase space, a position-like coordinate q and a momentum-like coordinate p, and the motion is a flow through that space generated by a single scalar H. What matters for us is not that this flow conserves something, but that it is symplectic: it preserves the oriented area spanned in each (q, p) plane, and with it phase-space volume at every step. A cloud of states can be stretched and sheared, but never squeezed. Crucially, this persists under actuation, provided the action enters the Hamiltonian.

A predictor without structure takes a latent state and evolves it to the next state. Nothing stops that network from squeezing the latent space a little at every step; over a long rollout the squeeze compounds, distinct states drift together and the information that told them apart is gone.

LeHami gives the latent space a symplectic phase-space structure directly. The encoder maps each frame to a point (q, p), and the predictor is a learned Hamiltonian Hφ(q, p, u) = Kφ(p) + Vφ(q, u), where u is the control action vector (for the pendulum, the applied torque), advanced by a leapfrog step. The action enters through the potential, so a torque literally tilts the energy landscape the state moves on.

Encoder maps pendulum frames to points on level sets of a learned Hamiltonian in the (q, p) latent space; the action tilts the potential
Frames of the actuated pendulum are encoded to points in the latent phase space. The learned flow carries them along the level sets of Hφ. The inset shows how a non-zero torque u tilts the potential Vφ(q, u).

The diagram shows how the actions move the state across levels. In the conservative case, a trajectory stays on one level set of Hφ (the grey lines). With actuation, the action ut enters the potential, so at every step the symplectic update follows the level sets of the Hamiltonian defined by the current action. The action therefore selects which level set the state moves along, and a sequence of actions carries the state from level to level, tracing the rollout (the blue curve in the upper left of the diagram). Volume preservation is a property of each step, not of a particular level, so it survives the change of level for every action sequence, provided ut is held constant within a step.

Three consequences of the structure

A blob of latent states is carried along a trajectory and changes shape but keeps its area

1 · Exact volume preservation

Symplectic integration preserves phase-space volume by construction, provably eliminating some representation collapse modes during evaluation rollouts for arbitrary action sequences.

A continuous curve through the latent space with large dots at the observed frames and small dots at quarter steps in between

2 · Continuous-time step size

Because Hφ parameterizes a continuous vector field, a single trained model can be integrated at arbitrary step sizes Δt without retraining, facilitating training on multi-frequency data and non-uniform planning grids.

A forward trajectory under actions u0 to uK-1 and a backward trajectory under uK-1 to u0 that overlap

3 · Time-reversibility

Flipping time (t → −t) and reversing the action sequence allows backward-in-time rollouts, serving as an essential primitive for computing backward reachable tubes and online safety guarantees in optimal control.

A learned energy that tracks the real one (the conservative case)

This is the special case of a conservative system, with no actuation (u = 0). Under actuation the controller does work and Hφ is no longer constant, although the step stays symplectic. In the conservative case the learned Hφ is not a physical energy: it is learned from pixels alone, with no energy supervision, so its offset and scale are arbitrary (the values below sit around −60). It is nevertheless conserved along the rollout, and the level it sits at orders the episodes the way the true energy does. Each of the four pendulums below swings with a different energy; the learned Hφ of each is almost constant over 96 rollout steps.

The relation between the two is monotone but not linear: in the bottom-right panel the points bend and scatter around the trend, and the correlation of 0.98 measures how well they follow it, not that they lie on a line. This is expected, because any increasing function of a conserved quantity is itself conserved, so Hφ is only identified up to such a reparametrization.

Four pendulums with different energies swinging, and the learned Hamiltonian staying flat for each along the rollout
LeHami on the single-rod conservative pendulum, 60 test episodes. Top: four episodes at increasing true energy. Bottom left: learned Hφ along the rollout (the grey lines are the other episodes). Bottom right: mean Hφ against true energy, one dot per episode.

Architecture

We train on unannotated trajectories of observations [x0, …, xT−1] and actions [u0, …, uT−1]. LeHami has two learned components, an encoder Encθ and a Hamiltonian flow (Ham flowφ) that replaces the predictor, joined by the zero-parameter Savitzky–Golay (SG) stencil that reads the momentum off the encoder trajectory:

Encoder + SG:  qt = Encθ(xW(t)),   pt = SG(qt−3, …, qt)
Hamiltonian flow:  (q̃t+1, p̃t+1) = Ham flowφ(qt, pt, ut)

where W(t) is a window of W+1 frames that includes xt. The flow advances the state by one step of Hamilton's equations for a learned scalar Hφ(q, p, u), and θ and φ are trained end-to-end by backpropagating through the rollout, so the encoder is shaped to produce latent states that admit this structured evolution.

dq/dt = ∂Hφ/∂p,    dp/dt = −∂Hφ/∂q
Architecture diagram: encoder and Savitzky-Golay stencil produce (q, p); the Hamiltonian flow with kinetic term K and potential V is applied K times with actions u; losses C compare predictions to encoded future frames and R regularizes the embeddings
LeHami multi-step training. Left: at the anchor, the encoder block (Enc + SG) maps a window of W+1 frames, drawn here as the causal window xt−W, …, xt, to the latent state (qt, pt). The Hamiltonian flow (Ham flow) advances it by one leapfrog step of the separable Hamiltonian Hφ = Kφ(p) + Vφ(q, u), with the action entering the potential, and is applied K times to its own outputs. Middle: each prediction (q̃t+k, p̃t+k) is scored by the prediction loss (C) against the encoding of the corresponding frames, shown here for the last step k=K. The regularizer (R) acts on the encoder's embeddings of q (blue) and p (orange). Right: the encoder block as instantiated in this work: a pixel encoder (Enc) outputs qt, and a fixed Savitzky–Golay stencil (SG) derives pt from qt−3, …, qt.

The integration. We leverage the leapfrog (Störmer–Verlet) integrator, which is second-order accurate and, crucially, exactly symplectic. For a separable Hamiltonian Hφ(q, p, u) = Kφ(S−1p) + Vφ(q, u), with S = diag(eσ), the update over a time step Δt is

p̃t+½ = pt − (Δt/2) ∇qVφ(qt, ut)
q̃t+1 = qt + Δt S−1 ∇Kφ(S−1p̃t+½)
p̃t+1 = p̃t+½ − (Δt/2) ∇qVφ(q̃t+1, ut)

where σ is learned and absorbs the relative scale of q and p, which the self-supervised objective leaves undetermined. Because S is a constant linear rescaling, the flow remains exactly symplectic.

Action-conditioned Hamiltonian. Under actuation the controller does work and Hφ is no longer constant, but symplecticity is a property of the map. We condition the potential on the action so Vφ = Vφ(q, u) and the generalized force F(q, u) = −∂Vφ/∂q is a q-gradient for every action by construction. Separability is untouched and the leapfrog stays exactly symplectic for every action sequence, provided only that ut is constant within a step.

How p is obtained. We enforce the canonical relation p = dq/dt by computing p as the temporal derivative of the generalized coordinates q via a fixed Savitzky–Golay stencil on the encoder trajectory: a least-squares quadratic fit over q that is then differentiated at time step t. The stencil is linear with constant coefficients, so it adds no learned parameters and cannot itself collapse.

Multi-step learning. We consider multi-step prediction over a K-step horizon by iteratively applying the Hamiltonian flow. The loss is the average MSE across the trajectory. Given an anchor of A time steps used to form the embedding of the first time step of the episode, and K self-fed leapfrog steps, the loss is

L = (1/K) Σj=1..K ∥q̃A+j − qA+j∥² + λp (1/K) Σj=1..K ∥p̃A+j − pA+j∥² + λS S

where the first term is the prediction loss in the position-like embedding, the second is the prediction loss in the momentum-like embedding weighted by λp, and the last term S is the regularizer, which in principle can be any (e.g., SIGReg) and acts on ground-truth embeddings, never on the rollout.

Empirical validation of LeHami

We evaluate our approach on two pendulum environments rendered as 64×64 RGB images. In the conservative pendulum there is no actuation, and episodes vary across three rod lengths. In the actuated pendulum, a recorded sequence of scalar torques (ut)t, drawn uniformly, does work on the system, so energy is no longer conserved; episodes vary across the same three rod lengths and three masses, since under actuation the mass sets the response to the torque. In both environments the true dynamics preserve phase-space volume, which is the property LeHami builds in; the actuated pendulum tests it once energy conservation no longer holds.

Frames of the conservative and actuated pendulum with the applied torque below each row
One episode of each environment. The actuated torque (bottom) is held for three frames; the conservative pendulum has ut ≡ 0.

Results

Long-horizon prediction and latent volume

On the conservative pendulum, the angle predictions of the two models are level early and LeHami pulls ahead from K ≈ 11 on. Regarding the prediction of velocity, the middle panel shows that LeHami leads by 2.8× over the first ten steps and 1.3× at the end of the horizon, that is, its velocity error is 2.8× smaller than that of the baseline LeWM (Maes et al., 2026) over the first ten rollout steps.

To assess whether LeHami avoids representation collapse over long horizons, we directly evaluate the phase-space volume contraction of the latent predictor during rollouts. The right panel tracks the normalized cumulative log-determinant across a K-step rollout, (1/n) Σi=0..K−1 log|det J(zi)|, where J(zi) denotes the Jacobian of the one-step predictor and n is the latent dimension. This quantity directly measures phase-space volume change under iterated predictions. LeHami maintains an exactly constant value of 0 (|det J(zi)| = 1 for all zi), avoiding rollout volume contraction. Conversely, LeWM exhibits a steady linear decline in cumulative log-volume, indicating continuous contraction during rollout; the same holds for the full phase-space volume of its three-embedding context.

Rollout error in angle and velocity, and cumulative log-volume, for LeHami and LeWM
LeHami LeWM. Left and middle: MAE of θ and ω over 45 test episodes (mean ± 1 s.d. over three seeds). Right: cumulative log-volume of the one-step map.

The animation below shows where this curve comes from. A single latent state cannot collapse, since it simply moves to another point; collapse means that many distinct states get merged. So at each rollout step we take a small disc of nearby latent states around the current state (dashed circle) and apply the one-step map to every point of it. Because the disc is small, the map acts on it through its Jacobian J, which turns the disc into an ellipse (filled). The axes of the ellipse are the singular values of J, and its area relative to the disc is |det J|, the product of those singular values. For LeHami, |det J| = 1: the disc is stretched in one direction and squeezed in another, but its area is preserved, so nearby states stay distinguishable. For LeWM, the smallest singular value is essentially zero, so |det J| ≈ 0 and the disc is flattened onto a line at every step, merging distinct states. The curve at the bottom accumulates log|det J| over the rollout, which is the same cumulative log-volume as in the figure above. Values are averaged over 45 test episodes.

A unit disc mapped to an ellipse of equal area by LeHami and to a flat line by LeWM, with cumulative log-volume below
The two directions drawn are the extreme ones of a 64-dimensional map for LeHami (192 for LeWM, which sees three embeddings). Bottom: cumulative log-volume, the same quantity as in the figure above.

LeHami is a world model with time re-stepping and reversal

LeHami is a world model that runs at any rate, and in either direction, because the Hamiltonian predictor Hφ is a continuous-time vector field. We showcase this capability by holding the learned Hφ fixed and integrating it at sΔt, taking 1/s sub-steps per observed frame, and compare against a Runge–Kutta integration of the true ODE from the same initial condition. Refining below the observation rate leaves the predicted trajectory invariant (left); coarsening breaks it, as an explicit symplectic integrator leaves its stability band. The same property makes the rollout reversible. The right panel shows the round-trip error of the latent state after rolling K steps forward and back with Δt → −Δt, which stays below 10−4 %.

Error at integrator steps dt, dt/2, dt/4 and 2dt, and round-trip error versus number of steps
The learned flow behaves like a continuous-time vector field, and is approximately reversible, showcased with the conservative pendulum. Left: MAE of θ integrated with step sizes never seen in training (to the ground truth from the integration of the ODE). The model is trained only at Δt = 0.1 s; halving and quartering the step (2 and 4 sub-steps per frame, respectively) traces the same trajectory, while doubling it breaks. Right: round-trip error after rolling K steps out and back by sign flip Δt → −Δt in the Hφ.
A latent trajectory run forward for 20 steps and then backward along the same path, with the pendulum state the latent corresponds to swinging out and then returning to its start
Time reversal in practice. This is a replay of the model, not of the real system. The pendulum is conservative: there are no actions (u = 0), so nothing is applied to make it go back. LeHami (EXP-067) is run 20 steps forward with +Δt (blue), then 20 steps with the same flow and the step size negated to −Δt (pink). Left: the pendulum state that the latent corresponds to, which swings out and then returns to its start. Right: the latent (q, p) retraces its own path and lands back on the starting point to a relative distance of 2×10−7.

Planning on the actuated pendulum

We plan at inference time by searching for an action sequence that brings the latent prediction at the horizon to the latent of a goal frame, using the cross-entropy method with model-predictive control. Goals are 30 steps ahead and contain a position clause, a velocity clause, or both. The budget is capped at 15 TFLOP per episode, so each model trades the cost of one solve against how often it replans.

Both models decode the rod's mass and length along the whole rollout, so differences in planning do not come from failed system identification. What differs is how velocity enters the latent:

ClauseModelSuccessTFLOPReplanning
PositionLeWM W=10.800 ± 0.01912.87R=9, 4 solves
LeWM W=3 (tied)0.633 ± 0.02013.65R=9, 4 solves
LeWM W=3 (untied)0.696 ± 0.01613.65R=9, 4 solves
LeHami0.480 ± 0.0848.05R=9, 4 solves
VelocityLeWM W=10.184 ± 0.0278.78R=15, 2 solves
LeWM W=3 (tied)0.473 ± 0.01413.65R=9, 4 solves
LeWM W=3 (untied)0.800 ± 0.05813.65R=9, 4 solves
LeHami0.527 ± 0.01910.98R=6, 5 solves
Position and velocityLeWM W=10.142 ± 0.03312.87R=9, 4 solves
LeWM W=3 (tied)0.400 ± 0.0379.31R=15, 2 solves
LeWM W=3 (untied)0.636 ± 0.02513.65R=9, 4 solves
LeHami0.304 ± 0.08810.98R=6, 5 solves

Goal-reaching success on the actuated pendulum, by clause: best success probability per model at a matched budget of at most 15 TFLOP per episode, mean ± s.d. over three model seeds. The success of a do-nothing policy (u = 0) is 0.060, 0.240 and 0.040 on the three clauses. Bold numbers mark the best model within a clause. R is the number of steps executed before replanning.

A pendulum controlled by LeHami reaching a goal state in 30 steps, with angle, velocity and torque traces
One planning episode with LeHami (EXP-079, seed 0), on a test goal where it succeeded. The green pendulum and star mark the goal at step 30. The planner re-solves every 6 steps; the faint blue line is the current plan and the teal line the torque actually applied. LeHami reached the goal on 3 of the 10 goals we ran for this animation, in line with the 0.30 in the table.

Conclusion

We introduced LeHami, a world model architecture that rigorously preserves the geometric properties of second-order physical systems. Its exact symplectic step provides structural guarantees: exact volume preservation that provably eliminates some rollout collapse modes and continuous-time integration with time-reversal. We have shown empirically on the conservative pendulum that LeHami preserves latent volume along the rollout, whereas LeWM contracts it steadily, losing log-volume linearly with the horizon. Consistent with this, LeHami predicts velocity better throughout and angle better at long horizons. With actuation, LeWM reaches the goal angle more often, but it captures signed velocity only when its temporal window is explicitly untied. LeHami instead captures the full state, angle and signed velocity alike, by construction, paving the way towards velocity-constrained planning and FLOP-efficient replanning.

Limitations and future work. First, while our latent architecture maintains exact volume preservation under actuation, strongly dissipative physical systems (e.g., heavy friction) exhibit phase-space volume contraction. Thus, extending LeHami to these regimes, e.g., via port-Hamiltonian extensions, is a natural direction for future work. Second, LeHami specifically targets velocity-aware tasks, whereas purely static pose tasks are served well by spatial-focused, unconstrained predictors. Finally, replacing our zero-overhead SG stencil with a learned momentum-like embedding offers a clear path to potentially improve performance without sacrificing long-horizon phase-space stability.

Code and reproducing the paper

The repository contains the model, training and evaluation code, the dataset generators and one script per block of the paper. Every figure and table is produced end to end by a single notebook from the frozen numbers in paper_figures/data/.

git clone https://github.com/rominay/LeHami
cd LeHami
uv sync
uv run pytest lehami/tests/
bash lehami/experiments/conservative_multi_rod.sh

github.com/rominay/LeHami · released under the Apache License 2.0.

Citation

@misc{yalovetzky2026lehami,
  title  = {LeHami: Symplectic Latent Dynamics for World Models},
  author = {Yalovetzky, Romina and Balestriero, Randall and LeCun, Yann},
  year   = {2026},
  eprint = {2610.15267},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2610.15267}
}