Double-Path Adaptive-correlation Spatial-Temporal Inverted Transformer for Stock Time Series Forecasting

Wenbo Yan, Ying TanarXiv 2024 · DOI

Introduction

Predicting the stock market is a notoriously difficult task due to the high noise-to-signal ratio and the absence of fixed spatial relationships between entities. Unlike traffic networks or weather stations, where physical proximity or infrastructure defines connections, relationships between stocks are dynamic, latent, and complex. Traditional models often struggle to capture these evolving dependencies. This paper introduces DPA-STIFormer (Double-Path Adaptive-correlation Spatial-Temporal Inverted Transformer), a novel framework that "inverts" the standard Transformer approach and utilizes a dual-path mechanism to adaptively learn how different stocks influence one another across both temporal and feature dimensions.

Methodology

The DPA-STIFormer architecture addresses the limitations of standard time-series models through three primary innovations: the Inverted Temporal Block, the Double-Path Adaptive-correlation Block (DPABlock), and the Decomposed Fitting Decoder (DF-Decoder).

Inverted Temporal Block

Standard Transformers typically treat each time step as a token. However, in financial contexts, individual time points are often noisy. DPA-STIFormer transposes the input data, treating the entire historical sequence of a single feature (such as closing price or trading volume) as a token. This "inversion" allows the attention mechanism to focus on the semantic evolution of specific features over time. Additionally, the model applies Importance Weights to these features, recognizing that certain indicators are more predictive than others.

Double-Path Adaptive-correlation Block (DPABlock)

The core of the model's spatial modeling lies in the DPABlock. It identifies correlations between stocks through two distinct lenses:

  • Temporal Path: Identifies stocks that exhibit similar movement patterns over time, capturing market leaders and followers.
  • Feature Path: Identifies stocks that share similar internal characteristic patterns, regardless of their immediate price action.

A Double-path gating mechanism then adaptively fuses these insights, deciding the optimal weight for each path based on the specific data sample.

Overview of the DPA-STIFormer architecture, featuring the Inverted Temporal Block, DPABlock, and DF-Decoder.

Decomposed Fitting (DF-Decoder)

Stock prices are composed of stable long-term trends and volatile short-term shocks. The DF-Decoder splits the prediction task into two components: a Mean (representing the stable trend) and a Deviation (capturing sudden changes). This decomposition makes the model significantly more robust against sudden market volatility and prevents overfitting to noise.

Experimental Setup

The model was rigorously evaluated on four major stock market datasets: CSI500 and CSI1000 from the Chinese market, and NASDAQ and NYSE from the US market. These datasets range from 500 to over 1,700 stocks, providing a comprehensive test of the model's ability to scale and generalize across different market environments.

Key Results and Insights

DPA-STIFormer outperformed ten baseline models, including standard Transformers like Crossformer and advanced Spatial-Temporal Graph Neural Networks (STGNNs) like MTGNN, across all primary metrics:

  • Information Coefficient (IC): Improved by an average of 30% over traditional STGNNs, indicating a much stronger correlation between predicted and actual stock rankings.
  • Annual Return (A_RET): Achieved significantly higher returns, with an average improvement of 20% over baselines.
  • Win Rate (WINR): Consistently higher across all four datasets, demonstrating the model's reliability for real-world trading strategies.
Feature-Path Attention visualization demonstrating the model's ability to learn complex, latent inter-stock relationships.

A key insight from the study is that the "feature dimension" in financial data is more semantic than the "time dimension." By inverting the input, the Transformer's attention mechanism focuses on feature relationships, which are more resistant to market noise. Furthermore, the dual-path approach successfully captures both broad market momentum and specific industry-linked ties without requiring a predefined graph.

Conclusion and Future Work

DPA-STIFormer represents a significant step forward in stock forecasting by moving away from fixed spatial assumptions. While highly effective, the authors note that the model is data-sensitive and computationally intensive for very large universes. Future work will focus on integrating external factors, such as macroeconomic indicators and sentiment analysis, to further enhance the model's predictive power.

Summary updated

BibTeX
@misc{yan2024double,
  author = {Wenbo Yan and Ying Tan},
  title = {{Double-Path Adaptive-correlation Spatial-Temporal Inverted Transformer for Stock Time Series Forecasting}},
  year = {2024},
  eprint = {2409.15662},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.15662},
}
Figure