GPromptShield: Enhancing the Resilience of Graph Prompt Tuning under Adversarial Attacks
GPromptShield: Elevating Resilience in Graph Prompt Tuning against Adversarial Attacks
The authors propose the GPromptShield graph prompt defense system, claiming that under 5-shot node classification and MetaAttack 25% perturbation, IA-PT reaches 58.82% on Cora (Table 1).
Two attack scenarios: gray-box global poisoning attack (the attacker can see graph data and labels but not model details, e.g., MetaAttack uses a surrogate model) and white-box adaptive attack (the attacker has all information such as the defender's model features, graph structure, and labels). The attacks target the graph structure, and the victim system is downstream node classification with a frozen pretrained GNN plus graph prompts.
- Graph prompt design focuses only on compatibility between pretraining and downstream tasks and ignores security issues: the authors claim that a simple structural perturbation to downstream graph data can make existing prompts fail, with node classification accuracy dropping substantially.
- Proposes the GPromptShield defense system: Direct Handling uses a mixed multi-defense prompt (MD-PT) to customize feature-space prompts for different nodes according to three filtering strategies—degree, centrality similarity, and OOD edges—and Indirect Amplification (IA-PT) uses an MLP pseudo-label training strategy to bypass contaminated structure, with an existence theoretical proof provided.
- 5-shot/10-shot node classification is tested on Cora, Citeseer, CoraML, covering MetaAttack, DICE, Random, Heuristic non-adaptive attacks and adaptive attacks against four defenses; the authors claim MD-PT and IA-PT outperform existing prompts in most settings and do not sacrifice too much accuracy on clean graphs.
- The authors write in Appendix A.3 that they do not provide detailed analysis of some non-ideal cases and hope future work will give a more rigorous proof. Experiments focus mainly on node classification; link prediction and graph classification are only explored in general terms; the paper does not report the number of repetitions or variance.
- Evaluated models
- MD-PTIA-PT
- Benchmarks
- CoraCiteseerCora-MLPubmedWisconsinogbn-arxivMUTAGCOLLABPROTEINSIMDB-BINARYunit test (Mujkanovic et al., 2022)
- Metrics
- classification accuracy
GPromptShield is a scalable defense system for graph prompt tuning that enhances prompt resilience under adversarial attacks through direct processing and indirect amplification. Direct processing adds mixed multi-defense prompts to the input graph feature space to counter invalid information, while indirect amplification uses a training strategy to bypass invalid components and amplify valid ones. Theoretical derivation proves that under certain conditions an unbiased prompt exists on unreliable data, and experiments across multiple adversarial attack scenarios show that the system's prompts are more resilient.
Paper analysis
What problem does this paper attempt to solve?
Existing graph prompts focus only on compatibility; the authors state they are easily misled by simple graph structure perturbations, and adversarial robustness needs to be improved.
Core problem: graph prompts are misled when downstream graph data is adversarially perturbed; existing designs focus only on compatibility between pretraining and downstream tasks and overlook this security issue.
- Problem setting: the "pretraining + prompt fine-tuning" paradigm has expanded from the language domain to the graph domain; the prompt function freezes the pretrained GNN parameters and only adjusts the input data space. The authors state that simple perturbations to the graph structure (e.g., adding a few irrelevant edges) can cause serious consequences through the message-passing mechanism (Figure 1).
- Shortcomings of existing methods: the authors point out that prompts such as GPPT, All-in-one, GPF, GraphPrompt, and MultiGPrompt all focus on compatibility and overlook potential security issues; Figure 3 shows that after MetaAttack (20% perturbation rate), existing prompts suffer large drops in classification accuracy on Cora and Citeseer.
- Core observations: the authors analyze from a data distribution perspective: attacks cause downstream training and test distributions to deviate from the true distribution, and prompts tuned under few-shot settings overfit to the erroneous data; moreover, a single prompt cannot suit all nodes, and only the biased nodes that are attacked need targeted prompting.
- Proposed in the paper: a scalable prompt defense system, GPromptShield, which enhances prompt robustness from two angles, Direct Handling (mixed multi-defense prompt MD-PT) and Indirect Amplification (robust training strategy IA-PT), and provides theoretical derivations.
- Threat model:
- Attacker goal: perturb the graph structure so that prompts fail in downstream node classification.
- Knowledge: two scenarios—gray-box global poisoning attack (graph data and labels visible, model details not visible, e.g., MetaAttack uses a surrogate model); white-box adaptive attack (the attacker has all information such as the defender's model features, graph structure, and labels).
- Capability: add or delete edges under a perturbation budget constraint (MetaAttack 25%, other attacks 50%).
- Victim system: a GNN pretrained on a clean graph and frozen, plus graph prompts for few-shot downstream node classification.
What related research exists?
Related work is divided into three groups: graph prompt fine-tuning, graph pretraining, and graph adversarial attack and defense; the authors state that existing prompts all overlook security issues.
Graph prompt tuning
- GPPT (Sun et al., 2022): reformulates nodes with a pairwise token template (task token + structure token).
- All-in-one (Sun et al., 2023a): unifies node-level and edge-level tasks into graph-level tasks and introduces meta-learning to learn prompts.
- GPF/GPF-plus (Fang et al., 2024): adds general learnable parameters as prompts in the input graph feature space; the theoretical proof in this paper draws on the GPF assumption.
- GraphPrompt (Liu et al., 2023b) and MultiGPrompt (Yu et al., 2024): the former unifies pretraining and downstream tasks based on subgraph similarity; the latter uses multiple pretext tokens and a dual-prompt mechanism. The authors point out that these prompts all focus on compatibility and ignore security issues.
Graph pretraining strategies (Appendix A.1)
- Contrastive: GraphCL (You et al., 2020), DGI (Velickovic et al., 2019), GRACE, GCA, MVGRL, which train the encoder by maximizing mutual information between different graph views.
- Generative: GraphMAE (Hou et al., 2022), GraphMAE2, S2GAE, MaskGAE, with masked reconstruction as the pretext task.
Graph adversarial attacks and defenses
- Attacks: MetaAttack (Zügner & Günnemann, 2019, gray-box meta-learning attack), DICE (Waniek et al., 2018), Heuristic attack (Li et al., 2022b), Random attack; for adaptive attacks, Gosch et al. (2024) divide defenses into seven categories and design corresponding adaptive attacks, and Mujkanovic et al. (2022) propose a unit test containing about 2700 graphs.
- Defenses and OOD detection: GCNSVD, GRAND, GNNGuard, GCNJaccard as target defenses for adaptive attacks; Li et al. propose training a detector using adversarial edges as OOD samples, and the OOD filtering strategy in this paper is based on this.
- Language prompt robustness: PromptBench (Zhu et al., 2023) evaluates the robustness of language prompts under attacks such as DeepWordBug, StressTest, CheckList; the authors say it inspired their research on graph prompt robustness.
Baselines and benchmarks: the comparison baselines are GPF/GPF-plus, All-in-one, GPPT, GraphPrompt, MultiGPrompt, ProG; pretraining strategies use GraphCL and GraphMAE; datasets are Cora, Citeseer, Cora-ML, etc.
Positioning: the authors say this paper shifts the focus of graph prompts from compatibility to vulnerability in adversarial scenarios, which is a new perspective in graph prompt learning, and the defense system can be directly stacked on existing prompts.
How does the paper address this problem?
GPromptShield contains two routes: MD-PT customizes prompts according to node filtering strategies, and IA-PT uses pseudo-labels to bypass contaminated structure.
Overall approach: rather than learning one universal prompt for all nodes, filter out biased nodes according to the sensitive points an attack may target, and add different feature-space prompts to different nodes (MD-PT); additionally, use a structure-independent MLP pseudo-label strategy to bypass contaminated information (IA-PT), and prove that under certain conditions there exists a prompt that makes the model output consistent with that on the clean graph.
Problem setting
- The pretrained GNN model f is trained on the clean graph and frozen; downstream few-shot node classification (k labeled samples per class), with the node task subgraphized into multi-hop neighbor subgraph classification.
- The prompt function ψ transforms the input subgraph into a prompted subgraph, and only ψ and the projection head θ are optimized; the attack biases the downstream graph structure.
Direct Handling: hybrid multi-defense prompt MD-PT
- Three node filtering strategies: the low-degree node set nld with degree below threshold τdegree (corresponding to degree defense prompt pd); the low centrality-similarity node set nls whose average neighbor feature similarity is below τsim (prompt ps); the node set nod judged by the OOD detector fD as endpoints of adversarial edges (prompt po, the detector comes from the adversarial training paradigm of Li et al.).
- Prompt fusion: each node's prompt set P Si is fused by weighted average Mean or self-attention SA; nodes that hit none of the sensitive strategies get an enhanced prompt pe. Prompts are added in feature space; the authors claim feature-based prompts can adjust the perturbed subgraph structure in real time according to the intermediate tuning state.
- Three auxiliary constraints: hidden feature smoothness regularizer Ls (first-order proximity); distribution loss Lkl (narrowing the KL distance between the output distributions of biased nodes and their complement nodes under each filtering scenario); multi-prompt constraint Lo (using the node overlap matrix E to constrain the correlation of different defense prompts, the higher the overlap the more similar).
- Tuning objective: min ∑ L(Ĝ∗i, yi) + α Ls + β Lkl + γ Lo, i.e., the downstream loss plus three constraints; during tuning, subgraphs are pruned by threshold τtune, keeping only edges whose embedding similarity is above the threshold.
Indirect Amplification: IA-PT
- Train a few-shot MLP without structural information to generate pseudo-labels for subgraphs, and select the most confident predictions per class by softmax confidence to form a new label set Vpsu.
- Tune the prompt with the cross-entropy loss on Vpsu, freezing the pretrained model; the authors claim this strategy can be applied to any prompt template, mitigating interference by reducing attention to biased structure.
Theoretical analysis
- Theorem 1: under the GPF assumption (f can be expressed as (A+(1+ϵ)I)XW), for the attacked biased graph Ã=A+C◦S, there exists a feature-space prompt P=N×M (N is the prompt selection matrix, M is the prompt matrix) such that f(Ã, X+P) = f(A, X), i.e., the model produces output on biased data consistent with that on the clean graph.
- The proof is in Appendix A.3: when W is invertible, M has a closed-form solution; when W is not invertible, the pseudo-inverse is used, and when it has full column rank the solution is unique, otherwise the solution is not unique and additional constraints are needed.
What experiments did the paper conduct?
Three datasets, two pretraining methods, four types of non-adaptive plus four types of adaptive attacks, 5/10-shot node classification.
Experimental setup
- Pretraining strategies: GraphCL (contrastive) and GraphMAE (generative); GraphPrompt and MultiGPrompt follow their respective templates.
- Compared prompts: GPF/GPF-plus, All-in-one, GPPT, GraphPrompt, MultiGPrompt, ProG; the methods in this paper are denoted MD-PT and IA-PT.
- Datasets: Cora, Citeseer, Cora-ML (largest connected component taken, Table 4); generalization experiments additionally use Pubmed, Wisconsin, ogbn-arxiv and the graph classification datasets MUTAG, COLLAB, PROTEINS, IMDB-BINARY.
- Attacks: non-adaptive attacks are MetaAttack (25% perturbation, denoted M-0.25), DICE, Random, Heuristic (all 50%); adaptive attacks use the unit test of Mujkanovic et al. (2022) (about 2700 graphs), selecting perturbed graphs targeting four defenses: GCNSVD, GRAND, GNNGuard, GCNJaccard.
- Settings and metrics: 5-shot and 10-shot node classification, metric is classification accuracy; the main text reports only 5-shot, 10-shot is in Appendix A.6/A.7.
- The paper does not report the number of repetitions, variance, or statistical significance tests.
Main results
5-shot non-adaptive attacks (from Table 1, GraphMAE pretraining, Cora, accuracy %):
Swipe horizontally to read the table
Prompt Clean M-0.25 D-0.5 R-0.5 H-0.5 All-in-one 44.67 29.75 30.25 35.83 29.98 GPF 66.71 38.82 33.15 48.53 39.27 GPF-plus 63.40 39.46 33.38 49.84 36.46 GPPT 67.79 43.17 47.71 42.40 35.46 *MD-PT 62.49 62.49 52.61 48.03 51.61 *IA-PT 68.93 68.30 61.90 67.30 66.62 - The authors state that except in individual cases, the accuracy fluctuation of MD-PT/IA-PT under each attack stays within ±10%, whereas other prompts can fluctuate by more than 40%.
- The authors state that on clean data the prompts in this paper still remain state-of-the-art in many cases, without sacrificing too much accuracy for robustness; however, Table 1 contains counterexamples, e.g., on GraphMAE+Cora clean graph MD-PT (62.49) is lower than GPPT (67.79).
- Adaptive attacks (Table 2): the authors state that MD-PT is slightly inferior to IA-PT, and explain this as "directly bypassing the problem is easier than confronting it"; both remain competitive relative to other prompts, e.g., under the GCNSVD attack on GraphMAE+CoraML, IA-PT 66.17, MD-PT 49.17, and the best baseline is GPF 48.56.
Ablation study
- Setup: remove the six modules pd, ps, po, Lkl, Lo, Ls from MD-PT one at a time, evaluated on Cora/Citeseer under 5-shot and 10-shot, MetaAttack 0.25 and DICE 0.5 (Table 3).
- Results: the full MD-PT is highest in most settings, e.g., on Citeseer 5-shot Meta 0.25, MD-PT 64.20%, variants 58.97%–63.68%; exceptions are on Cora 5-shot Meta 0.25, w/o pd (62.31%) is higher than the full MD-PT (60.12%), and on Cora 5-shot DICE 0.5, w/o Ls (56.46%) is higher than the full version (54.55%).
Generalization and transfer
- Node classification and link prediction (Appendix A.8, Table 9/10): on clean datasets such as Pubmed, Wisconsin, ogbn-arxiv, MD-PT is competitive in most settings, e.g., 5-shot Wisconsin node classification MD-PT 50.49 is the highest in the table; there are also counterexamples, e.g., 5-shot ogbn-arxiv node classification MD-PT 18.92 is lower than GPF-plus 22.40.
- Graph classification (Appendix A.9, Table 11): MD-PT is highest in most settings on MUTAG, COLLAB, PROTEINS; on IMDB-BINARY 10-shot, 62.57 is lower than Pre-train & Fine-tune's 67.00.
- Transfer attacks (Appendix A.10, Table 12): in the attack-transfer scenario, the authors state that IA-PT still shows good robustness, and MD-PT is slightly weaker but stably improves the robustness of GPF/GPF-plus.
Other analyses
- Figure 3 (introduction): under MetaAttack 20% perturbation, on Cora GPPT drops from about 0.6 to about 0.2 and GPF from about 0.6 to about 0.4 (radar chart readings), on which basis the authors point out that existing prompts are easily misled.
- The authors speculate in Appendix A.4.1 that the original datasets themselves may contain noise, and that robust tools further purify the data during training.
What are some points that can be further explored?
The authors only write that the theoretical proof does not cover non-ideal cases; experiments focus mainly on node classification and do not report the number of repetitions.
Limitations and future directions noted by the authors
- Idealization of the theoretical proof (Appendix A.3): the authors state that they did not analyze some non-ideal cases in detail, and hope future work will provide more rigorous proofs and derivations for robust prompts under different biased environments.
- Scalability of filtering strategies (Section 4.1): the authors say this paper first proposes three feasible filtering schemes, and as attacks evolve, node sets can be selected based on more sensitive attributes—this is a scalability direction noted by the authors rather than work already done.
- The paper has no separate Limitations section; the above two points are the shortcomings and future directions explicitly stated in the paper.
Scope of experiments
- The tested objects are two pretraining strategies (GraphCL, GraphMAE) plus six existing prompts and the two prompts in this paper; the victim models are all frozen pretrained GNNs, and the paper does not report architecture details beyond the specific number of GNN layers or hidden dimensions.
- The main experiments are 5-shot/10-shot node classification on Cora, Citeseer, Cora-ML; link prediction and graph classification are only explored in general terms, and the main text presents only robustness-related results (Section 5.1).
- Non-adaptive attacks cover four types: MetaAttack, DICE, Random, Heuristic; adaptive attacks only select perturbed graphs from the unit test targeting four defenses: GCNSVD, GRAND, GNNGuard, GCNJaccard, and do not cover all seven categories.
- The paper does not report the number of repetitions, standard deviations or statistical significance tests for each result; in Table 3 some values carry a % sign and some do not, and the paper does not explain why.
- Attacks target only graph structure perturbation; feature attacks do not appear in the paper's experiments.
Summarize the main content of the paper
GPromptShield improves the robustness of graph prompts under adversarial attacks through two routes: direct handling and indirect amplification.
An ICLR 2025 paper on graph prompt robustness defense, proposing the GPromptShield defense system.
- Problem: the authors state that existing graph prompts focus only on compatibility between pretraining and downstream tasks, and simple graph structure perturbations can make prompts fail; Figure 3 shows that under MetaAttack 20% perturbation, existing prompts suffer large accuracy drops on Cora and Citeseer.
- Method: MD-PT customizes feature-space prompts for biased nodes according to three filtering strategies—degree, centrality similarity, and OOD edges—with three auxiliary constraints Ls, Lkl, and Lo; IA-PT uses MLP pseudo-labels to bypass contaminated structure and can be stacked on any prompt. Theorem 1 states that under certain conditions there exists a prompt that makes the model output consistent with the clean graph.
- Main results: 5-shot, GraphMAE pretraining, Cora, IA-PT reaches 68.30% under M-0.25, while the best baseline is 48.53% (Table 1); under adaptive attacks, IA-PT reaches 66.17% under the GCNSVD attack on GraphMAE+CoraML (Table 2).
- Exceptions: on clean graphs MD-PT is not always best (e.g., 62.49 on GraphMAE+Cora, lower than GPPT's 67.79); in the ablation, variants without pd or Ls exceed the full version in individual settings (Table 3).
- Authors' conclusion: the authors state that both strategies enhance prompt resilience under adaptive and non-adaptive attacks, and do not sacrifice too much accuracy for robustness; the authors also write that the theoretical proof does not cover non-ideal cases, leaving them for future work.