Abstract
Traffic prediction has gradually attracted the attention of researchers because of the increase in traffic big data. Therefore, how to mine the complex spatio-temporal correlations in traffic data to predict traffic conditions more accurately become a difficult problem. Previous works combined graph convolution networks (GCNs) and self-attention mechanism with deep time series models (e.g. recurrent neural networks) to capture the spatio-temporal correlations separately, ignoring the relationships across time and space. Besides, GCNs are limited by over-smoothing issue and self-attention is limited by quadratic problem, result in GCNs lack global representation capabilities, and self-attention inefficiently capture the global spatial dependence. In this paper, we propose a novel deep learning model for traffic forecasting, named Multi-Context Aware Spatio-Temporal Joint Linear Attention (STJLA), which applies linear attention to the spatio-temporal joint graph to capture global dependence between all spatio-temporal nodes efficiently. More specifically, STJLA utilizes static structural context and dynamic semantic context to improve model performance. The static structure context based on node2vec and one-hot encoding enriches the spatio-temporal position information. Furthermore, the multi-head diffusion convolution network based dynamic spatial context enhances the local spatial perception ability, and the GRU based dynamic temporal context stabilizes sequence position information of the linear attention, respectively. Experiments on two real-world traffic datasets, England and PEMSD7, demonstrate that our STJLA can achieve up to 9.83% and 3.08% accuracy improvement in MAE measure over state-of-the-art baselines.
Introduction
Traffic forecasting is a cornerstone of modern Intelligent Transportation Systems (ITS). Whether it's helping GPS apps find the fastest route or assisting city planners in reducing congestion, the goal is to analyze historical data to predict traffic conditions at future intervals. However, traffic data is notoriously difficult to model because it is deeply "spatio-temporal"; a traffic jam at one intersection at 8:00 AM will likely affect a neighboring street shortly after.
Most existing models tackle this using a decoupled approach, combining Graph Convolutional Networks (GCNs) for spatial layout with Recurrent Neural Networks (RNNs) or Transformers for temporal patterns. This separation often leads to local bias and computational inefficiency. To address these challenges, we introduce STJLA (Multi-Context Aware Spatio-Temporal Joint Linear Attention Network), a model that treats the relationship between space and time as a unified joint graph.
Methodology
The Spatio-Temporal Joint Graph
Instead of looking at a snapshot of the city and then moving to the next time step, STJLA merges all sensors and all time slices into one joint graph. This allows the model to directly calculate the correlation between any sensor at any time and any other sensor at any other time, naturally capturing the "expanding receptive field" where spatial influence grows over time.
Linear Attention and Multi-Context Awareness
To make the joint graph mathematically feasible, STJLA utilizes a Linear Attention mechanism. By leveraging the associative property of matrix multiplication, the computational complexity is reduced from quadratic ($O(T^2N^2)$) to linear ($O(TN)$), enabling the model to capture global dependencies efficiently.
Furthermore, the model enriches raw traffic data with four types of context to stabilize position information and enhance local perception:
- Static Spatial Context: Uses
node2vecto encode the road's physical topology. - Static Temporal Context: Uses one-hot encoding to mark time-of-day and day-of-week patterns.
- Dynamic Spatial Context: A Multi-Head Diffusion Convolution Network (MHDCN) captures local traffic "spread."
- Dynamic Temporal Context: A GRU (Gated Recurrent Unit) captures fine-grained sequence position information.
Experimental Evaluation
The model was evaluated on two real-world benchmarks: the England dataset (traffic flow from 249 sensors) and PEMSD7 (traffic speed from 228 sensors). STJLA outperformed a wide range of baselines, including DCRNN, STGCN, and GMAN.
Key Results
- Accuracy: STJLA achieved a 9.83% improvement in Mean Absolute Error (MAE) on the England dataset and a 3.08% improvement on PEMSD7 compared to the best previous baselines.
- Efficiency: In training time per epoch, STJLA was nearly 4x faster than DCRNN and 2x faster than GMAN, proving that global reach does not have to come at the cost of speed.
- Stability: While many models' errors increase sharply for long-term predictions (e.g., 3 hours out), STJLA’s error curve remained significantly flatter, demonstrating superior long-term stability.
Conclusion
STJLA demonstrates that a spatio-temporal joint graph combined with linear attention can effectively capture complex global dependencies in traffic data. By integrating static and dynamic contexts, the model achieves state-of-the-art accuracy while remaining computationally efficient. Future work may involve applying this joint linear attention approach to other spatio-temporal tasks, such as video prediction or weather forecasting.
Summary updated