Transformer-based methods have made significant progress in time series forecasting (TSF). They primarily handle two types of tokens, i.e., temporal tokens that contain all variables of the same timestamp, and variable tokens that contain all input time points for a specific variable. Transformer-based methods rely on positional encoding (PE) to mark tokens' positions, facilitating the model to perceive the correlation between tokens. However, in TSF, research on PE remains insufficient. To address this gap, we conduct experiments and uncover intriguing properties of existing PEs in TSF: (i) The positional information injected by PEs diminishes as the network depth increases; (ii) Enhancing positional information in deep networks is advantageous for improving the model's performance; (iii) PE based on the similarity between tokens can improve the model's performance. Motivated by these findings, we introduce two new PEs: Temporal Position Encoding (T-PE) for temporal tokens and Variable Positional Encoding (V-PE) for variable tokens. Both T-PE and V-PE incorporate geometric PE based on tokens' positions and semantic PE based on the similarity between tokens but using different calculations. To leverage both the PEs, we design a Transformer-based dual-branch framework named T2B-PE. It first calculates temporal tokens' correlation and variable tokens' correlation respectively and then fuses the dual-branch features through the gated unit. Extensive experiments demonstrate the superior robustness and effectiveness of T2B-PE. The code is available at: \href{https://github.com/jlu-phyComputer/T2B-PE}{https://github.com/jlu-phyComputer/T2B-PE}.
翻译:基于Transformer的方法在时间序列预测中取得了显著进展。这类方法主要处理两种类型的令牌,即包含同一时间戳所有变量的时序令牌,以及包含特定变量所有输入时间点的变量令牌。Transformer方法依赖位置编码来标记令牌的位置,从而帮助模型感知令牌间的关联性。然而,在时间序列预测中,关于位置编码的研究仍不充分。为填补这一空白,我们通过实验揭示了现有位置编码在时间序列预测中的若干奇妙性质:(i)位置编码注入的位置信息随着网络深度增加而衰减;(ii)在深层网络中增强位置信息有助于提升模型性能;(iii)基于令牌间相似性的位置编码能够改善模型性能。受这些发现启发,我们提出两种新型位置编码:面向时序令牌的时间位置编码和面向变量令牌的变量位置编码。两者均融合了基于令牌位置的几何位置编码和基于令牌间相似性的语义位置编码,但采用不同的计算方式。为充分利用这两种位置编码,我们设计了名为T2B-PE的基于Transformer的双分支框架。该框架首先分别计算时序令牌和变量令牌的关联性,然后通过门控单元融合双分支特征。大量实验证明了T2B-PE卓越的鲁棒性和有效性。代码可在\href{https://github.com/jlu-phyComputer/T2B-PE}{https://github.com/jlu-phyComputer/T2B-PE}获取。