---
title: Disentangled Graph Prompting
url: https://www.emergentmind.com/topics/disentangled-graph-prompting-dgp
type: topic
---

# Disentangled Graph Prompting

Disentangled Graph Prompting (DGP) denotes a graph prompting paradigm in which prompt-conditioned adaptation is separated into distinct factors rather than implemented as a single undifferentiated prompt transformation. In the most explicit current usage, DGP is a graph out-of-distribution (OOD) detection framework that follows the pre-training+prompting paradigm, freezes a pre-trained graph neural network (GNN) encoder, and learns two prompt generators that capture **class-specific** and **class-agnostic** in-distribution (ID) patterns by modifying graph edge weights [2603.29644]. In a broader methodological sense, DGP is situated within graph prompt learning, where prompting reformulates graph inputs, representations, or task interfaces so that downstream prediction better aligns with the space or objective of pre-training [2303.07275][2506.08326].

## 1. Terminology and scope

The expression “Disentangled Graph Prompting” is not used uniformly across the literature. Two graph prompting surveys do **not explicitly mention** a method named DGP, and neither survey introduces disentanglement as a formal prompting subfamily with dedicated losses or a standalone taxonomy item [2303.07275][2506.08326]. This has two consequences. First, DGP is not a survey-standard label in the way that **discrete graph prompt**, **continuous graph prompt**, **data-level prompting**, or **representation-level prompting** are. Second, many methods relevant to DGP are described instead through terms such as **dual prompts**, **hop-specific prompts**, **disentangled structure prompt**, **decoupled prompting**, or **factorized prompt design**.

A recurrent misconception is that every paper abbreviated “DGP” refers to Disentangled Graph Prompting. This is not the case. In fraud detection with graph-enhanced large language models (LLMs), DGP stands for **Dual-Granularity Prompting**, a method that keeps the target node at fine granularity while compressing neighbors into coarse-grained summaries; the paper explicitly states that its DGP does **not** expand to Disentangled Graph Prompting [2507.21653]. By contrast, the 2026 OOD-detection method uses the exact name **Disentangled Graph Prompting** and defines disentanglement operationally through separate modeling of class-specific and class-agnostic ID structure [2603.29644].

The literature therefore supports two complementary uses of the term. In the narrow sense, DGP refers specifically to the OOD-detection framework of [2603.29644]. In the broader sense, it refers to graph prompting designs that separate prompt behavior across meaningful factors such as semantics and structure, node and time, low-hop and high-hop information, or class-specific and class-agnostic evidence. This broader use is interpretive, but it is strongly suggested by the way recent prompting methods decompose prompt generation and injection.

## 2. Position within graph prompting taxonomies

Graph prompt learning is typically framed as a **pre-train, prompt, predict** paradigm:
\[
x' = f_{\mathrm{prompt}}(x; \theta_{\mathrm{prompt}}),
\]
followed by answer mapping
\[
z = \arg\max_{z' \in \mathcal{Z}} P(f(x'), z').
\]
In this formulation, prompting differs from standard fine-tuning by emphasizing **input reformulation rather than objective engineering**, reducing the **training objective gap**, and often using fewer trainable parameters [2303.07275].

The 2023 survey organizes graph prompting into **discrete** and **continuous** graph prompts, with each further divided into **manual prompt**, **node-level prompt**, and **topology-level prompt** [2303.07275]. The 2025 survey instead classifies methods by intervention point: **data-level prompting**
\[
(\tilde{\mathbf{A}}, \tilde{\mathbf{X}}) = \mathcal{T}^D((\mathbf{A}, \mathbf{X}); \mathcal{P}),
\]
**representation-level prompting**
\[
\tilde{\mathbf{H}}^{(l)} = \mathcal{T}^R(\mathbf{H}^{(l)}; \mathcal{P}),
\]
and **task-level prompting**
\[
\tilde{\mathcal{L}}_{DT} = \mathcal{T}^T(\mathcal{L}_{DT}; \mathcal{P})
\]
[2506.08326].

These taxonomies do not define a disentanglement category, but they provide the conceptual location in which DGP is best understood. A disentanglement-based graph prompting method would most naturally fit as a **continuous graph prompt**, likely **topology-level** or **hybrid** if it separates structural and semantic factors [2303.07275]. The later survey also suggests a factorized view through modular prompt forms such as **feature prompts**, **insertion-based prompts**, **edge prompts**, **class prototype prompts**, **conditional prompt generators**, and **multi-task composed prompts** [2506.08326].

