C-PHAST: Compositional Port-Hamiltonian World Models for Structured Dynamics Transfer
Neural world models like DreamerV3 and Robotic World Model (RWM) look accurate on recorded replay, yet break the moment you cut motor power, add 50 kg of cargo, swap quadrupeds, or wire a new generator into a grid. C-PHAST learns one reusable energy law per component type and wires components through lossless power ports—so new machines and edits transfer with zero retraining.
Every frame above is rolled out directly from trained Boston Dynamics Spot checkpoints with all motors turned off mid-stride (\(u = 0\) for 3.0 s). Because C-PHAST enforces non-negative dissipation (\(R_i \succeq 0\)) and lossless ports, total energy never increases (\(\Delta H \le 0\) on 100% of starts). Without those laws, MLP (1.36 rad/s), 190× larger DreamerV3 RSSM (1.84 rad/s, 27×), and 39× larger RWM (4.54 rad/s, 67×) retain phantom motion.
2-Seed Audited Metric — Residual Leg Speed at 3.0 s (Lower = Passive)
Abstract
Predicting how a physical system behaves after a structural change, such as wiring a new generator into a power grid or reusing a leg model on another robot, is hard because the proposed configuration has no training data and testing it directly risks failure. We introduce C-PHAST, a compositional port-Hamiltonian world model that separates how components store and dissipate energy from how they interact. Repeated components share one learned local law, while power-preserving interconnections assemble them into new configurations without retraining and infer hidden starting states from partial measurement histories. For known linear systems, we establish when one component's damping drains energy from another and when an existing sensor improves estimation of a hidden state elsewhere. We also derive error margins under which predictions certify which of two proposed configurations scores better. Across microgrid reconfiguration, partial-sensing forecasting, and zero-shot quadruped transfer, C-PHAST outperforms compositional and black-box baselines. On real Boston Dynamics Spot recordings, a compact composed model matches far larger unconstrained world models on battery-cost movement selection. Probing those exact trained models without refitting exposes what trajectory replay conceals. Unconstrained baselines fit gait correlations and break under direct torque, coasting, or payload changes, whereas C-PHAST learns causal mechanics that stay passive, equivariant, and physically editable without retraining.
01 · Core Idea
Separate what a part is from how parts are wired together.
Standard world models—MLPs, GRUs, DreamerV3, or RWM—pack an entire robot or electrical grid into one monolithic neural network. That works when the machine never changes, but fails the instant you ask a structural what-if: bolt on a 50 kg payload, move a leg law onto another quadruped, or plug a fifth generator into a power grid.
1
One reusable energy law per part type
All four legs of a quadruped—or every generator in a microgrid—share a single learned energy function \(H_i(x_i)\) and positive-semidefinite damping \(R_i(x_i) \succeq 0\), so the model can never hallucinate energy out of thin air.
2
Lossless power-preserving wiring
Skew-symmetric coupling (\(\hat{u} = -\hat{C}\hat{y},\; \hat{C}^{\top} = -\hat{C}\)) guarantees interconnection power cancels identically at every junction (\(\hat{y}^{\top}\hat{u} = 0\)). Rewiring a grid or editing torso mass requires zero retraining.
3
Infer hidden states through physics
When internal currents or unobserved states are missing, C-PHAST fits the hidden starting state directly through the frozen component laws from a short sensor history before simulating candidate futures.
Assembled energy & lossless wiring:
\(H_{\mathrm{total}}(x)=\sum_i H_i(x_i)\),
\(\hat{u}=-\hat{C}\hat{y}\) with \(\hat{C}^{\top}=-\hat{C} \;\Rightarrow\; \hat{y}^{\top}\hat{u}=0\)
Changing \(\hat{C}\) rewires the joint trajectory while keeping every learned local law \((H_i, R_i)\) frozen.
Math DetailsNetwork-level stability, remote observability & certified candidate ranking (Theorems 3.2, 3.4 & Sec. 3.8)
When lossless wiring routes damping & sensing across a network
For linear port-Hamiltonian networks, Theorems 3.2 and 3.4 derive exact Gramian conditions showing when a lossless cable or mechanical joint drains disturbance energy from an undamped component to a remote damper, and when an existing voltage or pose sensor makes an unmeasured state elsewhere observable.
Joint error margins for counterfactual decisions
When two proposed actions or wiring layouts branch from the same uncertain starting state, bounding their score difference jointly preserves shared uncertainty cancellation—certifying 74/81 cross-graph rankings vs. 62/81 for separate per-candidate bounds.
02 · Real Hardware Benchmark
Matching 39×–190× larger world models on real Boston Dynamics Spot.
All five models below train strictly on real Spot onboard recordings using identical 22-D physical inputs (body wrenches, 12-D leg motor torques, 4-D foot stance flags), evaluated leave-one-bag-out across 82 held-out 20-second walks and 4,152 battery-cost selection decisions.
Click to expand
Real Spot battery pricing: Using predicted positive leg work from one shared leg law, C-PHAST achieves 90.5% near-best battery choices and 64.5 J 20-second work error—39% lower than RWM (105.8 J) and 5.6× lower than DreamerV3 RSSM (361.9 J).
Hardware provenance (Fig. 10): Spot's real onboard recordings aligned with the registered 3D lab scan. Zero simulator-trained weights enter either the benchmark table below or the 4 stress tests above.
Unified Five-Model Benchmark on Real Spot (2-Seed Means, 5 Leave-One-Bag-Out Folds)
35.5k C-PHAST vs. 1.38M RWM & 6.73M DreamerV3 RSSM
Dynamics Model
Params
Power err. (W) ↓
20 s work err. (J) ↓
Within 1% of best ↑
Extra energy ↓
Causal stress tests
Math DetailsHow C-PHAST composes the Spot quadruped Hamiltonian (1 body law + 4 shared legs + stance port)
\[H_{\mathrm{Spot}}(x) = \underbrace{\colorbox{#edf4fa}{$\displaystyle\color{#1b4f72}{H_b(x_b;\,\theta_b)}$}}_{\color{#1b4f72}{\text{one body law}}} \;+\; \underbrace{\colorbox{#edf8f5}{$\displaystyle\color{#0f766e}{\sum_{i=1}^{4} H_{\ell}(x_i;\,\theta_{\ell})}$}}_{\color{#0f766e}{\text{one leg law, four states}}}\]
Each block stores kinetic + potential energy \(H_{\alpha}(q_{\alpha},p_{\alpha}) = \tfrac{1}{2}p_{\alpha}^{\top}M_{\alpha}(q_{\alpha})^{-1}p_{\alpha} + V_{\alpha}(q_{\alpha})\) with canonical momentum \(p_{\alpha}=M_{\alpha}(q_{\alpha})v_{\alpha}\). Factorizing the 6-DOF torso (\(\sim 39\text{ kg}\)) from the four 3-DOF legs (\(\sim 0.017\text{ kg}\cdot\text{m}^2\)) avoids a \(2{,}300\times\) cross-scale solve while sharing one set of leg parameters \(\theta_{\ell}\) across all four limbs.
Figure 5 architecture: All four legs share one storage, inertia, damping, and contact-port parameter set \(\theta_{\ell}\) while evolving separate states. Solid links show body–leg coupling \(\hat{C}_{ib}\) and dashed links show leg–leg coupling \(\hat{C}_{ij}\), acting skew-symmetrically on power-conjugate velocities \(v=M(q)^{-1}p\).
With \(\hat{C}_{bi}=-\hat{C}_{ib}^{\top}\) and \(\hat{C}_{ji}=-\hat{C}_{ij}^{\top}\), internal coupling power vanishes identically (\(v_b^{\top}c_b + \sum_i v_i^{\top}c_i = 0\)), guaranteeing strict unforced passivity (\(\dot{H}_{\mathrm{Spot}} \le 0\)) and zero-refit cargo mass scaling on \(M_b\).
One parameter-shared network \(\phi\) runs identically on all four legs with hip-sign symmetry. In swing (\(s_i=0\)) it reduces identically to exact motor torque \(\tau_i\); during unforced coasting (\(\tau_i=0, s_i=0, w_b=0\)) external work is strictly zero.
Paper FiguresInspect full paper plots: 2-seed stress-test sweeps (Fig. 13) & battery breakdown (Fig. 12)
Figure 13: Full 2-seed curves and seed ranges for coasting, torque sweep, payload edit, and mirror symmetry.Figure 12: Predicted leg work cuts mean battery power error to 10.96 W (vs. 18.77 W path/arm regression).
03 · Zero-Shot Embodiment Transfer
Train on ANYmal-D. Deploy on Unitree Go2 without retraining.
What happens when a leg dynamics law trained exclusively on one quadruped (ANYmal-D) is dropped onto a completely different robot (Unitree Go2) with different mass, link lengths, and actuators? A Fixed-dim GRU fits ANYmal-D 9× tighter than C-PHAST (0.005 vs. 0.045 rad2), yet blows up 21× on Go2. C-PHAST achieves the lowest unseen-robot error at every horizon (0.073 rad2) and extends executed lateral push survival by +5.25 steps.
Click to expand
Source → target transfer (0.125× slow-mo): One shared leg law trained strictly on ANYmal-D transfers directly to Go2 with zero Go2 trajectories (0.073 vs. 0.112 Fixed-dim GRU, 0.145 Monolithic PHAST).
Click to expand
Zero-shot stability across seeds: Unconstrained shared-leg baselines (Shared-GRU, DeepSets) drift or diverge under shifted dynamics; C-PHAST stays bounded on 5/5 seeds.
Click to expand
Executed push recovery (20 scenarios): Selecting recovery commands online from 8-step C-PHAST forecasts extends survival to 121.80 steps vs. 114.65 nominal / 116.55 best fixed command.
Click to expand
Branchable futures from one state: Rolling out competing commands from a single Go2 state lets the selector pick the best-survival action on 14/20 scenarios (vs. 11/20 state-only).
Figure 8 — The Source-to-Target Crossover: Fixed-dim GRUs memorize ANYmal-D tighter (top), yet C-PHAST delivers the lowest zero-shot error on Go2 across every single horizon from 1 to 50 steps (bottom), beating persistence by more than 2× (0.073 vs. 0.152).
04 · Second Physical Domain — Power Grids
Choose where to add a new generator—without overloading the grid.
The task: Given an existing electrical microgrid, decide where to connect a new power generator (DGU) so that voltages and cable currents stay within safe operating limits across the entire network—before flipping the switch.
The catch: You only have training data from one isolated generator (never wired into this network) and can only measure station voltages, not the hidden currents inside the wires. Because electrical power (Voltage × Current) shares the exact same port-Hamiltonian conservation structure as mechanical power (Torque × Velocity), C-PHAST composes that single-generator law onto the unseen 5-station grid with zero retraining. Below, switch Generator 5 between Station 1 and Station 3: under heavy load, C-PHAST catches the 404.5 mA overload (>400 mA) that Compositional pHNN misses (395.3 mA).
Grid load condition
Plug New Generator 5 into
5-Station Microgrid Wiring
Loading…
Cable load: <320 mA safe · 320–400 mA caution · >400 mA overload
Current on Shared Cable (Station 2 ↔ 3)
Safety limit = 400.0 mA
0.00 s
True Physical Outcome
—
—
C-PHAST Forecast
—
—
Compositional pHNN
—
—
Math DetailsHow C-PHAST composes the DC microgrid Hamiltonian (n shared DGUs + m lines + incidence coupling)
Each generator (DGU) shares one learned energy law \(H_{\theta}(q_C,\phi_L) = U_{\theta}(q_C) + \tfrac{\phi_L^2}{2 M_{\theta}(q_C)}\) giving bus voltage \(v_i = \partial_{q_{C,i}} H_{\theta}\) and internal current \(i_i = \partial_{\phi_{L,i}} H_{\theta}\), while each cable stores magnetic energy \(\phi_{e,k}^2 / (2 L_{e,k})\) with line current \(i_{e,k} = \phi_{e,k} / L_{e,k}\).
Typed node–edge composition: Every generator reuses the single learned DGU energy law \(\theta\) while the graph incidence matrix \(A_{\kappa}\) wires station voltages \(v\) to cable currents \(i_e\) with zero net connection power.
Each DGU's capacitor charge receives net cable current \(\dot{q}_{\mathrm{coupling}} = A_{\kappa} i_e\) while each cable's flux is driven by the voltage drop across its endpoints \(\dot{\phi}_{e,\mathrm{coupling}} = -A_{\kappa}^{\top} v\).
\[v^{\top} A_{\kappa} i_e - i_e^{\top} A_{\kappa}^{\top} v = 0\]
Because bus power and cable power cancel identically at every junction, plugging a new generator into Station 1 vs. Station 3 changes only one column of \(A_{\kappa}\). Even when cable currents \(i_e\) are unmeasured, the coupled law recovers them from bus voltage histories alone.
Figure 7: (a) Isolated-generator training composed onto unseen 5-station grids cuts error 65–301× vs. Compositional pHNN while completing 160/160 runs. (b) Under 0.02 V voltage noise with all wire currents hidden, physics-coupled history inference cuts hidden-current error 67.6% vs. CT-SUBNET and 47–63% vs. a learned observer on identical frozen dynamics.
Open full Operator Explorer ↗
05 · Scope, Limitations & Citation
What C-PHAST assumes today—and where it goes next.
Known interconnection graph: C-PHAST assumes you know how components are wired together (e.g., URDF kinematic topology or circuit incidence matrix); discovering unknown topologies from raw pixels alone is outside current scope.
Offline Spot evaluation vs. closed-loop hardware control: Our real Boston Dynamics Spot benchmark scores held-out recorded behaviors and zero-refit counterfactual probes; deploying C-PHAST inside a live onboard MPC controller with physical payloads is an exciting next step.
Linear-network theory scope: Our exact damping-routing and observability Gramian theorems (Theorems 3.2 & 3.4) hold for known linear port-Hamiltonian networks, serving as structural motivation for our nonlinear neural components.
Citation
@article{bhardwaj2026cphast,
title = {C-PHAST: Compositional Port-Hamiltonian World Models for Structured Dynamics Transfer},
author = {Bhardwaj, Shubham and Bajaj, Chandrajit},
journal = {arXiv preprint arXiv:2612.03677},
year = {2026},
eprint = {2612.03677},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2612.03677}
}
Acknowledgements: This work was supported in part by a grant from the Peter O'Donnell Foundation, the Jim Holland–Backcountry Foundation, and in part from the Army Research Office under Cooperative Agreement Number W911NF-19-2-0333.