STAMImputer: Spatio-Temporal Attention MoE for Traffic Data Imputation

Yiming Wang, Hao Peng, Senzhang Wang, Haohua Du, Chunyang Liu, Jia Wu, Guanlin Wu

Abstract

Traffic data imputation is fundamentally important to support various applications in intelligent transportation systems such as traffic flow prediction. However, existing time-to-space sequential methods often fail to effectively extract features in block-wise missing data scenarios. Meanwhile, the static graph structure for spatial feature propagation significantly constrains the model's flexibility in handling the distribution shift issue for nonstationary traffic data. To address these issues, this paper proposes a SpatioTemporal Attention Mixture of experts network named STAMImputer for traffic data imputation. Specifically, we introduce a Mixture of Experts (MoE) framework to capture latent spatio-temporal features and their influence weights, effectively imputing block missing. A novel Low-rank guided Sampling Graph ATtention (LrSGAT) mechanism is designed to dynamically balance the local and global correlations across road networks. The sampled attention vectors are utilized to generate dynamic graphs that capture real-time spatial correlations. Extensive experiments on four traffic datasets show STAMImputer achieves significant performance improvement compared with existing SOTA approaches.

Introduction

High-quality data is the lifeblood of Intelligent Transportation Systems (ITS), underpinning critical functions like urban planning and traffic flow prediction. However, real-world traffic data is frequently incomplete due to sensor malfunctions, network interruptions, or extreme weather events. Existing imputation methods face two primary hurdles: the "Block Missing" challenge and "Static Graph Rigidity."

Most current models process temporal and spatial features sequentially. When large blocks of data are missing (e.g., a sensor offline for hours), these models tend to propagate inaccurate features. Furthermore, traditional methods rely on fixed road network graphs, failing to account for the non-stationary nature of traffic. For instance, a traffic jam at a major hub might influence distant nodes during rush hour but have negligible impact at midnight. Static graphs cannot capture these shifting global dependencies.

Methodology

The STAMImputer framework addresses these challenges by treating imputation as a collaborative task between specialized experts within a Mixture of Experts (MoE) architecture.

STAMImputer Architecture Overview and Components

The MoE Framework and Observation Expert

Unlike standard MoE models that use simple routing, STAMImputer employs an Observation Expert (O-Expert) as an arbitrator. It analyzes raw input and sparsity patterns to dynamically determine the influence weights of temporal versus spatial experts. This "controlled decoupling" allows the model to lean on temporal experts when data is spatially sparse, and vice versa.

Temporal and Spatial Experts

  • Temporal Attention Expert (MSAT): Utilizes multi-head self-attention to recover stable, low-frequency sequence trends.
  • Spatial Attention Expert (LrSGAT): The core innovation is the Low-rank guided Sampling Graph ATtention (LrSGAT). It identifies key "traffic hubs" through a hybrid sampling strategy and uses low-rank factorization to propagate features globally without the computational cost of a fully connected graph.

Dynamic Graph Generation

The model moves beyond rigid maps by using sampled attention vectors to generate "semi-adaptive" dynamic graphs. These graphs represent the actual traffic influence patterns at a specific moment, rather than just physical road connectivity. Additionally, Discrete Wavelet Transforms (DWT) are used to decompose signals into high and low frequencies, allowing experts to specialize in different signal components.

Experiments and Results

The model was evaluated on four diverse benchmarks: PemsD8 (San Bernardino flow), SZ-Taxi (Shenzhen speed), DiDi-SZ (Shenzhen speed), and NYC-Taxi (NYC flow). Testing covered both Point Missing (random gaps) and Block Missing (consecutive gaps) scenarios.

Performance Comparison across Missingness Rates

Key Performance Metrics

STAMImputer consistently achieved the lowest Mean Absolute Error (MAE) across nearly all scenarios. Notably, in the NYC-Taxi dataset under block missingness, it achieved an MAE of 5.66, significantly outperforming the previous state-of-the-art, ImputeFormer (6.37).

As shown in the performance curves, STAMImputer demonstrates remarkable robustness. As the missing data rate increases up to 95%, its performance degrades much more gracefully than traditional Transformers or statistical methods like BRITS and SAITS.

Downstream Impact

Beyond raw imputation accuracy, the dynamic graphs generated by STAMImputer provide superior support for downstream tasks. When used for traffic prediction with Graph-WaveNet, the imputed data from STAMImputer led to significantly more accurate results compared to data imputed using standard static graph methods.

Conclusion

STAMImputer introduces a powerful MoE-based approach to traffic data imputation, effectively balancing local and global correlations through its novel LrSGAT mechanism. While the construction of dynamic graphs introduces some computational overhead, the gains in accuracy and robustness, particularly in challenging block-missing scenarios, are substantial. Future research will focus on optimizing the efficiency of dynamic graph construction for massive city-wide deployments and incorporating heterogeneous data sources like weather and social events.

Summary updated

Abstract

Traffic data imputation is fundamentally important to support various applications in intelligent transportation systems such as traffic flow prediction. However, existing time-to-space sequential methods often fail to effectively extract features in block-wise missing data scenarios. Meanwhile, the static graph structure for spatial feature propagation significantly constrains the models flexibility in handling the distribution shift issue for the nonstationary traffic data. To address these issues, this paper proposes a SpatioTemporal Attention Mixture of experts network named STAMImputer for traffic data imputation. Specifically, we introduce a Mixture of Experts (MoE) framework to capture latent spatio-temporal features and their influence weights, effectively imputing block missing. A novel Low-rank guided Sampling Graph ATtention (LrSGAT) mechanism is designed to dynamically balance the local and global correlations across road networks. The sampled attention vectors are utilized to generate dynamic graphs that capture real-time spatial correlations. Extensive experiments are conducted on four traffic datasets for evaluation. The result shows STAMImputer achieves significantly performance improvement compared with existing SOTA approaches. Our codes are available at https://github.com/RingBDStack/STAMImupter.
BibTeX
@inproceedings{wang2025stamimputer,
  author = {Yiming Wang and Hao Peng and Senzhang Wang and Haohua Du and Chunyang Liu and Jia Wu and Guanlin Wu},
  title = {{STAMImputer: Spatio-Temporal Attention MoE for Traffic Data Imputation}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.24963/ijcai.2025/382},
}
Figure