This suggests that DGP is not a separate prompting primitive so much as a structured design principle layered on top of existing prompt families. In practice, a DGP-style method may disentangle by prompt location, by graph factor, by task interface, or by granularity. The surveys further indicate what they do **not** provide for DGP: no standard disentanglement loss, no unified factor-decomposition template, and no canonical benchmark protocol dedicated to disentanglement itself.

## 3. Canonical formulation: DGP for graph OOD detection

The clearest formalization of Disentangled Graph Prompting appears in graph-level OOD detection [2603.29644]. The setting assumes access only to an ID training distribution
\[
\mathcal{D}_{\text{ID}} = \{(G^k, y^k)\}_{k=1}^N,
\]
where each graph is
\[
G^k = \{\mathcal{V}^k, \mathcal{E}^k, X^k\}.
\]
At test time, a detector must distinguish graphs from \(\mathcal{P}_{\text{ID}}\) and \(\mathcal{P}_{\text{OOD}}\), even though OOD samples are unavailable during training [2603.29644].

The method adopts a **pre-training + prompting** protocol. A graph encoder \(f\) is first pre-trained self-supervisedly, for example with GraphCL or SimGRACE, and then frozen. Prompting is performed not by adding prompt tokens or synthetic nodes, but by **reweighting the edges of the input graph** through two separate prompt generators:
- a **class-specific** prompt generator \(\phi_1\),
- a **class-agnostic** prompt generator \(\phi_2\).

Given node embeddings \(a_i^k\) from the frozen GNN, each existing edge is rescored as
\[
A_{ij}^{k,*} = \operatorname{MLP}(\operatorname{CONCAT}(a_i^k, a_j^k); \Omega).
\]
DGP learns two such prompted adjacency matrices:
\[
A^{k,1} = \phi_1(G^k; \Omega_1), \qquad A^{k,2} = \phi_2(G^k; \Omega_2).
\]
Only **existing edges** are reweighted. This design preserves linear dependence on the number of edges and avoids explicit edge synthesis [2603.29644].

The paper uses “disentangled” in a restricted but concrete sense. It does **not** define a latent-variable disentanglement model with orthogonality, mutual-information minimization, or identifiability guarantees. Instead, it disentangles ID pattern mining into two complementary branches. The class-specific branch is trained to expose graph structure predictive of the graph’s ID label. The class-agnostic branch is trained to preserve structure shared across ID graphs while suppressing class discrimination. The prompted graphs are then encoded by the same frozen GNN, so the disentanglement lies in prompt generation rather than in backbone parameterization.

This formulation is distinctive within graph prompting. The prompt object is the graph itself after edge reweighting; the frozen encoder is reused as a representation extractor; and the prompting objective is not ordinary task adaptation but OOD sensitivity under absent OOD supervision. In that sense, DGP treats OOD detection as post-hoc graph adaptation rather than end-to-end encoder learning [2603.29644].

## 4. Objectives, optimization, and OOD scoring

The class-specific prompted graph is encoded as
\[
h^{k,1} = f(A^{k,1}, X^k; \Theta),
\]
and classified by
\[
z^{k,1} = \operatorname{softmax}(\operatorname{MLP}(h^{k,1}; \Psi)).
\]
Its loss is ordinary cross-entropy against the true label:
\[
\mathcal{L}_{\text{class-specific}}
=
\frac{1}{|\mathcal{D}_{\text{ID}}|}
\sum_{G^k \in \mathcal{D}_{\text{ID}}}
\operatorname{CE}(y^k, \log(z^{k,1})).
\]
The class-agnostic branch uses the same frozen encoder and predictor,
\[
h^{k,2} = f(A^{k,2}, X^k; \Theta), \qquad
z^{k,2} = \operatorname{softmax}(\operatorname{MLP}(h^{k,2}; \Psi)),
\]
but aligns predictions with a **uniform class distribution** \(\bar y\):
\[
\mathcal{L}_{\text{class-agnostic}}
=
\frac{1}{|\mathcal{D}_{\text{ID}}|}
\sum_{G^k \in \mathcal{D}_{\text{ID}}}
\operatorname{CE}(\bar y, z^{k,2}).
\]
The combined objective is
\[
\mathcal{L}_{\text{disentangle}}
=
\mathcal{L}_{\text{class-specific}}
+
\lambda \mathcal{L}_{\text{class-agnostic}}.
\]
Here, the class-specific generator learns discriminative ID patterns, whereas the class-agnostic generator is encouraged to suppress label-specific evidence and retain shared ID fingerprints [2603.29644].

