Table of Contents
Fetching ...

Spatial-Temporal Large Language Model for Traffic Prediction

Chenxi Liu, Sun Yang, Qianxiong Xu, Zhishuai Li, Cheng Long, Ziyue Li, Rui Zhao

TL;DR

This work introduces ST-LLM, a Spatial-Temporal Large Language Model for traffic prediction that tokenizes timesteps at each location and learns unified spatial-temporal representations via a spatial-temporal embedding and a fusion convolution. A partially frozen attention LLM adapts pretrained transformers to capture global spatial-temporal dependencies, followed by a regression head to forecast multi-step traffic features. Empirical results on NYC taxi and CitiBike datasets show ST-LLM outperforms GNN-, attention-, and prior LLM-based baselines, with strong performance in few-shot and zero-shot settings and favorable inference efficiency. The approach demonstrates the potential of adapting LLMs to spatial-temporal forecasting, providing a scalable and transferable framework for intelligent transportation systems.

Abstract

Traffic prediction, an essential component for intelligent transportation systems, endeavours to use historical data to foresee future traffic features at specific locations. Although existing traffic prediction models often emphasize developing complex neural network structures, their accuracy has not improved. Recently, large language models have shown outstanding capabilities in time series analysis. Differing from existing models, LLMs progress mainly through parameter expansion and extensive pretraining while maintaining their fundamental structures. Motivated by these developments, we propose a Spatial-Temporal Large Language Model (ST-LLM) for traffic prediction. In the ST-LLM, we define timesteps at each location as tokens and design a spatial-temporal embedding to learn the spatial location and global temporal patterns of these tokens. Additionally, we integrate these embeddings by a fusion convolution to each token for a unified spatial-temporal representation. Furthermore, we innovate a partially frozen attention strategy to adapt the LLM to capture global spatial-temporal dependencies for traffic prediction. Comprehensive experiments on real traffic datasets offer evidence that ST-LLM is a powerful spatial-temporal learner that outperforms state-of-the-art models. Notably, the ST-LLM also exhibits robust performance in both few-shot and zero-shot prediction scenarios. The code is publicly available at https://github.com/ChenxiLiu-HNU/ST-LLM.

Spatial-Temporal Large Language Model for Traffic Prediction

TL;DR

This work introduces ST-LLM, a Spatial-Temporal Large Language Model for traffic prediction that tokenizes timesteps at each location and learns unified spatial-temporal representations via a spatial-temporal embedding and a fusion convolution. A partially frozen attention LLM adapts pretrained transformers to capture global spatial-temporal dependencies, followed by a regression head to forecast multi-step traffic features. Empirical results on NYC taxi and CitiBike datasets show ST-LLM outperforms GNN-, attention-, and prior LLM-based baselines, with strong performance in few-shot and zero-shot settings and favorable inference efficiency. The approach demonstrates the potential of adapting LLMs to spatial-temporal forecasting, providing a scalable and transferable framework for intelligent transportation systems.

Abstract

Traffic prediction, an essential component for intelligent transportation systems, endeavours to use historical data to foresee future traffic features at specific locations. Although existing traffic prediction models often emphasize developing complex neural network structures, their accuracy has not improved. Recently, large language models have shown outstanding capabilities in time series analysis. Differing from existing models, LLMs progress mainly through parameter expansion and extensive pretraining while maintaining their fundamental structures. Motivated by these developments, we propose a Spatial-Temporal Large Language Model (ST-LLM) for traffic prediction. In the ST-LLM, we define timesteps at each location as tokens and design a spatial-temporal embedding to learn the spatial location and global temporal patterns of these tokens. Additionally, we integrate these embeddings by a fusion convolution to each token for a unified spatial-temporal representation. Furthermore, we innovate a partially frozen attention strategy to adapt the LLM to capture global spatial-temporal dependencies for traffic prediction. Comprehensive experiments on real traffic datasets offer evidence that ST-LLM is a powerful spatial-temporal learner that outperforms state-of-the-art models. Notably, the ST-LLM also exhibits robust performance in both few-shot and zero-shot prediction scenarios. The code is publicly available at https://github.com/ChenxiLiu-HNU/ST-LLM.
Paper Structure (21 sections, 14 equations, 4 figures, 5 tables, 1 algorithm)

This paper contains 21 sections, 14 equations, 4 figures, 5 tables, 1 algorithm.

Figures (4)

  • Figure 1: ST-LLM framework. Given an input traffic feature, we first embed it via a Spatial-Temporal Embedding. These embeddings are then integrated uniformly by an Embedding Fusion layer. The PFA (partially frozen attention) LLM has $F + U$ layers, which are divided into the first $F$ layers and the last $U$ layers. The multi-head attention and feed-forward layers in the first $F$ layers are frozen, and the multi-head attention in the last $U$ layers are unfrozen. The output from PFA LLM is regressed to the prediction results.
  • Figure 2: Ablation study of ST-LLM on NYCTaxi dataset.
  • Figure 3: Performance study of unfreezing last $U$ layers.
  • Figure 4: Inference time of LLMs.