Papers
Topics
Authors
Recent
Search
2000 character limit reached

Disentangled Graph Prompting for Out-Of-Distribution Detection

Published 31 Mar 2026 in cs.LG | (2603.29644v1)

Abstract: When testing data and training data come from different distributions, deep neural networks (DNNs) will face significant safety risks in practical applications. Therefore, out-of-distribution (OOD) detection techniques, which can identify OOD samples at test time and alert the system, are urgently needed. Existing graph OOD detection methods usually characterize fine-grained in-distribution (ID) patterns from multiple perspectives, and train end-to-end graph neural networks (GNNs) for prediction. However, due to the unavailability of OOD data during training, the absence of explicit supervision signals could lead to sub-optimal performance of end-to-end encoders. To address this issue, we follow the pre-training+prompting paradigm to utilize pre-trained GNN encoders, and propose Disentangled Graph Prompting (DGP), to capture fine-grained ID patterns with the help of ID graph labels. Specifically, we design two prompt generators that respectively generate class-specific and class-agnostic prompt graphs by modifying the edge weights of an input graph. We also design several effective losses to train the prompt generators and prevent trivial solutions. We conduct extensive experiments on ten datasets to demonstrate the superiority of our proposed DGP, which achieves a relative AUC improvement of 3.63% over the best graph OOD detection baseline. Ablation studies and hyper-parameter experiments further show the effectiveness of DGP. Code is available at https://github.com/BUPT-GAMMA/DGP.

Authors (4)

Summary

  • The paper introduces a dual-branch prompting framework combining class-specific and class-agnostic losses with frozen pre-trained GNNs.
  • The method achieves significant AUC improvements and reduces training time by up to 64ร— compared to state-of-the-art methods.
  • The explicit generation of prompt graphs enhances interpretability by highlighting discriminative substructures for reliable OOD detection.

Disentangled Graph Prompting for Out-of-Distribution Detection: Summary and Analysis

Introduction and Motivation

Graph neural networks (GNNs) have established themselves as effective tools for modeling structured data. However, their vulnerability to distribution shiftsโ€”where test data deviates from the in-distribution (ID) training regimeโ€”poses severe risks, especially in critical applications. This motivates the graph out-of-distribution (OOD) detection problem: distinguishing OOD graphs at test time to maintain reliable system behavior. While existing OOD detectors for graphs either rely on end-to-end training or leverage pre-trained encoders with prompting, these paradigms either lack fine-grained modeling of ID patterns or under-utilize the expressive capacity of prompting mechanisms.

The paper "Disentangled Graph Prompting for Out-Of-Distribution Detection" (2603.29644) systematically addresses these limitations by proposing the Disentangled Graph Prompting (DGP) framework. DGP combines the advantages of pre-training with frozen GNN encoders and decomposes graph prompting into class-specific and class-agnostic components to mine fine-grained ID patterns beyond what previous methods can achieve.

The DGP Framework

At the core of DGP is the pre-training+prompting paradigm. Instead of retraining GNNs end-to-end, DGP freezes well-trained encoders and learns prompt generators that modify edge weights in input graphs, thus yielding two views: a class-specific prompt and a class-agnostic prompt. The hypothesis is that class-specific prompts capture discriminative motifs for ID classification while class-agnostic prompts amplify shared invariants across all ID classes. This duality ensures both discriminative and invariant ID signals are exploited for robust OOD detection. Figure 1

Figure 1: An overview of Disentangled Graph Prompting, illustrating both class-specific and class-agnostic prompt generation alongside a frozen pre-trained GNN encoder.

The DGP training regime further involves carefully designed loss functions for both prompt generators:

  • A class-specific classification loss (cross-entropy to labels) emphasizes discriminative ID features.
  • A class-agnostic loss (cross-entropy to a uniform label distribution) enforces the extraction of invariants spanning all classes.
  • Explicit regularization via distance-based losses prevents trivial prompt solutions that simply reproduce the input or collapse all prompt graphs into similar forms.

This results in two decoupled prompt generators (realized as MLPs), which, during testing, produce prompt graphs whose representations are scored using the Mahalanobis distance, facilitating robust ID/OOD separation. Figure 2

Figure 2: The DGP training pipeline, detailing the generation of prompt graphs, dual branches for losses, and loss-based regularization to avoid triviality.

