Personalized Federated Learning for Cross-City Traffic Prediction

Yu Zhang, Hua Lu, Ning Liu, Yonghui Xu, Qingzhong Li, Lizhen CuiIJCAI 2024 · OpenReview

Abstract

Traffic prediction plays an important role in urban computing. However, many cities face data scarcity due to low levels of urban development. Although many approaches transfer knowledge from data-rich cities to data-scarce cities, the centralized training paradigm cannot uphold data privacy. For the sake of inter-city data privacy, Federated Learning has been used, which follows a decentralized training paradigm to enhance traffic knowledge of data-scarce cities. However, spatio-temporal data heterogeneity causes client drift, leading to unsatisfactory traffic prediction performance. In this work, we propose a novel personalized Federated learning method for Cross-city Traffic Prediction (pFedCTP). It learns traffic knowledge from multiple data-rich source cities and transfers the knowledge to a data-scarce target city while preserving inter-city data privacy. In the core of pFedCTP lies a Spatio-Temporal Neural Network (ST-Net) for clients to learn traffic representation. We decouple the ST-Net to learn space-independent traffic patterns to overcome cross-city spatial heterogeneity. Besides, pFedCTP adaptively interpolates the layer-wise global and local parameters to deal with temporal heterogeneity across cities. Extensive experiments on four real-world traffic datasets demonstrate significant advantages of pFedCTP over representative state-of-the-art methods.

Introduction

Accurate traffic prediction is the backbone of smart cities, yet it requires massive amounts of data that many developing urban areas lack. While major hubs like Los Angeles or Shenzhen have extensive sensor networks, many cities suffer from data scarcity, making it nearly impossible to train robust local models.

Existing solutions typically involve "transfer learning," but this faces two major hurdles: Privacy and Heterogeneity. Centralized training requires cities to share raw traffic data, which is often prohibited by legal and security concerns. Furthermore, cities are built differently (spatial heterogeneity) and have different rush-hour behaviors (temporal heterogeneity). Simply transferring a model from one city to another often leads to "negative transfer," where the model performs worse because it applies the wrong city's logic.

Methods

The proposed pFedCTP (Personalized Federated Cross-City Traffic Prediction) framework operates in two main stages to bridge the gap between data-rich and data-scarce cities while maintaining strict privacy.

Overview of the ST-Net architecture and the personalized federated learning workflow.

1. The ST-Net Architecture

Each city (client) runs a local Spatio-Temporal Neural Network (ST-Net) composed of four modules:

  • Spatial Structure (SS): Uses Graph Convolutional Networks (GCN) to understand the local road network.
  • Traffic Pattern (TP): Uses GRUs and Self-Attention to capture how traffic flows over time.
  • Spatio-Temporal Feature (ST): Combines the above using a "HyperNetwork" to generate personalized weights.
  • Predictor: An MLP that outputs the final forecast.

2. Personalized Federated Learning

To solve the heterogeneity problem, the framework uses two primary mechanisms:

  • Parameter Decoupling: Road layouts (Spatial Structure) are unique to a city, but the general "rhythm" of traffic (Traffic Pattern) is often shareable. Therefore, only the Traffic Pattern module is shared with the central server, while spatial modules remain private and local.
  • Adaptive Model Interpolation: Instead of overwriting local models with a global average, pFedCTP uses cosine similarity to decide how much global knowledge to incorporate. If the global update aligns with the local trend, it takes more; if it appears as "noise," it relies more on local data.

Experimental Results

The model was evaluated on four real-world traffic speed datasets: PEMS-BAY, METR-LA, DiDi-Chengdu, and DiDi-Shenzhen. To simulate data scarcity, the target city's training data was limited to just three days.

Ablation study results comparing pFedCTP variants across four datasets at different prediction steps.

Key Findings

  • Superior Accuracy: pFedCTP reduced the Mean Absolute Error (MAE) and Root Mean Squared Error (RMSE) by 1.9% and 0.8% respectively compared to the best-performing baseline (ST-GFSL).
  • Effective Knowledge Transfer: The framework significantly outperformed models trained only on the target city's limited data, proving that temporal knowledge transfer from other cities was successful.
  • Ablation Success: As shown in the ablation studies, removing the "Traffic Pattern" sharing caused performance to decline, confirming that temporal patterns are the most valuable transferable asset between cities.

Conclusion

pFedCTP addresses the critical challenge of traffic prediction in data-scarce cities by leveraging personalized federated learning. By decoupling spatial and temporal features, the model avoids negative transfer while preserving data privacy. Future work will explore the inclusion of external factors like weather and the adaptation to dynamic road network changes.

Summary updated

Abstract

Traffic prediction plays an important role in urban computing. However, many cities face data scarcity due to low levels of urban development. Although many approaches transfer knowledge from data-rich cities to data-scarce cities, the centralized training paradigm cannot uphold data privacy. For the sake of inter-city data privacy, Federated Learning has been used, which follows a decentralized training paradigm to enhance traffic knowledge of data-scarce cities. However, spatio-temporal data heterogeneity causes client drift, leading to unsatisfactory traffic prediction performance. In this work, we propose a novel personalized Federated learning method for Cross-city Traffic Prediction (pFedCTP). It learns traffic knowledge from multiple data-rich source cities and transfers the knowledge to a data-scarce target city while preserving inter-city data privacy. In the core of pFedCTP lies a Spatio-Temporal Neural Network (ST-Net) for clients to learn traffic representation. We decouple the ST-Net to learn space-independent traffic patterns to overcome cross-city spatial heterogeneity. Besides, pFedCTP adaptively interpolates the layer-wise global and local parameters to deal with temporal heterogeneity across cities. Extensive experiments on four real-world traffic datasets demonstrate significant advantages of pFedCTP over representative state-of-the-art methods.
BibTeX
@inproceedings{zhang2024personalized,
  author = {Yu Zhang and Hua Lu and Ning Liu and Yonghui Xu and Qingzhong Li and Lizhen Cui},
  title = {{Personalized Federated Learning for Cross-City Traffic Prediction}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=EsugnchpKc},
}
Figure