The paper further argues that these losses alone can induce trivial solutions, such as assigning uniformly high weights to all edges. To avoid this, DGP adds distance-based regularization built from Mahalanobis scores:
\[
\mathcal{L}_{\text{distance-1}}
=
\frac{1}{|\mathcal{D}_{\text{ID}}|}
\sum_{G^k \in \mathcal{D}_{\text{ID}}}
\operatorname{MD}(h^{k,1}),
\]
\[
\mathcal{L}_{\text{distance-2}}
=
\frac{1}{|\mathcal{D}_{\text{ID}}|}
\sum_{G^k \in \mathcal{D}_{\text{ID}}}
\operatorname{MD}(h^{k,2}),
\]
and
\[
\mathcal{L}_{\text{dis}}
=
\frac{\alpha_1}{\mathcal{L}_{\text{distance-1}}}
+
\frac{\alpha_2}{\mathcal{L}_{\text{distance-2}}}.
\]
Training alternates between minimizing \(\mathcal{L}_{\text{disentangle}}\) over \(\Omega_1,\Omega_2,\Psi\) and minimizing \(\mathcal{L}_{\text{dis}}\) over \(\Omega_1,\Omega_2\) with \(\Psi\) fixed [2603.29644].

At inference, DGP discards the classifier and scores each test graph by a sum of Mahalanobis terms from the two prompted views:
\[
S(G^t)
=
\operatorname{MD}(f(\phi_1(G^t; \Omega_1), X^t; \Theta))
+
\gamma\,\operatorname{MD}(f(\phi_2(G^t; \Omega_2), X^t; \Theta)).
\]
Higher scores indicate greater consistency with the ID representation distribution. This yields a detector that is simultaneously sensitive to missing **class-specific** and **class-agnostic** ID structure [2603.29644].

## 5. Empirical evidence and interpretive findings

The OOD-detection DGP paper evaluates on ten dataset pairs spanning **molecular**, **bioinformatics**, and **social network** domains and reports that DGP achieves a **relative AUC improvement of 3.63% over the best graph OOD detection baseline** [2603.29644]. In the main AUC table, **SEGO** has average AUC \(84.46\%\), **DGP-GCL** reaches \(87.00\%\), and **DGP-Sim** reaches \(86.48\%\). The method is reported to achieve state of the art on **8 of 10** dataset pairs, with especially strong results on **BZR \(\rightarrow\) COX2**, **PTC\_MR \(\rightarrow\) MUTAG**, **ENZYMES \(\rightarrow\) PROTEIN**, **Tox21 \(\rightarrow\) SIDER**, **FreeSolv \(\rightarrow\) ToxCast**, **ClinTox \(\rightarrow\) LIPO**, and **Esol \(\rightarrow\) MUV** [2603.29644].

The auxiliary metrics reinforce the same pattern. The appendix reports that DGP improves **AUPR** over the best baseline by **4.13% relative** on average and achieves a **46.25% relative reduction** in **FPR95** on average, while being best on **8 of 10** datasets for AUPR and **9 of 10** datasets for FPR95 [2603.29644]. The paper also reports large gains over simpler backbone uses: compared with pre-trained GNNs, DGP gains **19.86% relative AUC** on average; compared with fine-tuned GNNs, **13.65% relative AUC**; and compared with AAGOD, **13.39% relative AUC** [2603.29644].

Ablation studies show that neither branch is redundant. Removing the class-agnostic branch, removing the class-specific branch, or removing the distance loss each degrades performance, and the full model is best across datasets [2603.29644]. The hyper-parameter analysis further indicates that the relative utility of class-specific versus class-agnostic prompting is dataset dependent: on **BZR-COX2**, class-agnostic patterns appear relatively more important, whereas on **PTC\_MR-MUTAG**, class-specific patterns appear relatively more important. The best prompt generator depth is reported as **2 layers** by default.

