Out-of-Distribution Detection in Heterogeneous Graphs via Energy Propagation

Tao Yin, Chen Zhao, Xiaoyan Liu, Minglai Shao · DOI

Introduction

Graph Neural Networks (GNNs) have become the standard for node classification tasks. However, a critical limitation in real-world applications is their tendency toward overconfidence when encountering Out-of-Distribution (OOD) samples—nodes that do not belong to any of the classes seen during training. While OOD detection is well-established for images and homogeneous graphs, it remains a significant challenge for heterogeneous graphs, which contain multiple types of nodes and edges (e.g., authors, papers, and venues in a citation network).

Existing OOD methods often treat these complex networks as flat, uniform structures, leading to substantial information loss. This paper introduces OODHG, a novel framework designed to leverage the rich structural relationships inherent in heterogeneous graphs to improve OOD detection accuracy.

Methodology: The OODHG Framework

OODHG addresses the limitations of standard GNNs through a multi-stage approach that emphasizes structural connectivity and energy-based scoring.

Overview of OOD detection in a heterogeneous graph, illustrating different node types, classes, and the concept of meta-paths.

1. Representation Learning

The framework utilizes a backbone Heterogeneous GNN, specifically SeHGNN, to learn robust node embeddings. This allows the model to capture the semantic nuances between different node and edge types, ensuring that the underlying representation is aware of the graph's heterogeneity.

2. Energy-Based Scoring

Rather than relying on softmax probabilities, which are notoriously prone to overconfidence, OODHG calculates an energy score from the raw model outputs (logits). In this paradigm, lower energy scores typically correspond to In-Distribution (ID) nodes, while higher scores indicate potential OOD samples.

3. Meta-path-based Energy Propagation

The core innovation of OODHG is the propagation of energy scores along meta-paths—predefined sequences of node types (e.g., Author-Paper-Author). By smoothing energy scores across these semantically relevant structural paths, the model can better distinguish between legitimate but rare ID nodes and true anomalies. This structural signal helps the model understand if a node's neighborhood behaves consistently with known distributions.

4. Joint Optimization

The model is trained using a dual loss function. It combines standard cross-entropy loss for classification with a squared hinge energy loss. This specific energy constraint penalizes ID nodes that exhibit high energy, effectively pushing the ID and OOD distributions further apart in the energy space.

Experimental Evaluation

The authors evaluated OODHG on three benchmark heterogeneous datasets: DBLP, ACM, and IMDB. In these experiments, specific node classes were designated as In-Distribution for training, while others were held out as OOD samples for testing.

Key Results

OODHG significantly outperformed state-of-the-art baselines like GNNSafe and OODGAT across several metrics:

  • OOD Detection Performance: On the DBLP dataset, OODHG achieved an AUROC of 98.11%, surpassing the best baseline (95.47%).
  • Error Reduction: The model drastically reduced the False Positive Rate (FPR@95). In the DBLP benchmark, the FPR dropped to 5.99%, compared to 16.20% for the nearest competitor.
  • Classification Integrity: Importantly, the focus on OOD detection did not degrade performance on the primary classification task; in many cases, the energy constraint improved the accuracy for known classes.

Discussion and Future Directions

The success of OODHG highlights that in heterogeneous graphs, structure is a signal. By using meta-paths to guide energy propagation, the model avoids the "over-smoothing" common in standard message-passing, which can often mask OOD signals.

Despite these gains, the authors note that the current framework relies on fixed parameters for propagation steps and weight coefficients. Future research could explore dynamic parameter adjustment to adapt to varying graph densities. Additionally, extending OODHG to dynamic graphs—where the network structure evolves over time—remains a vital next step for deploying these models in ever-changing real-world environments.

Summary updated

BibTeX
@article{yin2025out,
  author = {Tao Yin and Chen Zhao and Xiaoyan Liu and Minglai Shao},
  title = {{Out-of-Distribution Detection in Heterogeneous Graphs via Energy Propagation}},
  journal = {Knowledge-Based Systems},
  year = {2025},
  doi = {10.1016/j.knosys.2025.113667},
}
Figure