HGOE: Hybrid External and Internal Graph Outlier Exposure for Graph Out-of-Distribution Detection

Junwei He, Qianqian Xu, Yangbangyan Jiang, Zitai Wang, Yuchen Sun, Qingming Huang

Abstract

With the progressive advancements in deep graph learning, out-of-distribution (OOD) detection for graph data has emerged as a critical challenge. While the efficacy of auxiliary datasets in enhancing OOD detection has been extensively studied for image and text data, such approaches have not yet been explored for graph data. Unlike Euclidean data, graph data exhibits greater diversity but lower robustness to perturbations, complicating the integration of outliers. To tackle these challenges, we propose the introduction of Hybrid External and Internal Graph Outlier Exposure (HGOE) to improve graph OOD detection performance. Our framework involves using realistic external graph data from various domains and synthesizing internal outliers within ID subgroups to address the poor robustness and presence of OOD samples within the ID class. Furthermore, we develop a boundary-aware OE loss that adaptively assigns weights to outliers, maximizing the use of high-quality OOD samples while minimizing the impact of low-quality ones. Our proposed HGOE framework is model-agnostic and designed to enhance the effectiveness of existing graph OOD detection models. Experimental results demonstrate that our HGOE framework can significantly improve the performance of existing OOD detection models across all 8 real datasets.

Introduction

In real-world applications, machine learning models frequently encounter data that differs significantly from their training distribution. This "Out-of-Distribution" (OOD) data can lead to unpredictable model behavior. While OOD detection is well-established in computer vision and natural language processing, it remains a nascent field for graph-structured data.

Graphs present unique challenges for OOD detection due to two primary factors: structural diversity and low robustness to perturbations. Unlike images, where a slight change in pixels rarely changes the semantic class, a minor structural change in a graph (such as adding an atom to a molecule) can fundamentally alter its properties. This creates a razor-thin boundary between In-Distribution (ID) and OOD samples. The HGOE framework addresses these challenges by exposing models to a strategic mix of real-world external graphs and synthesized internal outliers.

The HGOE Framework

The HGOE framework is built upon three methodological pillars designed to refine the decision boundary of graph neural networks (GNNs).

1. External Outlier Exposure

To provide the model with a broad understanding of what "non-target" graphs look like, HGOE utilizes realistic external graph data from diverse public databases. By training on these cross-domain samples, the model learns to distinguish the general structural characteristics of the ID data from unrelated graph structures.

2. Internal Outlier Synthesis (ID-Mixup)

To address the "thin boundary" problem, the authors introduce a method for synthesizing outliers that reside near the edge of the training data. This process involves:

  • Subgroup Clustering: Clustering ID graphs into distinct subgroups.
  • Graphon Estimation: Estimating a "Graphon"—a mathematical template or probability distribution—for each subgroup.
  • Interpolation: Mixing these graphons to generate hybrid graphs. These synthesized samples represent the "gray area" between known subgroups, forcing the model to learn more precise distinctions.

3. External Feature Alignment

Synthesized graphs typically lack node features (e.g., atom types in a molecule). To resolve this, HGOE performs a structural search to "borrow" features from real external outliers that possess similar local topologies, ensuring the synthesized outliers are feature-complete and useful for training.

4. Boundary-Aware OE Loss

Not all outliers provide equal training value. HGOE employs a specialized loss function that adaptively weights samples. It prioritizes "near-boundary" outliers—those most likely to be confused with ID data—while reducing the penalty for synthesized outliers that might inadvertently resemble the In-Distribution data too closely.

Experimental Evaluation

The researchers evaluated HGOE across 8 real-world datasets from the TUDataset (e.g., AIDS, PROTEIN, IMDB) and the Open Graph Benchmark (e.g., Tox21, FreeSolv). OOD tasks were constructed by pairing datasets from similar domains (e.g., using one molecular dataset as ID and another as OOD).

Key Results

  • Consistent Performance Gains: HGOE improved the AUC of existing state-of-the-art (SOTA) models across all tested datasets. Notably, on the ENZYMES+PROTEIN task, AUC increased from 60.15% to 64.44%. On FreeSolv+ToxCast, performance rose from 78.79% to 82.89%.
  • Synergy of Hybrid Exposure: Ablation studies confirmed that the combination of external and internal outliers is superior to using either in isolation. The internal outliers, in particular, were found to be highly effective because their proximity to the decision boundary forces the model to develop sharper classification thresholds.
  • Model Agnostic Nature: HGOE functions as a training strategy rather than a specific architecture, making it compatible with various GNN backbones like GOOD-D or GLocalKD.

Discussion and Limitations

While HGOE shows significant promise, its effectiveness can vary based on domain. For instance, improvements on social network datasets (IMDB) were less pronounced than on molecular datasets. This suggests that the choice of "external" outliers matters; if the external data is too structurally distant from the ID data, its utility as a regularizer may decrease. Additionally, the structural feature alignment process, while effective, currently depends on the diversity and quality of the available external outlier pool.

Conclusion

HGOE represents a significant step forward in graph OOD detection. By combining the broad perspective of external outliers with the precision of graphon-based internal synthesis, the framework provides a robust solution to the challenges of graph structural diversity and sensitivity. Future work will likely focus on more sophisticated feature alignment techniques and the exploration of HGOE's performance under various types of distribution shifts.

Summary updated

Abstract

With the progressive advancements in deep graph learning, out-of-distribution (OOD) detection for graph data has emerged as a critical challenge. While the efficacy of auxiliary datasets in enhancing OOD detection has been extensively studied for image and text data, such approaches have not yet been explored for graph data. Unlike Euclidean data, graph data exhibits greater diversity but lower robustness to perturbations, complicating the integration of outliers. To tackle these challenges, we propose the introduction of \textbf{H}ybrid External and Internal \textbf{G}raph \textbf{O}utlier \textbf{E}xposure (HGOE) to improve graph OOD detection performance. Our framework involves using realistic external graph data from various domains and synthesizing internal outliers within ID subgroups to address the poor robustness and presence of OOD samples within the ID class. Furthermore, we develop a boundary-aware OE loss that adaptively assigns weights to outliers, maximizing the use of high-quality OOD samples while minimizing the impact of low-quality ones. Our proposed HGOE framework is model-agnostic and designed to enhance the effectiveness of existing graph OOD detection models. Experimental results demonstrate that our HGOE framework can significantly improve the performance of existing OOD detection models across all 8 real datasets.
BibTeX
@inproceedings{he2024hgoe,
  author = {Junwei He and Qianqian Xu and Yangbangyan Jiang and Zitai Wang and Yuchen Sun and Qingming Huang},
  title = {{HGOE: Hybrid External and Internal Graph Outlier Exposure for Graph Out-of-Distribution Detection}},
  booktitle = {ACM Multimedia},
  year = {2024},
  doi = {10.1145/3664647.3681118},
}
Figure