Pathformer: Multi-scale Transformers with Adaptive Pathways for Time Series Forecasting

Peng Chen, Yingying Zhang, Yunyao Cheng, Yang Shu, Yihang Wang, Qingsong Wen, Bin Yang, Chenjuan Guo

Abstract

Time series forecasting is critical for diverse applications, from energy grid management to cloud resource allocation. However, standard Transformer architectures often struggle with the multi-scale nature of temporal data, sometimes underperforming compared to simpler linear models. This paper introduces Pathformer, a model that addresses this "scale-blindness" through Adaptive Pathways. By dynamically selecting optimal temporal resolutions and modeling both local and global dependencies, Pathformer achieves state-of-the-art performance across 11 major datasets and demonstrates superior transfer learning capabilities.

Introduction

While Transformers have revolutionized natural language processing and computer vision, their application to time series forecasting has been inconsistent. Critics have pointed out that fixed-scale Transformers often fail to capture the complex, hierarchical patterns inherent in real-world data. The researchers behind Pathformer (ICLR 2024) argue that the issue lies in the static nature of these models. Pathformer introduces a multi-scale approach that allows the model to dynamically choose which temporal scales matter most for the data it is processing in real-time.

The Challenge of Multi-Scale Temporal Data

Real-world time series are characterized by overlapping patterns at different resolutions. For example, electricity usage involves hourly spikes, daily cycles, and seasonal trends. Most current models struggle with two primary challenges:

  1. Incompleteness of Scale: They typically focus on either fine-grained local details or long-term global correlations, but rarely both effectively.
  2. Fixed Modeling: They apply the same "zoom level" to every input. However, a sudden burst of network traffic requires a different modeling scale than a slow-moving climate trend.

Methodology: The Pathformer Architecture

The core of Pathformer is the Adaptive Multi-Scale (AMS) Block, which enables the model to navigate different temporal "pathways" based on the characteristics of the input.

Multi-scale Division

Instead of a single fixed patch size, Pathformer divides the input sequence into multiple sets of patches with varying sizes (e.g., 2, 4, 8, or 16 time steps). This provides the model with multiple resolutions of the same data simultaneously.

Dual Attention Mechanism

To capture the full spectrum of temporal dynamics, the model employs a dual attention strategy for every scale:

  • Intra-patch Attention: Analyzes the internal dynamics within each patch to capture local fluctuations and fine-grained details.
  • Inter-patch Attention: Analyzes relationships across different patches to understand global dependencies and long-term correlations.

The Multi-scale Router

The "brain" of the AMS block is the Multi-scale Router. It performs a Trend and Seasonality Decomposition using a Discrete Fourier Transform (DFT) to identify periodic patterns and moving averages to find the trend. Based on these features, the router calculates weights for each patch size and selects the Top-K most relevant scales. This adaptive sparsity ensures the model focuses computation on the most informative pathways, preventing noise from irrelevant scales from degrading the forecast.

Experimental Evaluation

Pathformer was tested on 11 real-world datasets, including standard benchmarks (ETT, Weather, Electricity), cloud computing demand (Cloud Cluster), and large-scale traffic and wind power data (PEMS07 and a dataset with over 7 million timestamps).

Key Results

  • State-of-the-Art Performance: Pathformer achieved the best performance in 81 out of 88 experimental cases.
  • Significant Gains: Compared to the previous leading Transformer (PatchTST), Pathformer reduced the Mean Squared Error (MSE) by 8.1%. Compared to other multi-scale models like Pyraformer, the reduction was 36.4%.
  • Zero-Shot Transfer: In scenarios where the model was tested on new datasets without prior training, Pathformer consistently outperformed competitors, proving its ability to adjust to unfamiliar temporal dynamics.

Discussion and Insights

Pathformer clarifies the distinction between temporal resolution (the size of the unit observed) and temporal distance (the span between units). By unifying these views, the model achieves a more holistic understanding of time. Furthermore, the researchers found that they could take a pre-trained Pathformer and only fine-tune the Router parameters for a new dataset. This "part-tuning" performed nearly as well as full-model tuning, suggesting the model learns universal temporal primitives that can be adaptively recombined.

Conclusion

Pathformer represents a significant advancement in making Transformers "scale-aware." By replacing static architectures with adaptive pathways, it provides a flexible framework that excels in both accuracy and generalization across diverse time series domains.

Summary updated

BibTeX
@inproceedings{chen2024pathformer,
  author = {Peng Chen and Yingying ZHANG and Yunyao Cheng and Yang Shu and Yihang Wang and Qingsong Wen and Bin Yang and Chenjuan Guo},
  title = {{Pathformer: Multi-scale Transformers with Adaptive Pathways for Time Series Forecasting}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=lJkOCMP2aW},
}
Figure