Graph Synthetic Out-of-Distribution Exposure with Large Language Models

Haoyan Xu, Zhengtao Yao, Ziyi Wang, Zhan Cheng, Xiyang Hu, Mengyuan Li, Yue Zhao · DOI

Introduction

Graph Neural Networks (GNNs) have demonstrated remarkable success in modeling structured data, yet they suffer from a critical vulnerability: overconfidence. When presented with nodes from categories unseen during training—referred to as Out-of-Distribution (OOD) nodes—GNNs often classify them into known In-Distribution (ID) classes with high certainty. This lack of reliability poses significant risks in safety-critical applications like fraud detection or medical diagnosis.

A promising solution is OOD Exposure, where models are trained using auxiliary OOD examples to learn the boundaries of "unknown" space. However, obtaining real OOD labels for graphs is labor-intensive and often impractical in open-world scenarios. This paper introduces GOE-LLM, a novel framework that leverages the semantic reasoning of Large Language Models (LLMs) to synthesize OOD exposure without requiring any real OOD labels.

Methodology: The GOE-LLM Framework

GOE-LLM is designed for Text-Attributed Graphs (TAGs), where nodes are associated with textual descriptions (e.g., abstracts in citation networks). The framework utilizes LLMs (such as GPT-4o-mini) to create a "distributionally-aware semantic prior" through two distinct strategies:

The GOE-LLM framework illustrating the Identifier and Generator pipelines for creating pseudo-OOD nodes.
  1. GOE-identifier (The Scout): In transductive settings, the LLM analyzes a sample of unlabeled nodes within the existing graph. By comparing node text against known ID class descriptions, the LLM identifies nodes that do not fit any category, labeling them as "pseudo-OOD."
  2. GOE-generator (The Architect): The LLM is prompted to generate entirely synthetic text descriptions for potential OOD categories. These synthetic nodes are embedded and integrated into the graph structure to serve as training negatives.

Training with Energy-Based Regularization

The identified or generated pseudo-OOD nodes are used to regularize a standard GNN (e.g., GCN). The model is trained using a specialized loss function that penalizes low energy (high confidence) for OOD nodes while maintaining high energy for ID nodes. This process effectively "tightens" the decision boundaries around known classes, improving the model's ability to flag anomalies.

Experimental Setup

The framework was evaluated on four benchmark TAG datasets: Cora, CiteSeer, PubMed, and Wiki-CS. To simulate real-world OOD detection, specific classes were held out as OOD during training and used only for evaluation. The performance was measured using standard metrics: ID Classification Accuracy (ID ACC), Area Under the Receiver Operating Characteristic curve (AUROC), and Area Under the Precision-Recall curve (AUPR).

Key Results and Discussion

GOE-LLM demonstrates significant improvements over state-of-the-art methods that do not utilize OOD exposure. As shown in the results table, the framework consistently outperforms baselines like MSP, Energy, and GNNSafe across all datasets.

Performance comparison of GOE-LLM against various baselines across four benchmark datasets.

Performance Highlights

  • Significant Gains: On the PubMed dataset, GOE-LLM achieved a 23.5% relative improvement in AUROC compared to the best non-exposure baseline.
  • Matching the Gold Standard: Remarkably, GOE-LLM performs on par with GNNSafe++, a method that requires access to real OOD labels. This suggests that LLM-generated synthetic OOD nodes are highly effective proxies for real-world anomalies.
  • Efficiency: The study found that a small amount of synthetic data is sufficient; adding just 10 to 20 synthetic nodes per class was enough to reach near-peak performance.
  • Preserving ID Accuracy: Unlike some regularization techniques that degrade primary task performance, GOE-LLM maintains or even slightly improves ID classification accuracy while boosting OOD detection.

Conclusion

GOE-LLM addresses the scarcity of OOD labels in graph learning by utilizing LLMs as automated annotators and generators. By providing a "noisy" but semantically rich training signal, the framework allows GNNs to learn more robust decision boundaries. While currently limited to text-attributed graphs, future work aims to extend these concepts to non-textual domains and more complex graph topology learning. GOE-LLM represents a significant step toward building reliable and self-improving graph AI systems for the open world.

Summary updated

BibTeX
@misc{xu2025graph,
  author = {Haoyan Xu and Zhengtao Yao and Ziyi Wang and Zhan Cheng and Xiyang Hu and Mengyuan Li and Yue Zhao},
  title = {{Graph Synthetic Out-of-Distribution Exposure with Large Language Models}},
  year = {2025},
  eprint = {2504.21198},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.21198},
}
Figure