Experimental Evaluation

DGP is evaluated on ten OOD detection benchmarks, encompassing molecular, social, and bioinformatics domains. GNN encoders are pre-trained using self-supervised contrastive learning approaches (GCL and SimGRACE), aligning with SOTA protocol.

Key Empirical Results

  • DGP yields a relative AUC improvement of 3.63% over the strongest prior baseline (SEGO), with absolute AUCs exceeding 87% on average across the benchmarks.
  • Compared with naรฏve usage or fine-tuning of pre-trained GNNs (GCL, SimGRACE, GCL-ft, SimGRACE-ft), DGP achieves up to 19.86% (pre-trained) and 13.65% (fine-tuned) relative AUC improvements.
  • Ablations confirm that both class-specific and class-agnostic prompt branches are complementary; removing either degrades detection performance.
  • DGP attains 46โ€“64ร— reduction in training time compared to the SOTA competitors, highlighting its efficiency due to the frozen encoder. Figure 3

Figure 3

Figure 3

Figure 3

Figure 3

Figure 3

Figure 3

Figure 3

Figure 3

Figure 3

Figure 3: Visualization of Mahalanobis score distributions for ID/OOD graphs; post-prompting, the distributional overlap is substantially reduced, improving detection margins.

Figure 4

Figure 4

Figure 4: Ablation analysis of AUC versus DGP module variants and GNN encoder initialization; ablations verify the need for both branches and pre-training.

Figure 5

Figure 5: Comparative analysis of training times, showcasing the computational advantage of DGP over prior SOTA methods.

Prompt Interpretability and Hyperparameters

A salient feature of DGP is its interpretability: by explicitly generating prompt graphs, DGP enables analysis of which substructures are emphasized by each branch. Visualizations confirm that class-specific prompt graphs select salient subgraphs relevant for label discrimination, while class-agnostic prompts emphasize structures common to all ID samples. Figure 6

Figure 6

Figure 6

Figure 6

Figure 6

Figure 6

Figure 6

Figure 6

Figure 6: Case study visualizations of prompt graphs; top: class-specific (discriminative edges), bottom: class-agnostic (shared edges).

Hyperparameter studies demonstrate DGPโ€™s robust performance across a wide range of loss balancing parameters and MLP depths, with two-layer prompt generators generally optimal. Figure 7

Figure 7

Figure 7

Figure 7: Sensitivity of DGP AUC performance to major hyperparameters and MLP layer depth (on BZR-COX2 and PTC_MR-MUTAG).

Theoretical and Practical Implications

Theoretically, DGP substantiates the necessity of modeling fine-grained, disentangled patterns in OOD detection for structured data. Explicitly decomposing the prompt generation process into class-specific and class-agnostic branches leverages complementary inductive biases: one supporting discriminative partition of ID data, the other capturing invariants that regularize against spurious correlations. Moreover, by freezing GNN encoders, the approach decouples pattern mining from representational learning, reducing training instability and resource requirements.

Practically, DGPโ€™s computational efficiency and modular design make it suitable for deployment in real-world systems where model retraining is costly or undesirable. The explicit generation of prompt graphs potentially enhances explanation and debugging of OOD decisions, a factor of growing importance in safety-critical applications.

Future Directions

Potential extensions include designing more expressive prompt generator architectures capable of generating non-edge-centric (e.g., motif-based or subgraph-based) prompts, and adapting DGP to heterogeneous, dynamic, or attributed graphs common in real-world scenarios. Further, unifying prompting with causal inference frameworks may enable domain-adaptive OOD detectors with theoretical distributional guarantees.

Conclusion

The DGP framework advances graph OOD detection by disentangling prompt generation into complementary class-specific and class-agnostic losses, leveraging frozen pre-trained GNNs for efficient and effective processing. Extensive benchmarking demonstrates superior accuracy, robustness to hyperparameters, interpretability, and significant improvements in computational efficiency. The principles of disentangled modeling and pre-training+prompting developed in DGP offer a viable foundation for robust OOD detection in structured domains and present compelling avenues for further research in graph representation and AI safety (2603.29644).

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We found no open problems mentioned in this paper.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 1 tweet with 0 likes about this paper.