Energy-based Epistemic Uncertainty for Graph Neural Networks

Dominik Fuchsgruber, Tom Wollschläger, Stephan Günnemann

Abstract

In domains with interdependent data, such as graphs, quantifying the epistemic uncertainty of a Graph Neural Network (GNN) is challenging as uncertainty can arise at different structural scales. Existing techniques neglect this issue or only distinguish between structure-aware and structure-agnostic uncertainty without combining them into a single measure. We propose GEBM, an energy-based model (EBM) that provides high-quality uncertainty estimates by aggregating energy at different structural levels that naturally arise from graph diffusion. In contrast to logit-based EBMs, we provably induce an integrable density in the data space by regularizing the energy function. We introduce an evidential interpretation of our EBM that significantly improves the predictive robustness of the GNN. Our framework is a simple and effective post hoc method applicable to any pre-trained GNN that is sensitive to various distribution shifts. It consistently achieves the best separation of in-distribution and out-of-distribution data on 6 out of 7 anomaly types while having the best average rank over shifts on all datasets.

Introduction

Machine learning models often struggle to quantify their own "lack of knowledge," a property known as epistemic uncertainty. In graph-structured data, such as social networks or molecular graphs, this challenge is amplified because nodes are interdependent. Current research in graph uncertainty often suffers from two major flaws:

  1. Structural Blindness: Most methods treat nodes as independent entities, ignoring that uncertainty can manifest at different scales—from individual node features to broader neighborhood clusters.
  2. The Overconfidence Trap: Many Energy-Based Models (EBMs) used for uncertainty estimation rely on raw model outputs (logits) that are mathematically non-integrable. This leads to models becoming more confident as they move further from the training distribution, which is dangerous for safety-critical applications.

The GEBM Framework

To address these issues, we introduce GEBM (Graph Energy-Based Model), a post-hoc framework applicable to any pre-trained GNN. GEBM is built on two core innovations: multi-scale energy aggregation and Gaussian regularization.

Multi-Scale Energy Aggregation

GEBM captures uncertainty across different structural resolutions by varying the order of graph diffusion and class label marginalization. This produces three distinct energy types:

  • Independent Energy: Evaluates node features in isolation.
  • Local Energy: Diffuses information across neighborhoods before calculating uncertainty, capturing "disagreements" between a node and its neighbors.
  • Group Energy: Calculates uncertainty first and then smooths it across the graph, highlighting anomalous clusters.
Overview of the GEBM framework showing multi-scale energy aggregation across Group, Local, and Independent levels.

These energies are combined using a soft maximum selection to provide a single, comprehensive epistemic uncertainty score.

Gaussian Regularization

To prevent the overconfidence trap, GEBM incorporates a class-conditional Gaussian prior into the energy function. The authors provide a formal proof (Theorem 4.2) that this regularization ensures the model's probability density is integrable. This mathematical guarantee ensures that confidence correctly drops to zero as the model encounters data far from its training set.

Experimental Evaluation

The researchers evaluated GEBM against a wide range of benchmarks, including citation networks (CoraML, Citeseer, PubMed), co-purchase graphs (Amazon Photos, Computers), and co-author graphs (Physics, CS). The model was tested against seven types of distribution shifts, such as feature noise and class removal.

Comparative performance of GCN-GEBM against baselines across multiple datasets, highlighting its superior average rank and consistent performance.

Key Results

  • State-of-the-Art Detection: GEBM achieved the best or second-best performance in separating in-distribution data from anomalies on 6 out of 7 anomaly types.
  • Consistency: Across all tested datasets, GEBM maintained the best average rank across all types of distribution shifts.
  • Significant Gains: Compared to standard EBMs, GEBM improved the AUC-ROC by 5.8 to 10.9 percentage points, representing a relative improvement of up to 32%.
  • Robustness: GEBM maintained significantly higher classification accuracy than standard GNNs or other EBM baselines even when 100% of a node's neighbors were perturbed with noise.

Conclusion and Future Work

GEBM provides a theoretically grounded and practically effective method for quantifying epistemic uncertainty in GNNs. By leveraging multi-scale aggregation and Gaussian regularization, it avoids common pitfalls like structural blindness and overconfidence.

While GEBM excels at detecting epistemic uncertainty, it does not address aleatoric uncertainty (inherent data noise). Future work could explore extending the framework to handle heterophilic graphs—where connected nodes are dissimilar—and incorporating specific energy terms for structural features like node degree to further improve sensitivity to centrality shifts.

Summary updated

Abstract

In domains with interdependent data, such as graphs, quantifying the epistemic uncertainty of a Graph Neural Network (GNN) is challenging as uncertainty can arise at different structural scales. Existing techniques neglect this issue or only distinguish between structure-aware and structure-agnostic uncertainty without combining them into a single measure. We propose GEBM, an energy-based model (EBM) that provides high-quality uncertainty estimates by aggregating energy at different structural levels that naturally arise from graph diffusion. In contrast to logit-based EBMs, we provably induce an integrable density in the data space by regularizing the energy function. We introduce an evidential interpretation of our EBM that significantly improves the predictive robustness of the GNN. Our framework is a simple and effective post hoc method applicable to any pre-trained GNN that is sensitive to various distribution shifts. It consistently achieves the best separation of in-distribution and out-of-distribution data on 6 out of 7 anomaly types while having the best average rank over shifts on \emph{all} datasets.
BibTeX
@inproceedings{fuchsgruber2024energy,
  author = {Dominik Fuchsgruber and Tom Wollschläger and Stephan Günnemann},
  title = {{Energy-based Epistemic Uncertainty for Graph Neural Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=6vNPPtWH1Q},
}
Figure