Organizations: School of New Media and Communication, Tianjin University, China · Department of Computer Science, Baylor University, USA · Key Lab of Education Blockchain and Intelligent Technology, Ministry of Education, Guangxi Normal University, China · Electrical Engineering and Computer Science Department, University of Arkansas, USA
Text-attributed graphs, where nodes are enriched with textual attributes, have become a powerful tool for modeling real-world networks such as citation, social, and transaction networks. However, existing methods for learning from these graphs often assume that the distributions of training and testing data are consistent. This assumption leads to significant performance degradation when faced with out-of-distribution (OOD) data. In this paper, we address the challenge of node-level OOD detection in text-attributed graphs, with the goal of maintaining accurate node classification while simultaneously identifying OOD nodes. We propose a novel approach, LLM-Enhanced Energy Contrastive Learning for Out-of-Distribution Detection in Text-Attributed Graphs (LECT), which integrates large language models (LLMs) and energy-based contrastive learning. The proposed method involves generating high-quality OOD samples by leveraging the semantic understanding and contextual knowledge of LLMs to create dependency-aware pseudo-OOD nodes, and applying contrastive learning based on energy functions to distinguish between in-distribution (IND) and OOD nodes. The effectiveness of our method is demonstrated through extensive experiments on six benchmark datasets, where our method consistently outperforms state-of-the-art baselines, achieving both high classification accuracy and robust OOD detection capabilities.
Figures & tables
Figure 1: The overall pipeline of LECT. Given a text-attributed graph, we first construct pseudo-OOD nodes by injecting random edges and generating their textual content with an LLM. We then derive node representations using a text encoder and a GNN with a projector. Energy scores are subsequently computed to form Linked IND–OOD Pairs and Triplet Contrastive Pairs for training. Finally, the model identifies OOD samples based on the resulting energy levels.
Cora
Citeseer
Pubmed
IND-Acc ↑
AUROC ↑
AUPR ↑
FPR95 ↓
IND-Acc ↑
AUROC ↑
AUPR ↑
FPR95 ↓
IND-Acc ↑
AUROC ↑
AUPR ↑
FPR95 ↓
MSP
86.72 ± 0.47
81.96 ± 1.38
43.37 ± 1.23
99.21 ± 0.43
75.36 ± 0.76
71.47 ± 1.29
30.81 ± 0.57
97.64 ± 0.89
92.68 ± 0.18
60.53 ± 3.38
48.67 ± 3.71
96.65 ± 0.94
ODIN
86.78 ± 0.21
80.76 ± 1.96
43.92 ± 4.48
62.74 ± 11.61
76.40 ± 0.50
70.60 ± 2.27
32.97 ± 3.78
79.77 ± 3.09
92.26 ± 0.29
59.86 ± 3.00
49.09 ± 4.07
92.39 ± 1.32
OSSNC
86.22 ± 0.41
82.32 ± 1.76
47.01 ± 4.34
97.51 ± 0.63
75.89 ± 0.40
72.14 ± 1.57
33.27 ± 1.67
96.23 ± 2.44
92.50 ± 0.28
61.14 ± 2.32
48.84 ± 2.38
97.22 ± 0.36
EMP
86.14 ± 0.58
82.12 ± 2.49
47.00 ± 5.30
60.91 ± 4.58
75.89 ± 0.51
70.16 ± 2.06
30.87 ± 2.27
79.26 ± 2.46
92.59 ± 0.31
61.44 ± 4.26
51.24 ± 4.63
92.90 ± 1.86
OODGAT
88.08 ± 0.65
80.31 ± 1.47
37.51 ± 4.25
49.09 ± 5.82
76.90 ± 0.65
68.43 ± 1.26
27.33 ± 2.49
97.72 ± 2.04
91.52 ± 0.26
70.08 ± 1.39
32.67 ± 3.99
96.55 ± 1.78
Table 1: OOD detection performance in terms of Ind-Acc, AUROC, AUPR, and FPR95 (mean ± std). Best results are bolded, second best are marked with a dash, and ↑ ( ↓ ) indicates that larger (smaller) values are better.
Figure 2: Ablation study results of LECT on the Cora , Citeseer , and Pubmed datasets, showing the performance without contrastive learning and without LLM-generated samples, respectively.
Figure 3: Ablation study results of LECT on the Cora , Citeseer , and Pubmed datasets, showing the performance without Lind-ood and without Ltriplet , respectively.
Figure 4: t-SNE visualization of node embeddings on the Cora for different baseline models and LECT.
Figure 5: t-SNE visualization and textual representation of the generated near-OOD and far-OOD samples on the Citeseer .
Figure 6: Heatmap of AUROC values for different sampling sizes of Linked IND-OOD pairs and Triplet Contrastive Pairs.
Graph Out-of-Distribution (OOD) detection aims to identify whether a test graph deviates from the distribution of graphs observed during training, which is critical for ensuring the reliability of Graph Neural Networks (GNNs) when deployed in open-world scenarios. Recent advances in graph OOD detection have focused on test-time training techniques that facilitate OOD detection without accessing potential supervisory information (e.g., training data). However, most of these methods employ a one-pass inference paradigm, which prevents them from progressively correcting erroneous predictions to amplify OOD signals. To this end, we propose a Self-Improving Graph Out-of-Distribution detector (SIGOOD), which is an unsupervised framework that integrates continuous self-learning with test-time training for effective graph OOD detection. Specifically, SIGOOD generates a prompt to construct a prompt-enhanced graph that amplifies potential OOD signals. To optimize prompts, SIGOOD introduces an Energy Preference Optimization (EPO) loss, which leverages energy variations between the original test graph and the prompt-enhanced graph. By iteratively optimizing the prompt by involving it into the detection model in a self-improving loop, the resulting optimal prompt-enhanced graph is ultimately used for OOD detection. Comprehensive evaluations on 21 real-world datasets confirm the effectiveness and outperformance of our SIGOOD method. The code is at https://github.com/Ee1s/SIGOOD.
Luzhi Wang, Xuanshuo Fu, He Zhang +3
College of Artificial Intelligence, Dalian Maritime University · Computer Vision Center, Universitat Aut`onoma de Barcelona · School of Computing Technologies, RMIT University +1
Detecting out-of-distribution (OOD) graphs is crucial for ensuring the safety and reliability of Graph Neural Networks. In unsupervised graph-level OOD detection, models are typically trained using only in-distribution (ID) data, resulting in incomplete feature space characterization and weak decision boundaries. Although synthesizing outliers offers a promising solution, existing approaches rely on fixed, non-adaptive sampling heuristics (e.g., distance- or density-based), limiting their ability to explore informative OOD regions. We propose a Policy-Guided Outlier Synthesis (PGOS) framework that replaces static heuristics with a learned exploration strategy. Specifically, PGOS trains a reinforcement learning agent to navigate low-density regions in a structured latent space and sample representations that most effectively refine the OOD decision boundary. These representations are then decoded into high-quality pseudo-OOD graphs to improve detector robustness. Extensive experiments demonstrate that PGOS achieves state-of-the-art performance on multiple graph OOD and anomaly detection benchmarks.
Li Sun, Lanxu Yang, Jiayu Tian +6
North China Electric Power University · Beijing University of Posts and Telecommunications · Tsinghua University +4
Graph neural networks are widely used for node classification, but they remain vulnerable to out-of-distribution (OOD) shifts in node features and graph structure. Prior work established that methods trained with standard supervised learning (SL) objectives tend to capture spurious signals from either features and/or structure, leaving the model fragile under distributional changes. To address this, we propose TIDE, a novel and effective Tri-Component Information Decomposition framework that explicitly decomposes information into feature-specific, structure-specific and joint components. TIDE aims to preserve only the label-relevant part of the joint information while filtering out spurious feature- and structure-specific information, thereby enhancing the separation between in-distribution (ID) and OOD nodes. Beyond the framework, we provide theoretical and empirical analyses showing that an information bottleneck objective is preferable to standard SL for graph OOD detection, with higher ID confidence and a greater entropy gap between ID and OOD data. Extensive experiments across seven datasets confirm the efficacy of TIDE, achieving up to a 34% improvement in FPR95 over strong baselines while maintaining competitive ID accuracy.