STGRAT: A Spatio-Temporal Graph Attention Network for Traffic Forecasting

Cheonbok Park, Chunggi Lee, Hyojin Bahng, Taeyun won, Kihwan Kim, Seungmin Jin, Sungahn Ko, Jaegul ChooarXiv 2019 · DOI

TL;DR

ST-GRAT (Spatio-Temporal Graph Attention Network) is a fully attention-based framework designed to forecast traffic speeds by dynamically modeling changing road conditions. By integrating graph topology directly into directed attention heads and introducing "spatial sentinel vectors" to prevent noise injection, it significantly outperforms state-of-the-art models during highly volatile traffic periods like rush hour.

What Problem Does This Paper Address?

Predicting traffic speed is notoriously difficult because spatial dependencies between roads are highly dynamic. For instance, a bottleneck during morning rush hour creates localized dependencies that disappear by noon.

While deep learning models have advanced traffic forecasting, existing approaches suffer from two main flaws:

  1. Static Spatial Assumptions: Many models rely on Graph Convolutional Neural Networks (GCNNs) with fixed adjacency matrices. They compute spatial relationships once and apply them universally, failing to adapt to sudden traffic anomalies or rush hours.
  2. Ignoring Graph Topology in Attention: Recent models that do use attention mechanisms often treat the road network as an undirected graph and ignore crucial structural information like distances, connections, and traffic flow directions.

Additionally, many architectures rely on Recurrent Neural Networks (RNNs) for temporal modeling, which struggle to capture long-term dependencies and cannot be easily parallelized.

Methods

The authors propose ST-GRAT, an encoder-decoder architecture built entirely on self-attention mechanisms, completely bypassing RNNs to allow full parallelization.

Figure 1: Overall architecture of ST-GRAT. The 𝑥and 𝑦axes indicate the time and the number of the layers, respectively. The left-half block is the 𝐿-stacked encoder while the right- half block is the 𝐿stacked decoder. We use a special token, ‘[Start]’, to represent the starting point in a decoding stage.

The core innovations lie within its Spatial Attention Module:

  • Directed Attention Heads: Traffic is inherently directional. ST-GRAT splits its attention heads into inflow heads (odd indices) and outflow heads (even indices) to model traffic physics accurately.
  • Diffusion Prior: To ensure the model respects road geography, the authors inject a learnable "diffusion prior" directly into the attention logit calculation. This forces the attention mechanism to prioritize physically connected and mathematically correlated nodes based on distance.
  • Spatial Sentinel Vectors: Standard self-attention forces attention weights to sum to one, meaning a node must distribute its attention across its neighbors even if none of them are relevant. ST-GRAT introduces sentinel key and value vectors ($k_s$ and $v_s$). If neighboring road data is unhelpful, the query node attends to the sentinel vector instead, effectively preserving its own historical features and filtering out spatial noise.

Temporal dependencies are handled via multi-head self-attention layers (similar to the Transformer architecture), allowing the model to directly access distant past time steps without information decay.

Datasets

The model was evaluated on two standard real-world traffic benchmarks:

  • METR-LA: Contains 4 months of speed data from 207 sensors on the highways of Los Angeles County.
  • PEMS-BAY: Contains 6 months of speed data from 325 sensors in the California Bay Area.

Both datasets were pre-processed into 5-minute intervals, and the task was to predict the next 12 time steps (1 hour ahead) given the previous 12 time steps.

Key Insights and Ideas

  • The "Stay Put" Mechanism: The spatial sentinel vector acts as an elegant fallback mechanism. The authors discovered that nodes on the outskirts of a city—which have fewer neighbors and less spatial correlation—rely heavily on sentinel vectors. This prevents them from absorbing irrelevant traffic data from distant sensors.
  • Dynamic Geographic Shrinkage: Through qualitative analysis, the authors proved that ST-GRAT dynamically adjusts its geographic focus. During free-flow traffic (e.g., 6 AM), nodes attend to farther neighbors. However, when a road becomes highly congested (e.g., 6 PM), the model automatically shrinks its attention radius to focus almost exclusively on immediate, close-by nodes.
  • No Time Lags: Traditional models often exhibit a time lag when predicting sudden speed drops, essentially just "predicting the present." ST-GRAT successfully anticipates and tracks abrupt changes without this delay.

Key Results

ST-GRAT achieved state-of-the-art performance across both datasets, showing the most substantial gains in short-term horizons (15 to 30 minutes ahead).

  • METR-LA (15-min horizon): ST-GRAT achieved an MAE of 2.60, outperforming Graph WaveNet (2.69) and DCRNN (2.73).
  • Impeded Intervals (Rush Hour): When evaluating specifically on intervals where traffic speeds abruptly dropped below 20 mph, ST-GRAT significantly outperformed competitors. On these difficult subsets, ST-GRAT achieved an MAE of 5.82 at the 15-minute mark, compared to Graph WaveNet's 6.45 and DCRNN's 6.44.
Traffic speed prediction visualization comparing ST-GRAT against ground truth and baseline models during abrupt speed drops.
  • Computation Speed: Thanks to its non-recurrent structure, ST-GRAT trains significantly faster than RNN-based counterparts like DCRNN and GaAN, offering an $O(1)$ time complexity per sequence step during training.

Limitations and Future Work

While ST-GRAT trains faster than RNN models, it is still slower during inference than fully non-autoregressive models like Graph WaveNet. This is because ST-GRAT's decoder generates predictions step-by-step (autoregressively).

For future work, the authors plan to adapt the ST-GRAT architecture to other highly dynamic spatio-temporal prediction tasks beyond traffic, such as air quality forecasting.

Summary updated

BibTeX
@misc{park2019stgrat,
  author = {Cheonbok Park and Chunggi Lee and Hyojin Bahng and Taeyun won and Kihwan Kim and Seungmin Jin and Sungahn Ko and Jaegul Choo},
  title = {{STGRAT: A Spatio-Temporal Graph Attention Network for Traffic Forecasting}},
  year = {2019},
  eprint = {1911.13181},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1911.13181},
}
Figure