sTransformer: A Modular Approach for Extracting Inter-Sequential and Temporal Information for Time-Series Forecasting

Jiaheng Yin, Zhengxin Shi, Jianshen Zhang, Xiaomin Lin, Yulin Huang, Yongzhi Qi, Wei QiarXiv 2024 · DOI

Introduction

Long-term Time-Series Forecasting (LTSF) has traditionally been dominated by Transformer-based architectures. However, recent benchmarks, such as those presented in the "DLinear" study, have challenged this dominance by demonstrating that simple linear models can often outperform complex Transformers. The primary critique is that many Transformer variants either neglect the correlations between different variables (inter-sequential information) or rely on complex data preprocessing that hinders scalability.

The sTransformer addresses these challenges by introducing a modular architecture designed to capture both temporal dynamics and inter-variable dependencies within a unified framework. By integrating specialized convolutional modules and a novel masking mechanism, sTransformer revitalizes the Transformer's role in time-series analysis.

Methodology

The core of the sTransformer is its redesigned block, which serves as a drop-in replacement for standard Transformer layers. This block incorporates two primary innovations: the Sequence and Temporal Convolutional Network (STCN) and the Sequence-guided Mask Attention (SeqMask).

Architecture of the sTransformer block, featuring the STCN and SeqMask components.

Sequence and Temporal Convolutional Network (STCN)

The STCN replaces standard raw embeddings with a dual-path convolutional approach to extract multi-faceted features:

  • Temporal Convolution (TCN): Utilizes causal convolutions with varying dilation rates to capture multi-scale temporal patterns, such as trends and seasonal fluctuations.
  • Sequence Convolution (SCN): Focuses on extracting correlations between different variables (sequences) in the dataset, allowing the model to understand how variables influence one another.
The STCN module employs a dual-path architecture: TCN for temporal patterns and SCN for inter-variable correlations.

These paths are concatenated to provide a comprehensive representation that informs the subsequent attention mechanism about both "when" and "what" changes are occurring.

Sequence-guided Mask Attention (SeqMask)

Standard global attention can sometimes introduce noise by diluting local features with irrelevant global information. SeqMask introduces an instance-guided mask to the Value (V) layer of the attention mechanism. This allows for more selective interaction between feature embeddings and global context, refining the representation before it enters the multi-head attention stage.

Experimental Evaluation

The sTransformer was evaluated across a diverse set of tasks and datasets, including long-term forecasting (ETT, Electricity, Traffic, Weather, Solar-Energy), short-term forecasting (M4), and anomaly detection (SMD, MSL, SWaT, PSM).

Key Results

The sTransformer achieved state-of-the-art (SOTA) performance in long-term forecasting, surpassing established models like iTransformer and PatchTST in average MSE and MAE metrics. Notably, on the ETTh2 and Weather datasets, it consistently outperformed competitors across all prediction horizons (96 to 720 steps).

In anomaly detection, the model secured the second-best average F1-score, demonstrating that its feature extraction capabilities are robust and generalize well beyond pure forecasting tasks. Ablation studies confirmed that the STCN module is the most critical component; its removal led to a significant degradation in performance.

Discussion and Conclusion

The success of sTransformer underscores the importance of explicitly modeling inter-sequential data. By incorporating the SCN, the architecture captures multivariate correlations that linear models often overlook. Furthermore, its modular design ensures that improvements are contained within the block, maintaining scalability and ease of integration.

While highly effective, the SeqMask module showed variable utility across different datasets. In some instances, such as the Electricity dataset, standard full attention performed slightly better, suggesting that the optimal masking strategy may depend on the specific temporal structure of the data. Future research will explore adaptive mechanisms to dynamically select the most appropriate attention configuration based on input characteristics.

Overall, sTransformer demonstrates that with the right modular enhancements—specifically combining convolutions for local/inter-variable context with attention for global dependencies—Transformers remain a powerful and versatile tool for time-series analysis.

Summary updated

BibTeX
@misc{yin2024stransformer,
  author = {Jiaheng Yin and Zhengxin Shi and Jianshen Zhang and Xiaomin Lin and Yulin Huang and Yongzhi Qi and Wei Qi},
  title = {{sTransformer: A Modular Approach for Extracting Inter-Sequential and Temporal Information for Time-Series Forecasting}},
  year = {2024},
  eprint = {2408.09723},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.09723},
}
Figure