Spatial-Temporal-Decoupled Masked Pre-training for Spatiotemporal Forecasting

Haotian Gao, Renhe Jiang, Zheng Dong, Jinliang Deng, Yuxin Ma, Xuan Song

Abstract: Spatiotemporal forecasting techniques are significant for various domains such as transportation, energy, and weather. Accurate prediction of spatiotemporal series remains challenging due to the complex spatiotemporal heterogeneity. In particular, current end-to-end models are limited by input length and thus often fall into spatiotemporal mirage, i.e., similar input time series followed by dissimilar future values and vice versa. To address these problems, we propose a novel self-supervised pre-training framework Spatial-Temporal-Decoupled Masked Pre-training (STD-MAE) that employs two decoupled masked autoencoders to reconstruct spatiotemporal series along the spatial and temporal dimensions. Rich-context representations learned through such reconstruction could be seamlessly integrated by downstream predictors with arbitrary architectures to augment their performances. A series of quantitative and qualitative evaluations on four widely used benchmarks (PEMS03, PEMS04, PEMS07, and PEMS08) are conducted to validate the state-of-the-art performance of STD-MAE.

The Challenge: Spatiotemporal Mirage and Heterogeneity

Spatiotemporal forecasting, such as predicting traffic flow or energy demand, is notoriously difficult because data is highly heterogeneous. A sensor in a city center behaves differently than one in the suburbs, and a Monday morning looks nothing like a Sunday afternoon.

Existing models often suffer from a specific failure mode identified as the spatiotemporal mirage. Most modern models are trained end-to-end with very short input windows (typically the last hour). This leads to two critical issues:

  1. Dissimilar inputs, similar futures: Two sensors might show totally different trends over the last hour but converge to the same value soon (e.g., late-night traffic returning to a baseline).
  2. Similar inputs, dissimilar futures: Two sensors might look identical for an hour, but one is on a major commuter artery about to hit rush hour, while the other is a quiet side street.
Illustration of temporal/spatial heterogeneity and the spatiotemporal mirage problem in traffic flow data.

Because current models cannot "see" the broader context of the day or the week, they are frequently fooled by these short-term coincidences.

The STD-MAE Framework

To address these challenges, we introduce STD-MAE, a self-supervised pre-training framework. Instead of trying to learn everything at once, the framework decouples spatial and temporal learning through two separate Masked Autoencoders (S-MAE and T-MAE).

Decoupled Masking Strategy

  • S-Mask (Spatial): Randomly masks entire sensors across the whole time period. This forces the model to reconstruct a sensor’s data based solely on what other sensors are doing, capturing long-range spatial correlations.
  • T-Mask (Temporal): Randomly masks time steps across all sensors. This forces the model to learn the "rhythm" of the data over time, capturing temporal periodicity.

Architecture and Integration

To handle long-range inputs (e.g., 3 days of data) without excessive memory usage, STD-MAE uses patch embedding, grouping time steps into non-overlapping patches. Once pre-trained, the encoders generate "rich-context" representations. These are truncated and added to the hidden states of standard predictors (like GWNet or DCRNN) via a simple MLP, acting as a "plug-and-play" performance booster.

The architecture of STD-MAE, featuring decoupled temporal and spatial masked autoencoders and their integration into downstream predictors.

Key Insights and Results

  • Decoupling is Essential: Mixing spatial and temporal masking in a single 3D volume (common in video MAEs) makes the reconstruction task too "trivial," leading to poor representations. Separating them forces the model to learn the underlying global structure.
  • Information Density: Unlike Computer Vision where MAEs mask 75-90% of pixels, spatiotemporal data is more information-dense. We found an optimal masking ratio of only 25% for accurate reconstruction.
  • State-of-the-Art Performance: STD-MAE achieved the lowest error (MAE, RMSE, MAPE) across four major traffic benchmarks (PEMS03, PEMS04, PEMS07, and PEMS08), outperforming recent models like PDFormer and STAEformer.
  • Universal Improvement: When added to existing models, STD-MAE consistently improved performance. For example, it reduced the MAE of DCRNN on PEMS04 by approximately 5%.
  • Efficiency: The decoupled design results in significantly lower time complexity than joint spatiotemporal models, with training speed improvements of 22% to 72% per sample compared to non-decoupled methods.

Conclusion

STD-MAE provides a robust way to give existing forecasting models "long-term memory" and "global context" without massive computational overhead. While it currently requires a two-stage training process, its ability to mitigate the spatiotemporal mirage makes it a powerful tool for high-dimensional time-series tasks beyond traffic, such as power grid load forecasting or regional weather prediction.

Summary updated

BibTeX
@inproceedings{gao2024spatial,
  author = {Haotian Gao and Renhe Jiang and Zheng Dong and Jinliang Deng and Yuxin Ma and Xuan Song},
  title = {{Spatial-Temporal-Decoupled Masked Pre-training for Spatiotemporal Forecasting}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=sppjNQemmT},
}
Figure