Energy-based Epistemic Uncertainty for Graph Neural Networks

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

TL;DR

GEBM (Graph Energy-Based Model) is a new post-hoc framework that provides high-quality epistemic uncertainty estimates for any pre-trained Graph Neural Network. By aggregating energy across multiple structural scales and applying a provably effective Gaussian regularizer, it achieves state-of-the-art performance in detecting out-of-distribution data across a wide variety of graph-based anomalies.

What Problem Does This Paper Address?

Quantifying uncertainty is essential for building reliable AI, especially in safety-critical applications. In the world of Graph Neural Networks (GNNs), this is particularly tricky because data is interdependent. Uncertainty isn't just about a single node; it can arise at different structural scales: a node might have weird features (independent), it might disagree with its neighbors (local), or it might belong to an entirely anomalous community (group).

Existing methods often ignore these structural nuances or fail to combine them into a single, usable measure. Furthermore, many popular "energy-based" models rely on the raw outputs (logits) of a classifier. The authors point out a fatal flaw here: because GNNs are typically built using piecewise affine functions, they tend to become arbitrarily overconfident far away from their training data. This means a standard energy-based model might actually signal high confidence for a data point it has never seen before, making it useless for Out-of-Distribution (OOD) detection.

Methods

The authors propose GEBM, a post-hoc method that requires no additional training of the underlying GNN. It introduces two major innovations:

  1. Multi-Scale Energy Aggregation: GEBM interleaves graph diffusion (smoothing information across the graph) with energy marginalization to capture three distinct types of uncertainty:
  2. Independent Energy: Captures uncertainty based on node features in isolation.
  3. Local Energy: Diffuses information before calculating uncertainty, making it sensitive to disagreements between a node and its immediate neighborhood.
  4. Group Energy: Calculates uncertainty before diffusing it, which smooths the signal and highlights anomalous clusters or "groups" within the graph.
Figure 1: Overview of the Graph Energy-based Model (GEBM). Graph-agnostic energy (uncertainty) of a trained GNN fθ(G) is first regularized to mitigate overconfidence and then aggregated at a local, cluster, and structure-independent scale by interleaving energy marginalization and graph diffusion. While group energy marginalizes before diffusion, local energy is fine-grained and can pick up conflicting evidence. GEBM assigns high uncertainty to several anomaly types simultaneously.
  1. Gaussian Regularization: To fix the overconfidence problem, GEBM adds a class-conditional Gaussian prior to the energy function. The authors provide a formal proof that this regularization ensures the model's "energy" actually increases (and confidence decreases) as you move further away from the training data, creating a mathematically sound and integrable density.

Finally, they show that GEBM can be interpreted as an evidential model. This allows the GNN to not just detect anomalies, but to remain robust during inference by "falling back" to a prior when it encounters high-uncertainty regions.

Datasets

The model was evaluated on seven common benchmark datasets for node classification:

  • Citation Networks: CoraML, CoraML-LLM, Citeseer, and PubMed.
  • Co-purchase Graphs: Amazon Photos and Amazon Computers.
  • Co-author Graphs: Coauthor-Physics and Coauthor-CS.

To test the limits of the model, the authors exposed these datasets to three families of distribution shifts: structural shifts (changing connectivity patterns), leave-out-class shifts (introducing new categories at test time), and feature perturbations (adding noise to node attributes).

Key Insights and Ideas

  • The Order of Operations Matters: One of the most elegant "aha" moments in the paper is that simply swapping the order of marginalization and diffusion naturally gives rise to different structural resolutions of uncertainty (Local vs. Group energy).
  • Integrability is Essential: The theoretical proof that standard logit-based EBMs fail to induce a valid density far from the training data is a significant contribution. It explains why previous models often failed under severe distribution shifts.
  • Post-hoc Efficiency: GEBM proves that you don't need expensive retraining or complex Bayesian architectures to get high-quality uncertainty. A well-regularized energy function applied to a standard pre-trained GNN is often superior.

Key Results

GEBM consistently outperformed a wide array of baselines, including ensembles, MC-dropout, and specialized evidential models like GPN.

  • OOD Detection: GEBM achieved the best or second-best separation of in-distribution and OOD data on 6 out of 7 anomaly types.
  • Global Ranking: On all tested datasets, GEBM held the best average rank across all types of distribution shifts.
  • Quantitative Gains: Compared to a vanilla energy-based model, GEBM improved AUC-ROC scores by an average of 5.8 to 10.9 percentage points (a 16%–32% relative improvement).
Table showing GEBM's superior average rank across all datasets and distribution shifts.

Limitations and Future Work

While GEBM is a powerful tool for epistemic uncertainty (lack of knowledge), the authors note it does not improve aleatoric uncertainty (inherent noise in the data). Improving the GNN's ability to handle noisy but "known" data remains a separate challenge.

Additionally, the current diffusion process is optimized for homophilic graphs (where similar nodes tend to connect). The authors suggest that extending GEBM to heterophilic graphs (where different nodes connect) is a promising avenue for future research. Finally, while GEBM is sensitive to most shifts, it was slightly less effective against centrality-based shifts (like PageRank), suggesting room for even more specialized energy terms.

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