TimeGNN: Temporal Dynamic Graph Learning for Time Series Forecasting

Nancy Xu, Chrysoula Kosma, Michalis Vazirgiannis

Introduction

Multivariate time series forecasting is a critical task in domains ranging from urban traffic management to financial market analysis. Recently, Graph Neural Networks (GNNs) have emerged as a powerful tool for this task, primarily due to their ability to model complex spatial-temporal dependencies. By treating variables as nodes in a graph, these models capture inter-variable correlations that traditional Recurrent Neural Networks (RNNs) or Transformers might overlook.

However, existing GNN-based approaches face a significant scalability challenge. As the number of variables ($N$) increases, the computational complexity of learning inter-variable relationships grows quadratically ($O(N^2)$). Furthermore, many current models rely on static graph structures, which fail to account for the evolving nature of temporal dependencies. To address these limitations, the paper "TimeGNN: Temporal Dynamic Graph Learning for Time Series Forecasting" introduces a novel paradigm: shifting the graph representation from variables to time steps.

Methodology

TimeGNN redefines the forecasting problem by treating individual time steps within a sliding window as nodes in a dynamic graph. The architecture consists of three primary stages:

1. Multi-Scale Feature Extraction

To capture both short-term fluctuations and long-term trends, TimeGNN employs an "Inception-style" block composed of stacked dilated convolutions. By utilizing varying dilation rates, the model extracts multi-scale temporal features for every time step within the input window, providing a rich feature set for subsequent graph learning.

2. Dynamic Graph Structure Learning

The core innovation of TimeGNN is its ability to learn a unique adjacency matrix for every sliding window. The model utilizes a link predictor based on fully connected layers and the Gumbel-Softmax trick to sample discrete, differentiable graph structures. To maintain temporal causality and prevent data leakage, the model only learns the upper triangular portion of the adjacency matrix, ensuring that the graph remains directed and forward-looking.

3. GraphSAGE for Forecasting

With the temporal graph established, the model applies GraphSAGE, an inductive GNN framework. GraphSAGE aggregates features from neighboring time steps (as defined by the learned graph) to refine the representation of the most recent time step. This final representation is then passed through a simple output layer to generate the forecast.

Experimental Evaluation

The authors evaluated TimeGNN against five diverse multivariate benchmarks: Exchange-Rate, Weather, Electricity-Load, Solar-Energy, and Traffic. These datasets vary significantly in terms of variable count and temporal resolution.

Key Results

  • Efficiency and Scalability: TimeGNN demonstrates remarkable computational efficiency, achieving inference speeds 4x to 80x faster than state-of-the-art models like GTS and MTGNN. On the high-dimensional Traffic dataset (862 sensors), TimeGNN's inference time was approximately 6ms, compared to 260ms for GTS.
  • Forecasting Accuracy: Despite the focus on speed, TimeGNN maintains competitive accuracy. It consistently performs on par with or better than existing GNN-based models, particularly on longer forecasting horizons ($h=6$ or $h=9$).
  • Robustness: Unlike variable-centric models, TimeGNN’s computational cost is tied to the window length ($\tau$) rather than the number of variables ($m$). This allows it to scale gracefully to datasets with thousands of variables.

Discussion and Limitations

The "Time-as-Nodes" approach effectively implements a custom attention mechanism through graph topology, allowing the model to explicitly learn which historical time steps are most relevant to the current state. Because the graph is dynamic, TimeGNN is better suited for non-stationary data where temporal relationships shift over time.

However, the authors identify certain limitations. The model occasionally shows lower accuracy for very short-term predictions compared to highly optimized recurrent architectures. Additionally, the current forecasting head is relatively simple; the authors suggest that integrating a more sophisticated output module could further enhance performance.

Conclusion

TimeGNN represents a significant shift in how graphs are applied to time series forecasting. By prioritizing temporal dynamics over spatial correlations in the graph structure, the model achieves unprecedented inference speeds and superior scalability without sacrificing accuracy. This approach opens new possibilities for real-time forecasting in high-dimensional environments.

Summary updated

Abstract

Time series forecasting lies at the core of important real-world applications in many fields of science and engineering. The abundance of large time series datasets that consist of complex patterns and long-term dependencies has led to the development of various neural network architectures. Graph neural network approaches, which jointly learn a graph structure based on the correlation of raw values of multivariate time series while forecasting, have recently seen great success. However, such solutions are often costly to train and difficult to scale. In this paper, we propose TimeGNN, a method that learns dynamic temporal graph representations that can capture the evolution of inter-series patterns along with the correlations of multiple series. TimeGNN achieves inference times 4 to 80 times faster than other state-of-the-art graph-based methods while achieving comparable forecasting performance.
BibTeX
@inproceedings{xu2023timegnn,
  author = {Nancy Xu and Chrysoula Kosma and Michalis Vazirgiannis},
  title = {{TimeGNN: Temporal Dynamic Graph Learning for Time Series Forecasting}},
  booktitle = {COMPLEX NETWORKS},
  year = {2023},
  url = {https://openreview.net/forum?id=ZnxE61GPb9},
}
Figure