Abstract
As urban data expands, existing spatio-temporal models encounter challenges such as high context dependency, poor cross-scenario generalization, and inefficient computational performance. To address these issues, we propose UrbanPG, an efficient and scalable framework for spatio-temporal learning. UrbanPG separates task-specific personalized patterns from general patterns, enabling unified spatio-temporal modeling and efficient knowledge generalization across scenarios. The key innovations of UrbanPG include: the development of a lightweight, context-independent general backbone utilizing linear spatio-temporal attention for scalable cross-scenario deployment; a personalized context prompt mechanism designed to model heterogeneity through spatio-temporal embeddings and random perturbation regularization, interacting with the backbone to enhance pattern differentiation; the proposal of multi spatio-temporal learning paradigms for rapid knowledge transfer and generalization to downstream tasks through fine-tuning personalized context prompts while freezing the backbone. Experimental results demonstrate that UrbanPG achieves state-of-the-art performance in large-scale forecasting, few-shot transfer, and continual learning tasks across eight real-world datasets, showcasing exceptional performance, strong generalization, and significant reductions in computational overhead.
Introduction
Predicting urban dynamics—such as traffic flow or air quality—is notoriously difficult because models are often "trapped" by their specific training context. Traditional Spatio-Temporal Graph Neural Networks (STGNNs) are typically designed for fixed scenarios, tied to a specific number of sensors (nodes) and fixed time intervals. This creates significant hurdles for generalization: a model trained on one district cannot easily be applied to another if the graph structure or local patterns differ. Furthermore, standard attention mechanisms exhibit quadratic complexity ($O(N^2)$) relative to the number of nodes, leading to computational bottlenecks when scaling to thousands of sensors.
Methodology
UrbanPG addresses these issues by decoupling task-specific "personalized" context from a "general" backbone. The architecture is split into two distinct components that interact to produce accurate forecasts.
Personalized Context Prompts
These are trainable embeddings that capture the "where" and "when" of a specific dataset.
- Temporal Context: Uses Time-of-Day and Day-of-Week embeddings to capture periodic urban rhythms.
- Spatial Context: Uses node-specific embeddings. To prevent the model from simply memorizing node IDs (overfitting), the authors introduce Random Perturbation Regularization (RPR), which randomly replaces some spatial embeddings with noise or shared embeddings during training, forcing the model to learn structural relationships.
General Spatio-Temporal Backbone
This lightweight, context-independent module is designed to learn universal urban patterns. The core innovation is the Spatio-Temporal Context Attention (STCA). By reordering matrix multiplications (a linear attention trick), the computational complexity is reduced from $O(N^2)$ to $O(N)$, allowing the model to scale to massive datasets efficiently.
Interaction and Learning Paradigms
The personalized prompts interact with the general backbone via a gating mechanism. This modularity enables rapid adaptation: for new tasks, the backbone is frozen, and only the lightweight prompts are fine-tuned. This approach supports few-shot learning in data-scarce regions and continual learning as new nodes are added to a network over time.
Experimental Results
The researchers evaluated UrbanPG across eight real-world datasets, including the LargeST regional traffic flow datasets ranging from 716 to 8,600 nodes.
Accuracy and Efficiency
UrbanPG consistently outperformed established baselines (such as GWNet, STID, and BigST) across all tasks, achieving the lowest Mean Absolute Error (MAE) on all four LargeST datasets. On the massive California (CA) dataset (8,600 nodes), UrbanPG reduced training time by 48.96%, inference time by 72.44%, and memory usage by 45.72% compared to the previous state-of-the-art model, PatchSTG.
Generalization and Knowledge Transfer
In few-shot scenarios (using only 10% of training data), UrbanPG outperformed other pre-training methods like FlashST, proving that its decoupled architecture is highly effective for knowledge transfer. In continual learning tests, the framework successfully mitigated "catastrophic forgetting" as the network size increased.
Conclusion
UrbanPG represents a significant advancement in urban spatio-temporal forecasting by separating general urban dynamics from local context. This decoupling, combined with linear attention, results in a model that is more accurate, faster, and more memory-efficient than existing solutions. Future work aims to evolve UrbanPG into a multi-task spatio-temporal foundation model by training on even larger, multi-source datasets.
Summary updated