TL;DR
Predicting far into the future requires understanding repeating rhythms, yet real-world cycles slowly drift, morph, and influence one another over time. HAMSTAR borrows the math of classical physics—specifically Hamiltonian mechanics—to model how adjacent cycles in a time series "pull" on each other. The result is a tiny, noise-resistant architecture that achieves state-of-the-art long-term forecasting accuracy without letting errors snowball.
What Problem Does This Paper Address?
Long-term time series forecasting (LTSF)—predicting electricity demand, weather, or industrial sensor readings hundreds of steps ahead—relies heavily on periodicity. Daily and weekly cycles give models a reliable backbone when uncertainty accumulates over long horizons.
However, real-world rhythms aren't copy-pasted templates. A slight shift in amplitude or phase today can ripple forward, reshaping next week's cycle. Furthermore, context matters: a sharp dip in a single period might just be a random glitch, whereas the exact same dip appearing across four consecutive periods signals a genuine structural feature.
Existing models usually connect different periods using unconstrained mixing—like standard self-attention or dense linear layers. Because these operations mix everything at once without structural guardrails, they tend to tangle true cross-period shifts with random noise. Over long horizons, that noise amplifies and destabilizes predictions. The challenge is to explicitly model how periods interact while keeping representations stable.
Methods
HAMSTAR (HAMiltonian STructured period-Aligned Representation) treats periods not as raw time steps, but as interacting states governed by physics-inspired rules.
First, HAMSTAR uses standard techniques: it processes each variable independently (channel-independence) and uses a moving average to split the input into a trend branch (extrapolated via a lightweight linear projector) and a periodic branch. The periodic data is folded into blocks of length $P$ (the period length) and embedded into latent states, turning the sequence axis into a period axis.
The novel core is the Inter-Period Coupled Dynamics Module (ICDM), which uses Hamiltonian mechanics as an architectural bias:
- Split-State Representation: Each period's latent state is split in half into generalized "position" ($q$, the current state) and "momentum" ($p$, its update tendency).
- Structured Coupling: Instead of unconstrained mixing, periods interact via a learned coupling matrix constrained to be symmetric positive definite (SPD), plus a sample-adaptive rank-one tweak. Symmetry ensures reciprocal interactions between periods, while positive definiteness acts like a bowl-shaped potential energy surface—preventing representations from running away to infinity.
- Symplectic Updates: Rather than a single mixing layer, ICDM refines $q$ and $p$ iteratively using Störmer–Verlet updates—a classic numerical integrator from physics that alternates half-step momentum updates with full-step position updates. This lets the model gradually re-evaluate cross-period signals while preserving representation scale.
Finally, the refined input periods are linearly projected to future periods, unfolded, and added back to the trend forecast.
Datasets
The authors evaluate HAMSTAR on ten standard LTSF benchmarks (no new datasets are introduced), using a 720-step look-back window to predict horizons of 96, 192, 336, and 720 steps:
- Energy & Electricity: ETTh1, ETTh2, ETTm1, ETTm2 (transformer temperatures), Electricity (ECL), and Solar.
- Meteorological & Environmental: Weather, CzeLan, Temp, and PM2.5.
Key Insights and Ideas
- Physics as an architectural guardrail, not a literal simulation: Electricity grids aren't pendulums. Yet, borrowing symplectic integrators and quadratic potentials gives neural networks a mathematical guarantee: iterative state updates stay bounded and conserve "modified energy" (to within $10^{-15}$ relative error!), preventing feature explosion.
- Emergent distance-awareness: When inspecting the learned coupling matrices, HAMSTAR naturally learns to couple neighboring periods strongly while letting interactions decay smoothly with cycle lag—whereas standard linear mixing learns jagged, noisy patterns.
- Structural bias beats raw expressiveness: Replacing ICDM with heavier, more flexible Attention or MLP mixing consistently hurts accuracy. Constraining how periods talk to each other filters out transient noise, making the model remarkably calm even when test inputs are hit with massive artificial spikes.
Key Results
- Forecasting Accuracy: Across the ten benchmarks, HAMSTAR achieves the best overall MSE on every dataset group and the best MAE on almost all of them, outperforming specialized periodic models (SparseTSF, TimeBase) and heavyweights (PatchTST, iTransformer, TimeMixer).
- Compact & Fast: On the Electricity ($720 \rightarrow 720$) benchmark, HAMSTAR uses just 0.08M parameters and runs in 23.93 ms—making it over $100\times$ smaller and $4\times$ faster than PatchTST (8.69M params, 99.28 ms), and $69\times$ smaller than TimeMixer (5.58M params, 159.61 ms). While a simple linear model like DLinear is faster (11.84 ms), HAMSTAR uses $13\times$ fewer parameters than DLinear (1.04M) while cutting MSE from 0.209 to 0.200.
- Noise Robustness: When test-time spikes are injected into recent inputs, baselines like PatchTST, DLinear, and TimeBase suffer wild post-spike oscillations, while HAMSTAR smoothly tracks the true underlying rhythm.
Limitations and Future Work
- Period Length Sensitivity: Because sequences are folded into fixed blocks of length $P$, performance depends on selecting an appropriate base period length.
- Channel Independence: HAMSTAR processes each variable in isolation. Extending this structured Hamiltonian coupling to explicitly capture cross-variable dependencies is highlighted as a key next step.
Summary updated