The interpretive analyses are equally important. Score distribution overlap between ID and OOD graphs drops from **0.69** for the original pre-trained GNN to **0.44** for DGP, which the paper reports as a **35.94% relative reduction** in overlap [2603.29644]. Prompt visualization on **BZR** and **BBBP** shows that the class-specific prompt emphasizes backbone structures and likely class-relevant motifs, whereas the class-agnostic prompt emphasizes edges less related to label discrimination and more related to shared ID structure. This does not constitute a formal disentanglement proof, but it does support the claim that the two prompt generators learn meaningfully different prompt views.

Efficiency is another empirical finding. Because the encoder is frozen and the prompt generators are lightweight, DGP is much faster than several end-to-end baselines. On **BZR-COX2**, training time is reported as **7.48s** for DGP-GCL versus **353.35s** for SEGO and **277.23s** for GOOD-D; on **PTC\_MR-MUTAG**, **9.85s** versus **313.67s** for SEGO [2603.29644]. These results suggest that factorized prompting can improve both separation quality and computational efficiency when OOD supervision is absent.

## 6. Related formulations, adjacent methods, and broader significance

Although explicit DGP is currently most clearly instantiated in OOD detection, several neighboring methods supply components of the same design logic. In knowledge graph completion, **PDKGC** uses a **hard task prompt** together with a **disentangled structure prompt** generated from \(K\) structural components per entity, and adds a mutual-information-based independence regularizer; this is one of the closest direct precursors to DGP, though its disentanglement is applied primarily to graph structure representations projected into prompt tokens [2312.01837]. In dynamic graphs, **DyGPrompt** separates prompting into **node prompt** and **time prompt**, with **dual condition-nets** generating time-conditioned node modulation and node-conditioned time modulation; the paper explicitly characterizes this as modular or factorized design rather than “true disentanglement” in the representation-learning sense [2405.13937].

Other prompting papers broaden the design space without using explicit disentanglement objectives. **DAGPrompT** addresses heterophily and hop-dependent distributions through **GLoRA** and **hop-specific prompts**; it is best described as **distribution-aware, modular, hop-decoupled graph prompting**, not strict disentanglement [2501.15142]. **DGTL** for text-attributed graphs uses multiple parallel graph channels with learned channel-specific adjacency matrices and injects the resulting embeddings into a frozen LLM, making it a latent, soft-prompt variant of factorized graph prompting [2310.18152]. **DyGFM** extends the same intuition to multi-domain dynamic graph foundation models by decoupling **semantic** and **temporal** branches, computing divergence-aware routing, and generating separate semantic and temporal prompts conditioned on cross-domain mismatch [2605.13540].

A second line of work contributes disentanglement machinery without prompting. **ADGCN** distinguishes **micro-disentanglement** from **macro-disentanglement**, combining component-specific aggregation, adversarial regularization, and topology-aware graph refinement [2103.07295]. **IPGDN** adds neighborhood routing and Hilbert-Schmidt Independence Criterion regularization to encourage independence among graph factors [1911.11430]. **DGPM** separates node-level and motif-level self-supervised learning with motif discovery and cross-level matching, offering a blueprint for structural prompt units even though it is a pretraining method rather than a prompt-learning system [2312.11927].

These adjacent methods clarify a central boundary in the field. Architectural separation, modular prompting, dual prompts, hop-specific prompts, and semantic-temporal decoupling are often described as “disentangled” in an informal sense. Formal disentanglement, however, would ordinarily imply explicit factor-separation machinery such as independence constraints, mutual-information penalties, orthogonality objectives, or controlled intervention-style evaluation. The literature shows both tendencies. PDKGC uses an explicit independence-oriented regularizer [2312.01837]; DyGPrompt and DAGPrompT do not, and are more accurately described as factorized or decoupled prompting [2405.13937][2501.15142]. The OOD-detection DGP paper occupies an intermediate position: it explicitly names the method Disentangled Graph Prompting, but operationalizes disentanglement through separated **class-specific** and **class-agnostic** prompt branches rather than a full latent-factor identifiability framework [2603.29644].

Taken together, these papers suggest that DGP is emerging as a methodological direction rather than a single fixed architecture. Its recurring themes are frozen-backbone adaptation, prompt decomposition across graph factors, lightweight prompt generators, and improved handling of objective mismatch, distribution shift, temporal drift, or neighborhood overload. The present literature also indicates the main open boundary: the move from modular prompt separation to fully explicit, testable disentanglement remains incomplete.

Source: https://www.emergentmind.com/topics/disentangled-graph-prompting-dgp