[Paper Review] Energy-based Out-of-Distribution Detection for Graph Neural Networks
The paper proposes GNNSafe, an energy-based OOD detector for graph neural networks that uses energy scores derived from GNN logits, augmented with an energy-based belief propagation scheme and optional energy regularization with OOD exposure. GNNSafe achieves substantial AUROC gains over state-of-the-art on graph OOD benchmarks while remaining efficient and model-agnostic.
Learning on graphs, where instance nodes are inter-connected, has become one of the central problems for deep learning, as relational structures are pervasive and induce data inter-dependence which hinders trivial adaptation of existing approaches that assume inputs to be i.i.d.~sampled. However, current models mostly focus on improving testing performance of in-distribution data and largely ignore the potential risk w.r.t. out-of-distribution (OOD) testing samples that may cause negative outcome if the prediction is overconfident on them. In this paper, we investigate the under-explored problem, OOD detection on graph-structured data, and identify a provably effective OOD discriminator based on an energy function directly extracted from graph neural networks trained with standard classification loss. This paves a way for a simple, powerful and efficient OOD detection model for GNN-based learning on graphs, which we call GNNSafe. It also has nice theoretical properties that guarantee an overall distinguishable margin between the detection scores for in-distribution and OOD samples, which, more critically, can be further strengthened by a learning-free energy belief propagation scheme. For comprehensive evaluation, we introduce new benchmark settings that evaluate the model for detecting OOD data from both synthetic and real distribution shifts (cross-domain graph shifts and temporal graph shifts). The results show that GNNSafe achieves up to $17.0\%$ AUROC improvement over state-of-the-arts and it could serve as simple yet strong baselines in such an under-developed area.
Motivation & Objective
- Address the lack of reliable OOD detection for graph-structured data where node inter-dependence exists.
- Introduce a simple, architecture-agnostic OOD detector (GNNSafe) based on energy scores extracted from GNN logits.
- Enhance detection with an energy-based belief propagation scheme leveraging graph topology.
- Explore training with optional OOD exposure to tighten energy gaps while preserving in-distribution performance.
Proposed method
- Model node classification with a GCN-based encoder to produce logits for each node.
- Define an energy function E(x, Gx, y; h) = -h_theta(x, Gx)[y] and free energy E(x, Gx) = -log sum_y exp(h_theta(x, Gx)[y]).
- Train with standard supervised loss to ensure energy decreases on in-distribution data (Proposition 1).
- Apply energy-based belief propagation: E^(k) = alpha E^(k-1) + (1 - alpha) D^{-1} A E^(k-1) to propagate energy across the ego-graph (Equation 7).
- Decision rule: OOD if the propagated energy tilde{E} <= tau; otherwise in-distribution (Equation 8).
- Optionally, add energy regularization with OOD exposure to bound energy within [t_in, t_out], preserving supervised learning (Equation 9 and Proposition 3).

Experimental results
Research questions
- RQ1Can an energy-based score derived from GNN logits effectively distinguish in-distribution from OOD samples on graphs?
- RQ2Does propagating energy over the graph topology improve OOD detection without retraining a density model?
- RQ3Does incorporating OOD exposure with an energy-regularized objective further strengthen OOD discrimination without hurting in-distribution accuracy?
- RQ4Is GNNSafe agnostic to GNN architecture and effective across multiple graph datasets and OOD types?
Key findings
- GNNSafe yields up to 17.0% average AUROC improvement over state-of-the-art on OOD detection benchmarks.
- Energy propagation consistently improves OOD detection performance over using Energy alone.
- GNNSafe++ (with energy regularization) further enhances the energy gap between in-distribution and OOD data in many settings.
- GNNSafe maintains competitive in-distribution accuracy while improving OOD reliability and efficiency.
- The approach is architecture-agnostic and applicable to off-the-shelf GNNs and graph transformers.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.