Graph Neural Stochastic Differential Equations

Richard Bergna, Felix L. Opolka, Pietro Liò, José Miguel Hernández-LobatoarXiv 2023 · DOI

Abstract

Graph Neural Networks (GNNs) have become the standard for modeling relational data, yet they often lack principled uncertainty quantification and struggle with continuous-time dynamics. We introduce Graph Neural Stochastic Differential Equations (Graph Neural SDEs), a framework that integrates the structural capabilities of GNNs with the probabilistic rigor of SDEs. By incorporating Brownian motion into the latent representation, our model provides built-in uncertainty quantification, outperforming standard GNNs and Graph Neural ODEs in both predictive accuracy and out-of-distribution detection.

Introduction

Modeling relational data in continuous time is a significant challenge in machine learning. While Graph Neural ODEs treat network layers as a continuous flow, they are inherently deterministic. Real-world systems, however, are often characterized by noise and stochasticity. Without a mechanism to quantify uncertainty, models may provide overconfident predictions on out-of-distribution (OOD) data, posing risks in safety-critical applications like traffic forecasting or biological modeling.

Methodology

The proposed Latent Graph Neural SDE framework models the evolution of graph representations through a stochastic process. Unlike an ODE, which only defines a deterministic "drift" function, an SDE includes a "diffusion" term that scales random noise (Brownian motion). This allows the model to represent a distribution of possible latent paths.

  1. Latent Representation: The model learns a latent state $z(t)$ using an Ornstein–Uhlenbeck (OU) process as a prior and learns an approximate posterior.
  2. Variational Inference: Training is performed by maximizing the Evidence Lower Bound (ELBO), minimizing the KL divergence between the predicted stochastic process and the prior to ensure the added noise is meaningful.
  3. Uncertainty Quantification: Predictions are generated by drawing multiple samples from the posterior. The mean of these samples provides the final prediction, while the variance serves as a direct measure of model uncertainty.

Experimental Evaluation

We evaluated the Graph Neural SDE across synthetic and real-world datasets. A key synthetic benchmark is a Voters Friendship Graph, where individuals' choices are influenced by their position on a "political compass" and their social connections.

The synthetic voting dataset setup, showing the relationship between political orientation (compass) and social network structure (friendship graph).

In addition to synthetic data, the model was tested on standard citation networks (CORA, Citeseer, Pubmed), the OGB arXiv dataset, and the METR-LA traffic speed dataset.

Results and Discussion

Experimental results highlight several key advantages of the SDE-based approach:

  • Data Efficiency: The model demonstrates a significant performance edge when training on limited data (e.g., 10-20%), suggesting that the continuous-time SDE approach captures the underlying graph geometry more effectively than discrete models.
  • Robust OOD Detection: By utilizing entropy (for classification) or variance (for regression) as a threshold, the model can identify and "refuse" to predict on uncertain data. In tests on the CORA dataset, the Graph Neural SDE achieved near-perfect accuracy when the entropy threshold was sufficiently low.
Performance comparisons showing the Graph Neural SDE's superior data efficiency (top) and its ability to maintain high accuracy by filtering uncertain predictions via entropy thresholds (bottom).
  • Intrinsic Robustness: The stochastic nature of SDEs acts as a form of intrinsic data augmentation, forcing the model to handle noise during training and improving generalization to unseen data.

Conclusion

Graph Neural SDEs provide a principled way to combine continuous-time modeling with uncertainty quantification in graph-structured data. While the computational cost of integrating SDEs is higher than that of standard GNNs, the gains in robustness and reliability are substantial. Future work will explore extending this framework to Bayesian Neural Networks (Graph BNN-SDEs) and Stochastic Partial Differential Equations (Graph SPDEs) to model even more complex spatio-temporal dynamics.

Summary updated

BibTeX
@misc{bergna2023graph,
  author = {Richard Bergna and Felix L. Opolka and Pietro Liò and José Miguel Hernández-Lobato},
  title = {{Graph Neural Stochastic Differential Equations}},
  year = {2023},
  eprint = {2308.12316},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.12316},
}
Figure