arXiv:2610.37598cs.LGOct 2026

Manuscript Offprint

arXiv:2610.37598

GAS-PFN: Graph-Aware Spatiotemporal Prior-Data Fitted Networks for Zero-Shot Traffic Forecasting

Joseph Natter, Long Vu, Yifan Zhang, Bobin Deng, Kun Suo, Rui Wu

Abstract

Traffic forecasting requires modeling both complex temporal dynamics and the spatial dependencies imposed by road topology. Supervised graph-based models achieve strong performance, but are typically trained for a particular dataset and sensor graph, making deployment to new or evolving networks costly. Prior-Data Fitted Networks (PFNs) offer a zero-shot alternative by learning in-context inference from synthetic task priors, which provide an explicit mechanism for encoding domain-specific assumptions. Existing forecasting PFNs, however, do not explicitly represent the graph-structured dependencies governing traffic dynamics.

To combine graph-aware traffic modeling with zero-shot adaptation, we introduce the Graph-Aware Spatiotemporal Prior-Data Fitted Network (GAS-PFN). GAS-PFN incorporates sampled road topology into its synthetic task prior through random-walk diffusion, teaching the model to learn graph-coupled dynamics during pretraining. Its co-designed inference architecture uses two mask-conditioned passes through a shared Transformer backbone to separately model sensor-specific temporal dynamics and spatiotemporal interactions among neighboring sensors before integrating their representations for prediction. This design enables GAS-PFN to use target-network structure and context without parameter updates.

Across six benchmarks at the 90-minute horizon, GAS-PFN reduces MSE by 34.0% on average relative to TimePFN, its closest PFN-based predecessor. It also reduces MSE by 27.7% on average relative to four recent industry-developed general-purpose zero-shot forecasters. In this comparison, all models receive 90 minutes of contiguous recent history, and any additional context is drawn from each dataset's chronological training split. These results indicate that aligning PFN priors and inference architectures with graph structure improves in-context learning for zero-shot traffic forecasting.

Introduction

Traffic conditions evolve over a road network, and congestion on one road can affect connected roads. Road topology shapes these interactions, but the patterns that actually emerge also depend on changing factors such as travel demand, incidents, weather, and human behavior, making them difficult to capture with a fully specified mechanistic model. Deep neural models provide a flexible means of learning these nonlinear spatiotemporal relationships directly from data, and graph neural networks and Transformer-based models have consequently achieved strong forecasting performance (Li et al. 2018; Wu et al. 2020; Jiang et al. 2023; Liu et al. 2023).

Despite their strong performance, these models are typically trained for a particular dataset and sensor graph, requiring substantial data and computation when deployed to a new road network or adapted to changes in an existing one. Prior work reports that training a forecasting model on approximately one third of California's highway network required nearly eight GPU-days (Mallick et al. 2020; Prabowo et al. 2024). Traffic-sensing deployments are also not static: sensors may be added, removed, or relocated, while sensor failures and communication interruptions can break the recent observation history even when older measurements remain available (Zuo et al. 2023). These conditions motivate forecasting methods that can adapt to a target network without repeated parameter optimization or reliance on a long uninterrupted recent history.

Recent time-series foundation models, including Chronos-2, TimesFM-2.5, Moirai-2, and Lag-Llama, address the need for forecasting without task-specific retraining and have demonstrated strong zero-shot performance across heterogeneous datasets (Ansari et al. 2025; Das et al. 2024; Liu et al. 2025; Rasul et al. 2024). However, these models are primarily designed as general-purpose sequence forecasters and do not explicitly incorporate the relational structure of road networks. This leaves a conceptual gap between transferable zero-shot forecasting and graph-aware traffic modeling.

Prior-Data Fitted Networks (PFNs) offer one emerging route toward bridging this gap by framing zero-shot prediction as in-context inference (Müller et al. 2022; Hollmann et al. 2023). During pretraining, PFNs learn from synthetic tasks sampled from a prior to approximate Bayesian posterior predictive inference from context examples and a query. Their synthetic task priors provide an explicit mechanism for representing domain-specific assumptions, while inference-time conditioning enables adaptation without gradient-based optimization (i.e., training or fine-tuning). Recent work has extended this framework to time-series forecasting (Taga, Ildiz, and Oymak 2025); however, existing time-series PFNs do not explicitly incorporate known graph topology into either their synthetic task priors or inference architectures.

Copyright © 2027, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved.

A) Spatiotemporal Prior

Figure

B) Mixed Context Memory

C) Token Embedder

D) Dual Mask-Conditioned Backbone

Figure

E) Gated Fusion

Figure

Figure 1: High-level overview of GAS-PFN. The method constructs graph-structured prior tasks, assembles mixed-context memory, embeds context and query patches as tokens, applies dual mask-conditioned backbone inference, and fuses the branch outputs to produce zero-shot forecasts.

Building on this idea, this work introduces the Graph-Aware Spatiotemporal Prior-Data Fitted Network (GAS-PFN), which proposes PFN-style forecasting for graph-structured traffic signals. GAS-PFN is pretrained on synthetic tasks in which interactions among channels are generated by diffusion over sampled road-network topologies. This exposes the model to spatially coupled temporal processes rather than treating each series as independent or only implicitly related. At inference time, GAS-PFN performs two differently masked passes through a shared Transformer backbone. A sensor-local pass restricts interactions to observations from the same sensor, capturing its intrinsic temporal dynamics. A neighborhood-aware pass allows interactions across both time and neighboring sensors, capturing graph-conditioned spatiotemporal dependencies. The resulting representations are then fused for prediction. By conditioning on both recent measurements and historical examples from the target network, GAS-PFN adapts through in-context learning rather than task-specific parameter updates.

Evaluation across six traffic forecasting benchmarks and three prediction horizons shows that GAS-PFN achieves the strongest overall zero-shot performance under the limited-recent-history protocol. At the 90-minute horizon, it obtains the best MAE and MSE on five of six datasets and achieves lower average MSE than both TimePFN and four recent general-purpose zero-shot forecasters. GAS-PFN also outperforms supervised SCPT when target-road training coverage is limited. These results indicate that encoding graph structure in both the synthetic prior and inference architecture improves zero-shot forecasting under limited recent context.

Contributions. The main contributions are as follows:

• A graph-aware synthetic task prior that uses road-network topology and random-walk diffusion to expose a PFN to graph-coupled spatiotemporal dynamics during pretraining.

• A co-designed inference architecture that separately models sensor-specific temporal dynamics and spatiotemporal interactions among neighboring sensors, enabling the model to exploit its graph-aware prior during zero-shot prediction.

• A comprehensive evaluation across six traffic forecasting benchmarks and three prediction horizons, in which GAS-PFN achieves the best result in 27 of 36 MAE/MSE comparisons and outperforms supervised SCPT when target-road training coverage is limited.