Most neural traffic forecasters treat a road network as a set of correlated time series. They let any sensor borrow information from any similar-looking sensor, and nothing stops the model from creating or deleting vehicles. We propose a different split. The model stores a quantity at each sensor (vehicles) and gives each road segment an inertia-like flux (a "momentum"). These evolve under a port-Hamiltonian system, which is energy-based physics extended to open systems with friction and external inputs. The wiring of that system is fixed by the road graph's signed incidence matrix. Vehicles can then only move along roads or enter and leave through learned "ports" (on-ramps, off-ramps, unobserved demand). Total mass is conserved exactly, by construction, at a cost linear in the number of nodes and edges. All the strongly periodic, sensor-local behaviour that dominates current benchmarks is pushed into the ports, where a per-node temporal model can absorb it. The physics core only has to explain how vehicles are exchanged between sensors.
The idea in two sentences: the road graph fixes who can exchange vehicles with whom through an exactly conservative, second-order (momentum-carrying) energy-based dynamics integrated in physical time. A purely local temporal model supplies how many vehicles enter or leave each node. The bet is that this division wins precisely where spatial structure matters: congestion onset, upstream-moving jams, long rollouts and missing sensors. It should do no worse elsewhere.
Core Claim
Three existing lines each supply one ingredient, and none combines them.
The first line establishes that port-Hamiltonian structure is the natural form for local, conservative interactions on discrete structures. Mesh Field Theory proves a reduction theorem: locality, permutation equivariance, invariance to edge sign flips, and energy balance force a port-Hamiltonian form. It hard-wires the topology through discrete-exterior-calculus incidence matrices and learns only local "metric" quantities. It reports energy drift of 1.3×10⁻⁴ against 25.9 for MeshGraphNets. It is, however, restricted to physical meshes, closed systems and simulation, not forecasting from partial sensors.
The second line uses Hamiltonian structure on graphs, but not in physical time. PH-DGN uses port-Hamiltonian dynamics across layer depth on static graphs. LAMP uses an antisymmetric backbone with learned damping across dynamic-graph snapshots. Both act on abstract hidden states rather than a physical stored quantity, and LAMP integrates with forward Euler.
The third line adds physical structure to traffic forecasting, but in limited form. FlowNet enforces algebraic in-minus-out conservation, but through an O(N²) allocation module with no energy or momentum. RA-BiGN derives upstream and downstream message direction from the first-order Lighthill–Whitham–Richards conservation law via a sigmoid gate on Greenshields wave speeds. It reports a 4% relative MAPE gain over STAEformer on PEMS04.
Our claim is this. Make the physical quantity the state, hard-wire its exchange through the road incidence matrix, and give edges momentum. Doing so yields exact conservation at O(|V|+|E|) cost. Upstream jam propagation then emerges from a wave equation rather than a hand-set gate. Routing the temporal signal through the ports answers the audit's objection, discussed below.
The system is the following. Let $B \in \{-1,0,1\}^{|V|\times|E|}$ be the signed incidence matrix of the sensor graph. Let $\rho \in \mathbb{R}^{|V|}$ be vehicles stored at each sensor cell, $m \in \mathbb{R}^{|E|}$ the momentum on each segment, and $u(t)\in\mathbb{R}^{|V|}$ the net external inflow at each node. The energy is $H(\rho,m)=\sum_v U_v(\rho_v)+\sum_e m_e^2/(2\mu_e(\rho))$, where $U_v$ is a learned node storage potential and $\mu_e$ a learned positive edge inertia. The dynamics are
$$\dot\rho = -B\,\frac{\partial H}{\partial m} + u(t), \qquad \dot m = B^{\top}\frac{\partial H}{\partial \rho} - R(\rho,m)\,\frac{\partial H}{\partial m},$$
where $\partial H/\partial m$ is the flux on each edge and $R \succeq 0$ is learned edge friction.
Because every column of $B$ sums to zero, $\mathbf{1}^\top\dot\rho = \mathbf{1}^\top u$. Vehicles change in total only through ports, regardless of training quality. The energy changes only through friction and ports.
Flipping an edge's sign flips the sign of $m_e$ and leaves predictions unchanged, which inherits MeshFT's orientation covariance. So we do not need the true driving direction of PeMS adjacency entries: the learned sign of the flux reveals it. Dropping $m$ and setting flux to a learned function of $\rho$ recovers a first-order, LWR-like model. That reduction gives us a built-in ablation against RA-BiGN-style physics.
Research Program
Physical core. $U_v$ and $\mu_e$ are small MLPs of local features (sensor metadata, lane count, segment length), following MeshFT's topology–metric split. $R$ is diagonal per edge and state-dependent, so the model can enter a contractive regime in free flow and a near-conservative one when waves must travel. This is LAMP's adaptive damping, but placed on a physical quantity and per segment. Following Stable Port-Hamiltonian Neural Networks, we deliberately do not constrain $U_v$ to be convex. A single global equilibrium cannot represent the free-flow/congested bistability that capacity drops imply. We accept losing their global stability guarantee in exchange for multi-stability, and retain bounded energy through friction.
Time integration. We use Strang splitting in physical 5-minute steps, as in MeshFT. The conservative part is advanced with a symplectic (leapfrog) step. The friction and port parts are advanced with an exact exponential or additive update.
Ports and state. The ports $u(t)$ come from a per-node temporal model with no spatial input. This is the analogue of TESTAM's identity expert, conditioned on that node's history and time-of-day and day-of-week. An encoder maps the input window to an initial $(\rho, m)$. Observed flow and occupancy map to $\rho$ and to observed edge fluxes through a learned per-sensor readout.
Analysis. We will characterize where dissipation is learned to be high versus low, which bears on the paper's Gap 3. We will also measure how much variance the ports absorb versus the exchange term, as a direct, interpretable measure of how spatial a dataset really is. This connects to A Critical Audit of Spatiotemporal Forecasting Benchmark Datasets and Baselines.
Data and Scope
The method needs a conserved quantity, so the primary targets are flow-and-occupancy datasets: PEMS04 and PEMS08 (and PEMS03/07 for scale). Speed-only datasets such as METR-LA and PEMS-BAY do not carry a conserved quantity, and we use them only as negative-control transfer settings.
As a controlled testbed, we will generate a synthetic network traffic dataset from a discretized second-order traffic model on real PeMS topologies. This gives ground-truth ramp inflows and exact mass totals. The 10-node DC microgrid provides a second conserved-charge network with known physics as a sanity check.
DeepBase hydrology is attractive because river baseflow is conserved along the drainage network. We include it only if a basin connectivity graph can be obtained; the file does not confirm one ships with it.
Baselines
Naive reference. The do-nothing reference is per-node persistence plus historical time-of-day average. Any model that cannot beat this at 60 minutes is not using its inputs.
Strongest temporal-first baseline. This is the audit's recipe from A Critical Audit of Spatiotemporal Forecasting Benchmark Datasets and Baselines: a well-tuned per-node SARIMA with a graph recurrent network (GCRN-GRU) trained on its residuals. The audit reports an MAE of 3.32 on METR-LA for this combination, and shows SARIMA alone beats nearly all graph models on WikiMaths. It is the most dangerous competitor because our port model plays the same role as SARIMA. We will rerun it on identical PEMS04/08 splits with the same SARIMA order search. Beating it means lower MAE on average and a clear gain on congestion-onset windows.
Strongest physics-informed traffic model. RA-BiGN is the closest physics-informed competitor. It reports a 4% relative MAPE improvement over STAEformer on PEMS04, but no absolute numbers. FlowNet is the closest conservation model; no absolute numerical result is reported in the file for PEMS04F. We find no reported absolute MAE on Lacuna for PEMS04 or PEMS08 flow for any method in the file. We therefore rerun RA-BiGN, FlowNet, LAMP, STAEformer and a DCRNN+STD-MAE pre-trained predictor (STD-MAE, which reports about 5% MAE reduction for DCRNN on PEMS04).
Fair comparison. All models use the same splits, the 12-in/12-out protocol plus a long-horizon protocol, a matched parameter budget within 2×, and an equal 40-trial hyperparameter search per model. Results are averaged over five seeds.
Ablations isolating the key ingredient. First, replace the fixed incidence wiring with an unconstrained learned message function of equal size, which removes hard conservation. Second, drop edge momentum (the first-order variant). Third, replace Strang/leapfrog with forward Euler. Fourth, close the ports, setting $u=0$ with the temporal model feeding the encoder only. Fifth, add a soft conservation penalty to the unconstrained variant instead of hard wiring.
Why not just…?
Why not just use SARIMA plus a GNN on the residuals? This is a real threat on short horizons: the audit shows temporal autocorrelation dominates these benchmarks. The residual GNN, however, has no notion of where vehicles go. Its corrections can be spatially inconsistent, and nothing ties error growth in long rollouts to a conserved quantity. Our design keeps the temporal model's strength inside the ports. The decisive test is the stratified evaluation: congestion onsets, upstream wave timing, and three-hour rollouts. If SARIMA+GCRN matches us there too, we will report that spatial physics adds nothing on PeMS.
Why not just make FlowNet sparse by restricting its allocation to graph edges? This also yields linear-cost first-order conservation, and it is essentially our no-momentum ablation. If that ablation matches the full model, the Hamiltonian ingredient (edge momentum, energy, symplectic integration) is not earning its place. The paper's contribution would then shrink to "sparse incidence-based conservation with temporal ports." We expect momentum to matter specifically for upstream shock propagation, which first-order models can only express through hand-set direction gates like RA-BiGN's α. The wave-timing metric tests exactly this.
Why not just add a symplectic integrator to LAMP? LAMP's antisymmetric backbone and damping act on abstract hidden channels, so even with a better integrator nothing is conserved in vehicle units. Its spatial reach is also tied to ODE depth. The ablation that swaps our incidence wiring for an unconstrained message function, while keeping our integrator, approximates this alternative directly.
Why not just add a soft mass-balance penalty to a strong transformer? Structure-preserving Sparse Identification of Nonlinear Dynamics shows optimizers trade such penalties for data fit and drift on extrapolation. MeshFT's 25.9 versus 1.3×10⁻⁴ drift gap points the same way. The soft-penalty ablation measures this on traffic, using conservation residuals on the synthetic network where true totals are known.
Proposed Experiments
The headline comparison is MAE, RMSE and MAPE at 15, 30 and 60 minutes on PEMS04/08. We extend this to 3-hour autoregressive rollouts, where error accumulation and energy blow-up separate structured from unstructured models.
Three stratified checks are decisive. First, error restricted to windows within 30 minutes of congestion onset, detected by an occupancy threshold. Second, upstream wave timing: the error in predicted onset lag between consecutive upstream sensors after a bottleneck forms. Third, held-out sensor reconstruction under random sensor dropout up to 90%, mirroring GMAN's robustness protocol in GMAN.
On the synthetic network, we additionally measure exact mass residuals, recovery of true ramp inflows from the learned ports, and recovery of edge direction from flux signs.
The proposal succeeds under three conditions. It must match SARIMA+GCRN on average error and beat it, RA-BiGN and FlowNet on onset windows and wave timing. Its no-momentum and unconstrained-wiring ablations must lose specifically on those strata. It must run at linear cost on PEMS07 and EXPY-TKY-scale graphs where quadratic models run out of memory.
It fails informatively if the ports absorb nearly all variance and the exchange term contributes nothing measurable. That outcome would quantify, rather than merely assert, the audit's claim that these benchmarks are not spatial.
References
- Mesh Field Theory: Port–Hamiltonian Formulation of Mesh-Based Physics
- Port-Hamiltonian Architectural Bias for Long-Range Propagation in Deep Graph Networks
- Adaptive Memory Retention in Dynamic Graphs
- FlowNet: Modeling Dynamic Spatio-Temporal Systems via Flow Propagation
- Physics-Informed Bidirectional Graph Networks for Traffic Prediction: Deriving Message Passing Direction from Traffic Flow Theory
- Stable Port-Hamiltonian Neural Networks
- A Critical Audit of Spatiotemporal Forecasting Benchmark Datasets and Baselines
- Neural Port-Hamiltonian Differential Algebraic Equations for Compositional Learning of Electrical Networks
- Spatial-Temporal-Decoupled Masked Pre-training for Spatiotemporal Forecasting
- Structure-preserving Sparse Identification of Nonlinear Dynamics for Data-driven Modeling
- GMAN: A Graph Multi-Attention Network for Traffic Prediction