VisiFold: Long-Term Traffic Forecasting via Temporal Folding Graph and Node Visibility
Authors: Zhiwei Zhang, Xinyi Du, Weihao Wang, Xuanchi Guo, Wenjuan Han
Organizations: Key Laboratory of Big Data & Artificial Intelligence in Transportation (Beijing Jiaotong University), Ministry of Education · School of Computer Science and Technology, Beijing Jiaotong University, Beijing 100044, China · Beijing Normal University, Beijing, China
Traffic forecasting is a cornerstone of intelligent transportation systems. While existing research has made significant progress in short-term prediction, long-term forecasting remains a largely uncharted and challenging frontier. Extending the prediction horizon intensifies two critical issues: escalating computational resource consumption and increasingly complex spatial-temporal dependencies. Current approaches, which rely on spatial-temporal graphs and process temporal and spatial dimensions separately, suffer from snapshot-stacking inflation and cross-step fragmentation. To overcome these limitations, we propose VisiFold. Our framework introduces a novel temporal folding graph that consolidates a sequence of temporal snapshots into a single graph. Furthermore, we present a node visibility mechanism that incorporates node-level masking and subgraph sampling to overcome the computational bottleneck imposed by large node counts. Extensive experiments show that VisiFold not only drastically reduces resource consumption but also outperforms existing baselines in long-term forecasting tasks. Remarkably, even with a high mask ratio of 80%, VisiFold maintains its performance advantage. By effectively breaking the resource constraints in both temporal and spatial dimensions, our work paves the way for more realistic long-term traffic forecasting. The code is available at~ https://github.com/PlanckChang/VisiFold.
Figures & tables
Fig. 1 : From spatial-temporal graph to temporal folding graph. A spatial-temporal graph leads to snapshot-stacking inflation and cross-step fragmentation, thereby constraining the expansion of the forecasting horizon. Temporal folding graph collapses all attributes over time steps into a single node, thereby compressing a sequence of snapshots into a single graph.
Fig. 2 : Overview of VisiFold. VisiFold pipeline begins by building a temporal folding graph, from which token embeddings are derived via a linear transformation and fused with other embeddings. This is followed by node-level masking and subgraph sampling. The refined representations are then encoded by a Transformer encoder, and final predictions are generated by an MLP head.
Dataset
# Time Steps
Nodes
Time Range
Frequency
PEMS04
16992
307
2018/01 – 2018/02
288
PEMS08
17856
170
2016/07 – 2016/08
288
SEATTLE
8760
323
2015/01 – 2015/12
24
TABLE I : Summary of datasets.
Method
24 Time Steps
36 Time Steps
48 Time Steps
RMSE
MAE
MAPE
RMSE
MAE
MAPE
RMSE
MAE
MAPE
PEMS04
HA
81.57
56.47
45.49
106.58
76.01
68.84
127.28
93.37
94.62
VAR
41.09
27.19
21.42
45.44
30.48
24.51
49.46
33.50
27.28
DCRNN
42.86
28.70
21.23
51.40
33.78
27.10
57.85
38.26
33.73
GWNet
35.52
22.79
16.04
38.17
24.71
17.67
40.60
26.42
18.99
GMAN
38.10
21.67
17.78
52.86
22.12
16.43
47.85
23.35
17.98
TABLE II : Performance comparison in long-term scenarios. The values of the three metrics are the smaller, the better. The best results are indicated in bold , and the second-best results are underlined . VisiFold outperforms the baselines in the long-term task.
Fig. 3 : Resource consumption comparison. The numbers above the bars for Ours are absolute values, while those above the baseline indicate multiples relative to Ours . VisiFold gains a significant superiority in resource overhead.
Method
RMSE
MAE
MAPE
Full model
31.36
19.07
12.44
w/o Spatial Embedding
+8.22
+5.45
+4.20
w/o Dow Embedding
+0.19
+0.26
+0.18
w/o Tod embedding
+0.35
+0.29
+0.27
TABLE III : Ablation of embedding components. The full model reports absolute errors in PEMS04 24-step scenario; ablated variants report the error increase ( + ) relative to the full model. While all embeddings are helpful, spatial embeddings provide the majority of the contribution.
Fig. 4 : Performance and error bars of Full Model vs w/o Node Visibility . In the full version, which includes node-level masking and subgraph sampling, the average error decreases and the bar ranges narrow, indicating improved model stability and performance.
PEMS04
PEMS08
SEATTLE
Only TFG
704
514
706
w/ Node-level Masking
-10.23%
-8.56%
-6.23%
w/ Subgraph Sampling
-1.70%
-2.33%
-4.53%
Full Model
-12.22%
-10.86%
-11.33%
TABLE IV : Memory overhead (MB) of the ablation of node visibility. Only TFG uses absolute numbers, while the results with node visibility are reported as percentage reductions.
Fig. 5 : Analysis of mask ratio. We report the second-best performance from TABLE II as a reference. Even when 90% of the nodes are masked, we still observe performance gains. During training, both per-epoch time and memory consumption decrease as the mask ratio increases.
Method
RMSE
MAE
MAPE
Node-level
7.22
3.82
11.87
AllZero
+0.08
+0.05
+0.05
PartialZero
+0.09
+0.04
+0.05
RandomValue
+0.15
+0.07
+0.14
TABLE V : Masking strategies comparison. Node-level masking surpasses other strategies.
Fig. 6 : Analysis of subgraph size. We report the second-best performance from TABLE II as a reference. When the subgraph is relatively small, resource consumption generally follows a linear pattern; however, as the subgraph grows large enough to affect padding values, fluctuations occur in the right part. Selecting subgraph size requires a balance between performance and efficiency.
Method
24 Time Steps
36 Time Steps
48 Time Steps
RMSE
MAE
MAPE
RMSE
MAE
MAPE
RMSE
MAE
MAPE
PEMS04
TFG
31.70
19.36
12.84
32.57
19.92
13.23
33.90
20.70
13.61
SF
37.37
22.98
15.46
37.85
23.30
15.65
38.11
23.60
16.16
PEMS08
TFG
25.60
15.19
10.05
26.81
15.99
10.69
27.75
16.66
11.10
SF
35.92
21.45
13.75
36.70
21.76
14.09
36.48
21.59
14.15
TABLE VI : Comparison of folding strategies. The SF counterpart folding along the spatial dimension inferior to the TFG.
Fig. 7 : Illustration of traffic flow on the first day at Node 72, 95, and 111 in PEMS04. Node 72 and Node 95, being neighborhoods, exhibit similar flow patterns. Surprisingly, Node 111 also shows a similar trend, although it is not spatially adjacent to Node 72 and Node 95.
Dataset
Setting
24 Time Steps
36 Time Steps
48 Time Steps
RMSE
MAE
MAPE
RMSE
MAE
MAPE
RMSE
MAE
MAPE
PEMS04
VisiFold
31.36
19.07
12.44
32.52
19.78
12.92
33.23
20.27
13.35
Node-specific Etod and Edow
31.64
19.32
12.57
32.93
20.07
13.02
33.52
20.53
13.48
w/ Leader token (shared)
32.02
19.52
12.89
33.15
20.29
13.28
33.88
20.76
13.95
w/ Leader token (exclusive)
32.03
19.62
13.09
32.92
20.16
13.92
35.01
21.22
13.80
PEMS08
VisiFold
25.31
14.73
9.84
26.51
15.48
10.38
27.49
16.35
10.98
TABLE VII : Analysis of node-specific temporal embeddings and subgraph interaction scheme.
Fig. 8 : Visualizations of Etod , Edow , and Es .
Fig. 9 : Error analysis. VisiFold has learned the main trend patterns, but the prediction accuracy reduces during the traffic peak.