NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Revealing the Power of Masked Autoencoders in Traffic Forecasting

Jiarui Sun, Yujie Fan, Chin-Chia Michael Yeh, Wei Zhang, Girish Chowdhary

TL;DR

This paper introduces STMAE, a novel framework that leverages masked autoencoders (a self-supervised learning technique) to significantly improve the accuracy and stability of traffic forecasting models. By pre-training an encoder to reconstruct masked traffic data, STMAE enhances existing spatial-temporal models, addressing challenges like data scarcity and model instability.

What Problem Does This Paper Address?

Accurate traffic forecasting is crucial for urban planning and managing transportation systems. Existing methods often rely on complex spatial-temporal models that explicitly capture intricate relationships between traffic flow and speed across different locations and times. However, these models face two major hurdles:

  1. Data Scarcity: Traffic datasets are typically limited in duration and geographical coverage, making it difficult for models to generalize well and leading to overfitting. Unlike domains with massive datasets (e.g., computer vision), traffic forecasting often works with much smaller datasets.
  2. Model Instability: Real-world traffic data is prone to inconsistencies due to sensor malfunctions, creating gaps and errors. These imperfections can destabilize the training of spatial-temporal models, compromising their predictive performance.

The paper aims to overcome these limitations by enhancing the feature representation learning capabilities of existing traffic forecasting models.

Methods

The core contribution is the Spatial-Temporal Masked AutoEncoders (STMAE) framework, which operates in two stages:

  1. Pretraining Stage:
    • Dual-Masking Strategy: STMAE employs a novel masking approach that combines both spatial and temporal dimensions.
  2. Spatial Masking: A "biased random walk-based" strategy is used to mask connections in the graph representing road networks. This is more challenging than uniform masking and aims to preserve structural integrity while forcing the model to infer relationships.
  3. Temporal Masking: A "patch-based" strategy masks entire segments (patches) of the time series data, rather than individual timesteps. This is more effective at preventing easy interpolation and encourages learning more robust temporal patterns.
  4. Reconstruction Task: An encoder (taken from an existing spatial-temporal model) processes the masked traffic data. Two decoders then attempt to reconstruct both the masked spatial connections (adjacency matrix) and the masked temporal data. This self-supervised reconstruction task forces the encoder to learn rich, informative representations of traffic dynamics.
  5. Loss Function: A combined loss function, Lpretrain = λ * LA + Lx, is used, where LA is a classification loss for spatial reconstruction and Lx is a mean absolute error for temporal reconstruction. λ is a hyperparameter balancing these two losses.
  6. Fine-tuning Stage:
    • The pretrained encoder from STMAE is retained.
  7. The original predictor (decoder) from the backbone spatial-temporal model is re-attached.
  8. The model is then fine-tuned on the complete traffic data using the standard forecasting loss (Lpred = ||Ý – У||1). This stage leverages the robust features learned during pretraining to improve forecasting accuracy.

STMAE is designed as a "plug-and-play" framework, meaning it can be easily integrated with various existing spatial-temporal models without requiring complex data augmentation or architectural changes.

Datasets

The paper evaluates STMAE on four widely used traffic forecasting benchmarks:

  • PEMS03: Bay Area traffic data.
  • PEMS04: Bay Area traffic data.
  • PEMS07: California traffic data.
  • PEMS08: San Bernardino area traffic data.

These datasets vary in the number of sensors, graph density, and time range. The paper follows standard practices for splitting these datasets into training, validation, and testing sets. No new datasets were introduced.

Key Insights and Ideas

  • Generative SSL for Traffic: The paper successfully demonstrates that generative self-supervised learning (SSL) methods, specifically masked autoencoders, are highly effective for traffic forecasting, offering an alternative to contrastive SSL approaches.
  • Dual-Masking Power: The combination of spatial and temporal masking is crucial. Neither spatial nor temporal masking alone yields as significant improvements as their joint application, highlighting the interconnected nature of traffic dynamics.
  • Robustness to Irregularities: STMAE's pretraining on masked data makes it more resilient to real-world data imperfections, leading to more stable training and better performance, especially in scenarios with sudden traffic changes.
  • Plug-and-Play Simplicity: The framework's ability to seamlessly integrate with existing models without extensive tuning is a significant practical advantage for researchers and practitioners.

Key Results

  • Performance Enhancement: STMAE consistently and significantly improves the forecasting accuracy (measured by MAE, MAPE, and RMSE) of various backbone models (DCRNN, AGCRN, MTGNN) across all tested datasets. For instance, STMAEA (STMAE coupled with AGCRN) outperforms its base model and STGCL (a contrastive SSL method) on PEMS04 and PEMS08.
  • Mitigating Performance Degradation: The paper shows that STMAE effectively alleviates the typical performance degradation observed in traffic forecasting as the prediction horizon increases. The performance gap between STMAE and baseline models widens in favor of STMAE at longer forecasting steps.
  • Stability: Learning curves demonstrate that STMAE's pretraining and fine-tuning stages are stable, with STMAE often achieving lower validation losses earlier and maintaining a more consistent trend compared to the base models.
  • Masking Ratio Sensitivity: The study found that optimal performance is achieved with specific spatial and temporal masking ratios, which can vary slightly depending on the dataset's structural density. Generally, temporal masking ratios around 20-30% and spatial masking ratios around 30-70% (with higher values for denser networks) yielded the best results.

Limitations and Future Work

  • Hyperparameter Tuning: While STMAE is designed to be plug-and-play, optimal performance still requires tuning of masking ratios and the λ hyperparameter. The paper provides sensitivity analysis for these.
  • Dataset Specificity: The optimal masking ratios can vary across datasets, suggesting that further research might be needed to develop more adaptive masking strategies.
  • Future Work: The paper implicitly suggests that exploring other generative SSL techniques or more sophisticated masking strategies could further enhance traffic forecasting. The framework's success also opens avenues for applying similar masked autoencoder principles to other spatio-temporal forecasting tasks beyond traffic.

Summary updated

BibTeX
@inproceedings{sun2024revealing,
  author = {Jiarui Sun and Yujie Fan and Chin-Chia Michael Yeh and Wei Zhang and Girish Chowdhary},
  title = {{Revealing the Power of Masked Autoencoders in Traffic Forecasting}},
  booktitle = {ACM International Conference on Information and Knowledge Management},
  year = {2024},
  doi = {10.1145/3627673.3679989},
}
Figure