Estimating Epistemic Uncertainty of Graph Neural Networks using Stochastic Centering

Puja Trivedi, Mark Heimann, Rushil Anirudh, Danai Koutra, Jayaraman J. Thiagarajan

TL;DR

This paper introduces G-ΔUQ, a novel training framework that improves the intrinsic uncertainty estimates of Graph Neural Networks (GNNs) under distribution shifts. By adapting stochastic data centering with graph-specific anchoring strategies, G-ΔUQ enables more reliable uncertainty estimation for GNNs, even with partially stochastic models and pretrained networks.

What Problem Does This Paper Address?

Graph Neural Networks (GNNs) are increasingly used in critical applications, but their ability to reliably estimate uncertainty, especially when encountering data distributions different from their training data (distribution shifts), is not well understood. While existing methods can improve uncertainty estimates on "in-distribution" data, they often fail when the data distribution changes. This is problematic because accurate uncertainty estimates are crucial for safety-critical tasks like detecting out-of-distribution (OOD) samples and predicting generalization errors. The paper aims to develop GNNs that are intrinsically better at estimating uncertainty, even under these challenging shifted conditions.

Methods

The core of this work is the proposed G-ΔUQ framework, which adapts the "stochastic data centering" technique, previously successful in computer vision, to the domain of GNNs. This involves creating "anchored" representations of input data.

  • Stochastic Data Centering: The general idea is to simulate sampling from different "functional modes" of a model by creating relative representations of input samples with respect to random "anchors." This process helps capture epistemic uncertainty.
  • Graph Anchoring Strategies: The paper introduces novel anchoring strategies tailored for graph data, addressing challenges like discrete node features and variable graph sizes.
  • Node Feature Anchoring: For node classification, G-ΔUQ fits a Gaussian distribution over training node features to generate anchors. It then creates anchored representations by taking the residual between node features and sampled anchors. This approach leads to fully stochastic GNNs.
  • Hidden Layer Anchoring: For graph classification, this strategy anchors at intermediate hidden layers of the GNN. This incorporates structural information and results in partially stochastic GNNs, where earlier layers are deterministic.
  • READOUT Anchoring: This variant anchors at the final readout layer, making only the classifier stochastic. Crucially, this approach is compatible with pretrained GNN backbones, allowing for lightweight fine-tuning.

Datasets

The paper evaluates G-ΔUQ on various datasets for both node and graph classification tasks, including:

  • Node Classification: WebKB, Cora, and CBAS datasets with concept and covariate shifts.
  • Graph Classification: GOOD benchmark datasets (GOODCMNIST, GOODMotif-basis, GOODMotif-size, GOODSST2) with covariate and concept shifts.
  • Super-pixel Experiments: Rotated MNIST images to create super-pixel graphs with structural distribution shifts.
  • Feature Distribution Shifts: MNIST dataset with added Gaussian noise to node features.

Key Insights and Ideas

  • Partial Stochasticity is Sufficient: Contrary to the prevailing belief that fully stochastic networks are necessary for reliable uncertainty estimates, G-ΔUQ demonstrates that partially stochastic GNNs (achieved through hidden layer or readout anchoring) are sufficient. This offers computational benefits.
  • Anchoring is Key for Graphs: Simple input transformations used in vision don't translate to graphs. Novel graph-specific anchoring strategies are essential for effectively sampling diverse functional modes.
  • READOUT Anchoring for Pretrained Models: The READOUT anchoring strategy is particularly valuable as it allows G-ΔUQ to be applied as a lightweight fine-tuning method for pretrained GNNs, significantly improving their calibration without extensive retraining.
  • Intrinsic Uncertainty is Valuable: G-ΔUQ's focus on improving intrinsic uncertainty estimation means these improvements are available "out-of-the-box" and can be further enhanced by post-hoc calibration methods.
  • Expressivity vs. Calibration Trade-off: For some highly expressive GNN architectures (like G-Trans), there can be a trade-off between calibration and performance under severe distribution shifts, a phenomenon less observed in vision transformers. G-ΔUQ helps mitigate this.

Key Results

  • Improved Calibration: G-ΔUQ consistently leads to better calibrated GNNs for both node and graph classification tasks across various distribution shifts (covariate, concept, graph size). For instance, on GOODCora Degree under concept shift, G-ΔUQ reduced ECE from 0.307 to 0.13.
  • Enhanced Safety-Critical Tasks: G-ΔUQ significantly improves performance on tasks relying on uncertainty estimates, such as Out-of-Distribution (OOD) detection and Generalization Gap Prediction (GEP). For GEP, pretrained G-ΔUQ achieved the best performance across 6/8 datasets.
  • Competitive with Post-hoc Methods: G-ΔUQ not only improves calibration on its own but also enhances the effectiveness of existing post-hoc calibration techniques.
  • Pretrained Model Advantage: Applying READOUT anchoring to pretrained GNN backbones yields competitive, and often superior, OOD calibration compared to end-to-end G-ΔUQ training.
  • Minimal Accuracy Loss: G-ΔUQ generally maintains comparable or even improved accuracy while enhancing calibration.

Limitations and Future Work

  • Computational Overhead: G-ΔUQ requires modest additional computation during training and inference compared to vanilla GNNs.
  • Dependence on Shifted Data for Evaluation: While G-ΔUQ doesn't require a validation set for fitting (unlike some post-hoc methods), evaluating its benefits still relies on having access to out-of-distribution or shifted data.
  • Open Questions on Real-World Gains: The paper acknowledges that the exact extent to which improved uncertainty calibration translates to real-world safety and performance gains remains an open question.
  • Future Directions: The authors suggest further research into the interaction between GNN expressivity and calibration, and encourage more work on uncertainty quantification with guarantees for safety-critical applications. They also highlight the need for interdisciplinary collaboration between ML researchers and domain experts.

Summary updated

BibTeX
@inproceedings{trivedi2024estimating,
  author = {Puja Trivedi and Mark Heimann and Rushil Anirudh and Danai Koutra and Jayaraman J. Thiagarajan},
  title = {{Estimating Epistemic Uncertainty of Graph Neural Networks using Stochastic Centering}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=ZL6yd6N1S2},
}
Figure