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

GAS-PFN integrates graph structure into PFN priors for zero-shot cross-road-network traffic forecasting with 34% MSE reduction.
GAS-PFN (Graph-Aware Spatiotemporal Prior-Data Fitted Network) addresses the high deployment cost of traditional graph neural networks for traffic forecasting by explicitly incorporating road network topology into the synthetic task prior of a Prior-Data Fitted Network (PFN) through random-walk diffusion, teaching the model graph-coupled dynamic patterns during pre-training. At inference, it employs dual-channel mask-conditioned forward passes sharing a Transformer backbone to separately model sensor temporal dynamics and neighbor spatiotemporal interactions, leveraging target road network structure without parameter updates. On six benchmark datasets with a 90-minute forecasting horizon, GAS-PFN reduces MSE by an average of 34.0% versus TimePFN and 27.7% versus four general zero-shot forecasters. The method demonstrates that aligning PFN priors with graph structure significantly improves zero-shot traffic forecasting, offering a low-cost alternative for dynamic road network deployment.
Traffic forecasting has long been a core challenge in intelligent transportation systems, requiring simultaneous modeling of complex temporal dynamics and spatial dependencies determined by road network topology. Traditional supervised graph neural networks perform well on this task, but they are often trained for specific datasets and sensor graphs, making deployment to new road networks or dynamically changing networks costly. A recent paper proposes GAS-PFN (Graph-Aware Spatiotemporal Prior-Data Fitted Network), offering a zero-shot solution to this dilemma by explicitly incorporating graph structure into a Prior-Data Fitted Network (PFN), enabling cross-network traffic forecasting without parameter updates.

