Improving Generalization of Dynamic Graph Learning via Environment Prompt

Kuo Yang, Zhengyang Zhou, Qihe Huang, Limin Li, Yuxuan Liang, Yang Wang

Abstract / TL;DR The EpoD (Environment-prompted Dynamic Graph Learning) framework addresses the critical challenge of out-of-distribution (OOD) generalization in dynamic graphs. By utilizing a novel prompt-learning mechanism, EpoD infers hidden environmental factors and treats them as causal mediators that reshape graph subgraphs. This approach allows models to adapt to unseen temporal shifts—such as sudden changes in traffic patterns—far more effectively than standard spatio-temporal networks.

The Challenge: Temporal Out-of-Distribution Shifts

Deep learning models designed for dynamic graphs, such as traffic sensor networks or social platforms, frequently degrade when the underlying "environment" changes. For instance, a traffic forecasting model trained on 2019 data might fail dramatically when applied to 2020 data due to pandemic-induced shifts in human behavior. This phenomenon is known as a temporal out-of-distribution (OOD) problem.

Current research exhibits two major gaps in handling these shifts:

  1. The Inference Gap: Most existing models attempt to guess the environment using a predefined "codebook" (a fixed set of scenarios). This approach is often too rigid and heavily biased by human assumptions.
  2. The Utilization Gap: Even when models successfully identify an environmental change, they typically treat it merely as an additional feature (e.g., appending a "weather" tag). They fail to account for how the environment fundamentally alters the structural relationships between nodes. For example, heavy rain doesn't just slow down traffic; it changes the specific routes drivers choose to take.

The EpoD Framework: Prompting for Causal Structure

To bridge these gaps, EpoD introduces two novel mechanisms: Self-Prompted Learning and Causal Dynamic Subgraphs.

The EpoD framework architecture, illustrating the Self-Prompted Learning mechanism and the generation of dynamic subgraphs.

Self-Prompted Learning (SPL)

Inspired by the success of prompt learning in Large Language Models (LLMs), EpoD employs learnable "prompt tokens" for each node. Instead of relying on predefined categories, these tokens interact with historical data through a cross-attention mechanism. This acts as a latent sensor, "squeezing out" a compact, continuous representation of the hidden environment. This allows the model to be aware of contextual shifts it wasn't explicitly programmed to recognize.

Causal Dynamic Subgraphs

Rather than simply appending environment information to the input data, EpoD leverages a Structural Causal Model (SCM). It treats the inferred environment as a mediating variable that directly influences the graph's topology.

Using the inferred environment, the model extracts "node-centered subgraphs." By calculating the asymmetry (via KL-divergence) between the environment states of different nodes, EpoD identifies which connections are most relevant under current conditions. Because the influence of Node A on Node B isn't always symmetrical to B's influence on A, quantifying this "environment gap" allows EpoD to capture directional importance and dynamically prune or emphasize connections.

Experimental Setup and Key Results

The authors evaluated EpoD across seven real-world datasets and one custom toy dataset:

  • Traffic: PEMS04, PEMS08, SD (San Diego), and GBA (Greater Bay Area). The SD and GBA datasets specifically include 2019–2020 data to test COVID-19 distribution shifts.
  • Social/Link Prediction: COLLAB, Yelp, and ACT.
  • EnvST: A manually designed toy dataset with masked causal features and spurious correlations to verify the model's interpretability.

Superior Generalization

EpoD consistently outperformed state-of-the-art baselines like AGCRN and CaST. On large-scale datasets exhibiting major real-world shifts, such as the GBA traffic dataset, EpoD achieved a significant lead in Mean Absolute Error (MAE) and Root Mean Square Error (RMSE), proving its robustness.

Performance comparison of EpoD against baseline models on various traffic datasets, demonstrating superior OOD generalization.

Interpretability and Efficiency

In toy experiments, EpoD successfully ignored spurious features—data that appears correlated but lacks a causal relationship—and correctly identified masked environmental factors hidden from other models. Furthermore, despite the added complexity of prompting and subgraph extraction, EpoD maintains linear time complexity relative to the number of nodes and edges, making it highly practical for large-scale engineering applications.

Limitations and Future Directions

A primary limitation of the current EpoD model is its topology dependence. EpoD currently operates by filtering or weighting existing edges (K-hop neighbors) within a predefined graph. If an environmental shift creates entirely new types of relationships between nodes that were never connected in the original training graph, the model may struggle to identify them.

In future work, the research team aims to evolve the model to generate subgraphs from an "empty topology." This would allow the model to build the graph structure entirely from scratch based on the perceived environment and node distances, rather than merely pruning an existing framework.

Summary updated

BibTeX
@inproceedings{yang2024improving,
  author = {Kuo Yang and Zhengyang Zhou and Qihe Huang and Limin Li and Yuxuan Liang and Yang Wang},
  title = {{Improving Generalization of Dynamic Graph Learning via Environment Prompt}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=RJG8ar4wHA},
}
Figure