Transformer architectures have established strong baselines in time series forecasting, yet they typically rely on positional encodings that assume uniform, index-based temporal progression. However, real-world systems, from shifting financial cycles to elastic biological rhythms, frequently exhibit "time-warped" dynamics where the effective flow of time decouples from the sampling index. In this work, we first formalize this misalignment and prove that rotary position embedding (RoPE) is mathematically incapable of representing non-affine temporal warping. To address this, we propose Symplectic Positional Embeddings (SyPE), a learnable encoding framework derived from Hamiltonian mechanics. SyPE strictly generalizes RoPE by extending the rotation group $\mathrm{SO}(2)$ to the symplectic group $\mathrm{Sp}(2,\mathbb{R})$, modulated by a novel input-dependent adaptive warp module. By allowing the attention mechanism to adaptively dilate or contract temporal coordinates end-to-end, our approach captures locally varying periodicities without requiring pre-defined warping functions. We implement this mechanism in StretchTime, a multivariate forecasting architecture that achieves state-of-the-art performance on standard benchmarks, demonstrating superior robustness on datasets exhibiting non-stationary temporal dynamics.
翻译:Transformer架构已在时间序列预测领域建立了坚实的基准,但其通常依赖于假设均匀、基于索引的时间进程的位置编码。然而,从变化的金融周期到弹性的生物节律,现实世界系统频繁表现出"时间扭曲"动力学,其中时间的有效流动与采样索引解耦。在本工作中,我们首先形式化了这种错位,并证明旋转位置编码(RoPE)在数学上无法表示非仿射时间扭曲。为解决此问题,我们提出了辛位置编码(SyPE),一种源自哈密顿力学的可学习编码框架。SyPE通过将旋转群$\mathrm{SO}(2)$扩展至辛群$\mathrm{Sp}(2,\mathbb{R})$,并由新颖的输入依赖自适应扭曲模块调制,严格推广了RoPE。通过使注意力机制能够端到端地自适应扩张或收缩时间坐标,我们的方法无需预定义扭曲函数即可捕捉局部变化的周期性。我们将此机制实现在StretchTime中,这是一个多元预测架构,在标准基准测试中实现了最先进的性能,并在表现出非平稳时间动态的数据集上展示了卓越的鲁棒性。