From PFN to Graph-Aware: A New Approach to Zero-Shot Forecasting
The core idea of PFN (Prior-Data Fitted Networks) is to learn contextual reasoning over synthetic task priors, thereby achieving zero-shot generalization capability. This mechanism provides an explicit entry point for encoding domain-specific assumptions: the design of the prior directly determines which patterns the model "innately" understands. However, existing forecasting-oriented PFNs do not explicitly represent the graph-structured dependencies that traffic dynamics follow, resulting in the loss of critical spatial coupling information in road network scenarios.
GAS-PFN's entry point lies precisely here: if the spatial correlation of traffic flow is determined by road topology, then the synthetic task prior should incorporate graph structure. The paper integrates sampled road topologies into the synthetic task prior through random-walk diffusion, teaching the model to learn graph-coupled dynamic patterns during pre-training. This means the model can leverage the structural information of the target road network at inference time, rather than relying on specific sensor graphs seen during training.
PFN (Prior-Data Fitted Network) is a class of meta-learning frameworks whose core idea is to pre-train a Transformer on large numbers of synthetic datasets sampled from a prior distribution, teaching it to "reason in context" rather than fit fixed parameters. At inference time, the model receives a short segment of labeled context data (e.g., recent traffic observations) and query points to be predicted, and directly outputs predictions through a single forward pass without gradient updates. This mechanism is called in-context learning. PFN's zero-shot capability depends heavily on the design of the prior distribution: the prior determines which data-generating mechanisms the model has "seen" during pre-training, thereby implicitly encoding task assumptions. If the prior does not incorporate graph structure, the model cannot leverage the spatial coupling information of road network topology at inference time.
Random-walk diffusion is a process for generating correlated signals on graph structures: starting from a node, a random walk proceeds among neighbors according to transition probabilities, and after multiple diffusion steps, a correlation pattern among nodes is obtained. In GAS-PFN, the paper first samples road topologies, then generates spatially coupled dynamics in synthetic tasks through random-walk diffusion, so that pre-training data naturally carries the regularity that "connected nodes influence each other." This is equivalent to embedding graph Laplacian smoothing or heat diffusion processes on graphs into the data generation prior, enabling the model to learn to recognize and exploit this spatial dependency during pre-training rather than inferring it from scratch at inference time.
Dual-Channel Inference Architecture: Separating Temporal and Spatial Modeling
GAS-PFN's inference architecture works in concert with the prior design. It employs two mask-conditioned forward passes sharing the same Transformer backbone: the first pass focuses on modeling the temporal dynamics specific to each sensor, while the second pass focuses on spatiotemporal interactions among neighboring sensors. The outputs of the two passes are then integrated for the final prediction.
The elegance of this design lies in the separation of responsibilities—temporal patterns and spatial interactions are guided by different mask conditions, preventing the two types of information from interfering with each other in a single channel. Meanwhile, the shared backbone ensures parameter efficiency, and the dual-channel structure enables the model to simultaneously leverage the structural information of the target network and context data without any parameter updates. For deployers, this means that when facing a new road network, no retraining or fine-tuning is needed—predictions can be obtained directly through inference.
Mask-conditioned forward pass refers to controlling the scope of information flow through attention masks in the Transformer input. In GAS-PFN, the first pass uses a mask that only allows attention between time steps of the same sensor, forcing the model to focus on modeling single-point temporal dynamics; the second pass uses a mask that allows attention across neighboring nodes, focusing the model on spatial interactions. Both passes share the same backbone parameters but achieve separation of responsibilities through different mask patterns. This approach is consistent with the ideas of causal masking or bidirectional masking in standard Transformers, with the difference being that here the masks are dynamically generated from the graph's adjacency relationships rather than fixed sequence order.
Performance Validation: Significantly Outperforming PFN Baselines and General Zero-Shot Forecasters
The paper evaluates on six benchmark datasets with a forecasting horizon of 90 minutes. Results show that GAS-PFN reduces MSE by an average of 34.0% relative to its closest PFN predecessor TimePFN, and by an average of 27.7% relative to four recently industry-developed general zero-shot forecasters. In the comparisons, all models receive 90 minutes of continuous recent history, with additional context extracted from each dataset's chronologically split training set.
These data demonstrate that aligning PFN's prior and inference architecture with graph structure can substantially improve the performance of in-context learning in zero-shot traffic forecasting. A 34.0% MSE reduction is considerable in forecasting tasks, especially considering it is achieved under zero-shot settings—the model is not trained on any test road network.
Implications for Traffic Forecasting Deployment
Urban road networks are in constant flux: new sensors, road modifications, and temporary closures all change the graph topology. Supervised models require re-collecting data and retraining each time such changes occur, with maintenance costs rising as network scale grows. The zero-shot approach represented by GAS-PFN offers a different operational paradigm—pre-train once, then rely on contextual reasoning to adapt to new graphs.
The paper's core contribution lies in demonstrating the value of "prior alignment": PFN's zero-shot capability does not hold unconditionally; its effectiveness depends on whether the prior encodes the key structure of the task. In traffic forecasting, this key structure is the graph. Introducing random-walk diffusion into the synthetic prior is essentially telling the model that "the world is composed of connected nodes," enabling in-context learning to truly understand spatial coupling. This approach also has reference value for other time series tasks with graph structure (such as energy networks and meteorological monitoring).
Of course, zero-shot methods are not meant to completely replace supervised training. In scenarios with abundant data and stable graph structure, purpose-trained graph neural networks may still retain accuracy advantages. GAS-PFN's value lies in providing a low-cost alternative for rapid deployment and dynamic networks, and in pointing out a previously overlooked dimension in PFN prior design.
One-line Summary
GAS-PFN integrates graph structure into PFN priors for zero-shot cross-road-network traffic forecasting with 34% MSE reduction.
Related articles
AWS AgentCore Gateway: Connecting AI A…
AWS AgentCore Gateway: Connecting AI Agents to Enterprise Backends with MCP
How AWS AgentCore Gateway acts as a primary MCP server to aggregate REST APIs, Lambda, and existing MCP services? Analyzing its AST real-time mapping, zero cold start, semantic search for tool overload, session isolation, and key injection security design, plus the architectural approach to decoupling enterprise AI agents from backends.

One Link Gives Figma AI a New Skill: Hands-On with MCP Connectors
Paste one MCP server link and the AI Agent in Figma gains new tool capabilities. We break down the setup flow, 20+ one-click apps, read/write permissions and execution policies, and the public HTTPS requirement.

Cognition SWE-2 in Practice: One Prompt to Handle the Whole Product Launch Process
Analyzing a YouTube creator's prompt for using Cognition SWE-2 to launch a product: a landing page, seven-email sequence, and non-buyer follow-up tool, plus how the 'test and report' constraint changes AI delivery quality.