TL;DR
When AI agents plan by imagining future steps inside a learned "world model," their predictions often blur together or drift wildly over long horizons. HaM-World fixes this by giving the model's internal imagination two upgrades: selective memory (via Mamba) to track history, and a flexible, physics-inspired "Soft-Hamiltonian" structure that keeps simulated trajectories grounded in energy-like laws without choking on real-world friction. The result is sharper planning, higher sample efficiency, and zero-shot resilience when the rules of the environment suddenly change.
What Problem Does This Paper Address?
In model-based reinforcement learning, an agent learns a compressed, internal simulation of its environment—a world model—to test out candidate actions before actually taking them. To plan $H$ steps ahead, the model feeds its own predicted state back into itself repeatedly.
If this internal "latent" state is just an unconstrained soup of numbers learned purely by statistical correlation, two things go wrong during multi-step rollouts:
- Input blindness: A single snapshot of the present isn't enough if observations are noisy, masked, or delayed. Without a crisp summary of the past, the starting point of the rollout is ambiguous.
- State contraction and drift: Repeatedly feeding an unconstrained neural network's output back into its input tends to shrink the distribution of states. Distinct future trajectories merge into a blurry, low-dimensional subspace—making candidate plans look identical—or drift outside valid regions entirely.
Why not just enforce strict laws of physics, like conservation of energy? Because real robotic control isn't a frictionless pendulum in a vacuum; it involves motors injecting energy, feet slamming into floors, friction dissipating heat, and arbitrary task rewards. The challenge is giving a planner a geometric backbone that prevents collapse while leaving room for messy, non-conservative reality.
Methods
HaM-World unifies prediction, value estimation, and Cross-Entropy Method (CEM) action search around a single, cleanly partitioned latent state $z_t = [q_t, p_t, c_t]$, paired with a recurrent history state $h_t$:
- Input-Side Selective Memory (Mamba): Instead of relying on a single frame or a standard GRU, HaM-World uses a Mamba selective state-space model to compress past observations and actions into $h_t$. Because Mamba's updates are input-dependent and maintain a fixed-size state, it filters relevant history efficiently during batched, imagined rollouts.
- Output-Side Soft-Hamiltonian Dynamics: In classical mechanics, a system's state is split into configuration ($q$, like position) and momentum ($p$), governed by a scalar energy function $H(q,p)$. Crucially, a pure Hamiltonian flow moves along energy contours—it is divergence-free, meaning it neither shrinks nor expands state-space volume to first order. HaM-World borrows this geometry for its learned $(q_t, p_t)$ coordinates, blending a learned energy field $H_\phi(q,p)$ with a data-driven residual network (via mixing weight $\alpha$) and an explicit action-control port $G_t a_t$.
- The Context Escape Hatch ($c_t$): Anything that shouldn't obey energy geometry—contact switches, friction, observation noise, task semantics—is routed into the context vector $c_t$.
While JEPA-style representation alignment, DreamerV3-style reward/value heads, and CEM planning are standard, coupling Mamba history with an explicit $q/p/c$ Soft-Hamiltonian transition directly inside the planner's loop—backed by soft alignment and action-free energy conservation losses—is the core novelty.
Datasets
Rather than static datasets, the models are trained and evaluated online from scratch (100k environment steps, state-based observations) on six continuous-control tasks from the DeepMind Control Suite (DMC):
- Core suite: Reacher Easy, Finger Spin, Cheetah Run, and Cartpole Swingup.
- Additional contact/coordination tasks: Walker Run and Hopper Hop.
- Zero-shot Out-of-Distribution (OOD) benchmark: The authors evaluate 12 zero-shot perturbations across Finger Spin and Reacher Easy, altering mass, damping, friction, and actuator strength, as well as introducing 2-step action delays and 30% observation masking at test time.
Key Insights and Ideas
- "Soft" beats "Strict" physics: Ablating the learned residual network ($\alpha=1$, forcing strict controlled Hamiltonian updates) noticeably degrades control performance. You need the Hamiltonian vector field as an inductive bias against collapse, not a straitjacket.
- Memory and geometry are a package deal: Removing memory causes performance to crater because geometric organization can't save a rollout that starts from an ambiguous state. Conversely, Mamba outperforms GRUs and Transformers here by maintaining sharp, input-selective history in a compact recurrent state suited for fast CEM search.
- Inspectable internal physics: Because the model learns an explicit scalar energy $H_\phi$, you can actually audit its imagination. In passive, zero-action rollouts on Cheetah Run, learned energy drifts by only ~1%; when actions fire, energy shifts track the mathematical projection of control onto momentum ($r = 0.757$). The world model genuinely learns that actions do "work" to push states across energy contours.
Key Results
Compared against model-free (PPO, SAC) and model-based baselines (DreamerV3, TD-MPC2):
- Sample Efficiency & Return: Across all six DMC tasks, HaM-World achieves the highest average training Area Under the Curve (AUC) of 91.9 (+10.3% over TD-MPC2, +74.1% over SAC, and +77.8% over DreamerV3), ranking 1st in final return on four tasks and 2nd on the remaining two.
- Rollout Accuracy Where It Counts: Within the actual planning horizon ($k \in \{3, 5, 7\}$), HaM-World wins 11 out of 12 latent MSE comparisons, cutting average rollout error to 1.82—just 45% of TD-MPC2's error (4.02) and 14.3% of DreamerV3's (12.77).
- Zero-Shot OOD Dominance: HaM-World achieves the highest return in all 12 OOD conditions, beating TD-MPC2's average OOD return by +10.2% on Finger Spin (excelling especially under action delay: 74.4 vs. 47.9) and +13.6% on Reacher Easy with substantially lower variance.
Limitations and Future Work
- State inputs only: All experiments use low-dimensional state vectors rather than raw camera pixels. Testing whether a visual encoder can cleanly separate pixel nuisances into $c$ while preserving canonical $(q,p)$ coordinates is left for future work.
- Horizon crossovers: While HaM-World dominates within planning horizons ($k \le 7$), its rollout error has a steeper slope than TD-MPC2's flat plateau, eventually crossing over at $k=10$ to $20$ depending on the task (though closed-loop replanning re-anchors the model every step anyway).
- Discretization and Benchmarks: The model uses simple forward Euler integration—meaning the Hamiltonian prior is only a first-order local bias rather than a true volume-preserving symplectic integrator—and has yet to be tested on complex robotic manipulation benchmarks.
Summary updated