Relaxing Graph Transformers for Adversarial Attacks

Philipp Fothtum
Lukas Goschtum,mcml
Simon Geislertum
Leo Schwinntum
Stephan Günnemanntum

tumDepartment of Computer Science & Munich Data Science Institute, Technical University of Munich, Germany

mcmlMunich Center for Machine Learning (MCML)

Philipp<EMAIL_ADDRESS>Lukas<EMAIL_ADDRESS>
Machine Learning, ICML, Graph Transformer, GNN, adversarial robustness, adversarial attack, adaptive attack, graph positional encodings

Existing studies have shown that Graph Neural Networks (GNNs) are vulnerable to adversarial attacks.
Even though Graph Transformers (GTs) surpassed Message-Passing GNNs on several benchmarks, their adversarial robustness properties are unexplored. However, attacking GTs is challenging due to their Positional Encodings (PEs) and special attention mechanisms which can be difficult to differentiate.
We overcome these challenges by targeting three representative architectures based on (1) random-walk PEs, (2) pair-wise-shortest-path PEs, and (3) spectral PEs – and propose the first adaptive attacks for GTs.
We leverage our attacks to evaluate robustness to (a) structure perturbations on node classification; and (b) node injection attacks for (fake-news) graph classification.
Our evaluation reveals that they can be catastrophically fragile and underlines our work's importance and the necessity for adaptive attacks.

§ INTRODUCTION

Graphs are versatile data structures that have applications in a wide range of different domains and Graph Neural Networks (GNNs) have become the tool of choice for many learning tasks on graphs.
Given the increasing popularity of GNNs, multiple studies in the past years have developed adversarial attacks for GNNs and analyzed their robustness <cit.>. These studies mostly focus on Message-Passing GNNs (MPNNs), such as the Graph Convolutional Network (GCN) <cit.> and show that GNNs are vulnerable to even slight graph structure perturbations <cit.>.

Recently, Graph Transformers (GTs) have started to increasingly outperform MPNNs in many common benchmarks <cit.>. They address inherent limitations of MPNNs such as over-smoothing, over-squashing, and limited receptive fields <cit.>.
Despite their increasing popularity, the adversarial robustness of GTs is entirely unexplored. Consequently, the unknown stability of GTs poses a substantial risk in practical applications, where robustness is crucial. Yet evaluating, their robustness is non-trivial since they employ modified attention mechanisms and Positional Encodings (PEs) that are often non-differentiable w.r.t. the graph structure. This renders the immediate application of standard gradient-based adaptive attacks impossible. In prior work, similar issues were addressed with adaptive attacks, tailored to specific architectures
including GNNs <cit.>.

UPFD politifact.

UPFD gossipcop.

The classification accuracy for different GNNs with varying attack budget on the two UPFD Twitter fake news datasets (graph classification, node injection attacks) and CLUSTER (node classification, structure attack). The strongest attack for each budget is shown.

To provide the first analysis on the robustness of GTs, we propose continuous relaxations and perturbation approximations that enable us to apply adaptive attacks to three representative GT architectures. 1) Graph Inductive bias Transformer (GRIT) <cit.>, based on random walk PEs; 2) Graphormer <cit.>, which uses pairwise shortest path PEs; and 3) Spectral Attention Network (SAN) <cit.>, with spectral PEs.
We evaluate the adversarial robustness of the three GT models for node and graph classification. To this end, we propose a node injection attack (NIA) which we apply to attack fake news detection.
Fig. <ref> provides a direct comparison between the robustness of different GNNs and highlights crucial robustness vulnerabilities of GTs.

§ BACKGROUND

Let \( \mathcal{G}=(\mathcal{V},\mathcal{E}) \) be an undirected attributed graph with \(n\) nodes \( \mathcal{V}=\{v_1,...,v_n\} \) and \(m\) edges. Let \( \bm{x}_i \in \mathbb{R}^d \) be the feature vector of node \(v_i\). Then the graph can be defined as \( \mathcal{G}=(\bm{A},\bm{X}) \) with its symmetric binary adjacency matrix \( \bm{A} \in \{0,1\}^{n \times n} \) and node feature matrix \( \bm{X} \in \mathbb{R}^{n \times d} \).
The diagonal degree matrix \(\bm{D}\) with entries \( \bm{D}_{ii} = \mathsf{deg}(v_i) = \sum_{j=1}^{n} \bm{A}_{ij} \) and the normalized symmetric graph Laplacian matrix \(\bm{L}_{sym} = \bm{I} - \bm{D}^{-\sfrac{1}{2}} \bm{A} \bm{D}^{-\sfrac{1}{2}} \) can both be derived from \(\bm{A}\).
The GNNs considered in this work are functions \(f_{\theta}(\bm{A}, \bm{X})\) with model parameters \(\theta\), and \(\bm{H}^{(l)}\) denotes the updated node representations in the model layers.

Structure attacks.

The attack objective is described by the following optimization problem:

\begin{equation}
\label{eq:bg-attack-objective}
\max_{\Tilde{\bm{A}} \text{ s.t. } \lVert \Tilde{\bm{A}} - \bm{A} \rVert_0 < \Delta} \mathcal{L}_{atk}(f_\theta(\Tilde{\bm{A}}, \bm{X}))
\end{equation}

where \(f_\theta\) is the GNN model with fixed parameters \(\theta\), \(\mathcal{L}_{atk}\) is a suitable attack loss function, and \(\Tilde{\bm{A}} \in \{ 0, 1 \}^{n \times n} \) is the discrete perturbed adjacency matrix in relation to \(\bm{A}\) with the number of edge flips bounded by the budget \( \Delta \).
It is convenient to model the perturbation as a function of the binary matrix indicating the edge flips \( \bm{B} \in \{ 0, 1 \}^{n \times n} \):

\begin{equation}
\label{eq:bg-adj-perturbation}
\Tilde{\bm{A}} = \bm{A} + \delta \bm{A}, \qquad \delta \bm{A} = (\bm{1}_n \bm{1}_n^{\mathsf{T}} - 2 \bm{A}) \odot \bm{B} %
\end{equation}

with element-wise product \(\odot\). Applying a continuous relaxation \( \bm{B} \in [ 0, 1 ]^{n \times n} \) to the combinatorial problem makes optimization with gradient descent possible. In this setting, the entry \(\bm{B}_{ij}\) represents the probability that the edge \((v_i, v_j)\) is flipped. Discrete perturbations can then be sampled from the continuous solution. The budget constraint becomes \(\mathbb{E}[\mathsf{Bernoulli}(\bm{B})] = \sum{\bm{B}_{ij}} \leq \Delta\), which can be dealt with by using projected gradient descent <cit.>. For large graphs, optimizing over all entries in \(\bm{B}\) at once becomes infeasible. Projected Randomized Block Coordinate Descent (PRBCD) solves this with a strategy that optimizes over sampled random blocks of limited size <cit.>.

Generic GT architecture.

Graph transformers.

GTs apply the popular transformer architecture for sequences <cit.> to arbitrary graphs. In this work, we focus on GTs that apply global self-attention, where each node can attend to all other nodes. A `vanilla' structure-unaware self-attention head is defined as:

\begin{equation}
\mathsf{Attn}(\bm{H}) = \sigma \left( \frac{ \bm{Q} \bm{K}^{\mathsf{T}} }{ \sqrt{d_k} } \right) \bm{V}
\end{equation}

where \( \bm{Q} = \bm{H} \bm{W}_q, \bm{K} = \bm{H} \bm{W}_k \in \mathbb{R}^{n \times d_k} \) are the query and key projections,
\( \bm{V} = \bm{H} \bm{W}_v \in \mathbb{R}^{n \times d} \) is the value projection,
and \( \sigma \) is the softmax function. A generic GT is depicted in Fig. <ref>. The individual attention scores are:

\begin{equation}
\begin{gathered}
w_{ij} = \sfrac{ \bm{W}_q \bm{h}_i \cdot \bm{W}_k \bm{h}_j }{ \sqrt{d} }, \\
\alpha_{ij} = \sigma ({w}_{ij}) = \frac{e^{{w}_{ij}}}{\sum_{k}{ e^{{w}_{ik}}}}
\end{gathered}
\end{equation}

For GTs to become structure-aware, Positional Encodings (PEs) are usually added \( {\bm{H}}^{(0)} = \bm{X} + \psi(\bm{A}) \).
We categorize PEs in three main categories: (1) random walk encodings <cit.>, (2) distance encodings <cit.>, and (3) spectral encodings <cit.>. Additionally, many GTs adapt the attention mechanism to capture relevant topological aspects of the graph explicitly in the attention operation.

§ GRAPH TRANSFORMER RELAXATIONS

The main obstacles for gradient-based structure attacks on GTs \(f_{\theta}\) are PEs and attention mechanisms that are designed for a discrete graph structure. As a result, the model output is often a discontinuous function of the continuous input adjacency matrix \(\Tilde{\bm{A}} \in [0,1]^{n \times n}\), rendering continuous optimization ineffective. We identify such components in the GT models and continuously relax them: \(\Tilde{f}_{\theta}\). For designing the continuous relaxations, we identify three main principles:

Principle I: Relaxed and target models coincide for discrete inputs. The prediction should equal \(\Tilde{f}_{\theta}(\bm{A}) = f_{\theta}(\bm{A})\) for any discrete adjacency \(\bm{A} \in \{0,1\}^{n \times n}\).

Principle II: \(\Tilde{f}_{\theta}\) can interpolate “smoothly” between any different discrete graphs. In other words, \(\Tilde{f}_{\theta}(\Tilde{\bm{A}})\) should be continuous w.r.t. \(\Tilde{\bm{A}}\) but does not need to be continuously differentiable.

Principle III: The relaxed model \(\Tilde{f}_{\theta}\) must be efficient. It is a critical property that the relaxation does not excessively increase memory and runtime complexity.

Next, we introduce a representative GT for each of the PE categories and propose continuous relaxations for problematic components based on these principles.

Random-walk-based GRIT. The components of the GRIT model <cit.> are already continuous and do not require additional relaxations for gradient-based attacks. Details on the architecture are given in <ref>.

Distance-based Graphormer. The Graphormer model <cit.> learns a PE embedding vector \(\bm{z} \in \mathbb{R}^{d}\) for each integer degree value (# of neighbors) which are added to the node features according to their degrees:
\(
\bm{h}_i^{(0)} = \bm{x}_i + \bm{z}_{\mathsf{deg}(v_i)}
\). To allow for continuous degrees, we linearly interpolate between the PE embeddings of the two closest integer values:

\begin{equation}
\begin{gathered}
\Tilde{\bm{z}}_{\mathsf{deg}(v_i)} = \eta \cdot \bm{z}_{\mathsf{d}_{l}+1} + (1 - \eta) \cdot \bm{z}_{\mathsf{d}_{l}} \\\quad \text{with} \quad \mathsf{d}_{l} = \floor{\mathsf{deg}(v_i)}, \quad \eta = \mathsf{deg}(v_i) - \mathsf{d}_{l}
\end{gathered}
\end{equation}

Similarly, a learnable scalar \(b \in \mathbb{R}\) is assigned to each discrete Shortest Path Distance (SPD). This value is added as a bias to the raw attention scores:
\(
\hat{w_{ij}} = w_{ij} + b_{\mathsf{spd}(v_i, v_j)},
\).
When a very small edge probability lies on a (simple) shortest path, the path is less likely to exist in the discrete sampled adjacency matrix. Therefore, low edge probabilities should only marginally affect the original SPDs. To model this relationship, we use the reciprocal of the continuous adjacency matrix \(\bm{R}_{ij} = \sfrac{1}{\Tilde{\bm{A}}_{ij}}\) for the SPDs. We interpolate
again to handle the continuous distance values and compute:

\begin{equation}
\begin{gathered}
\Tilde{b}_{\mathsf{spd}(v_i, v_j)} = \eta \cdot b_{\mathsf{s}_l+1} + (1 - \eta) \cdot b_{\mathsf{s}_l} \\
\text{with} \quad \mathsf{s}_l = \floor{\mathsf{rspd}_{ij}}, \quad \eta = \mathsf{rspd}_{ij} - \mathsf{s}_l
\end{gathered}
\end{equation}

where \( \mathsf{rspd}_{ij} = \mathsf{spd}(v_i, v_j | \bm{R}) \) is the sum of edge weights that lie on the shortest path from \(v_i\) to \(v_j\) for the graph defined by \(\bm{R}\).
Similar to ReLU activations, the distances are not differentiable everywhere. However, we use the sum over one possible shortest path as a proxy. Backpropagation through this sum yields the gradients w.r.t the continuous adjacency matrix.
Note that for discrete edge probability values $0$ and $1$, the reciprocal edge weights become $-\infty$ and $1$, respectively, yielding the original distances.
Hence, we do not alter the clean predictions if \(\delta \bm{A} = \bm{B} = \bm{0}\) (see Principle I).

Spectral SAN.
The SAN architecture <cit.> uses learned Laplacian-based PEs (LPEs), starting with the eigen-decomposition of the Laplacian \(\bm{L}_{sym} = \bm{U} \bm{\Lambda} \bm{U}^{\mathsf{T}}\), where diagonal entries of \( \bm{\Lambda}_{ii} = \lambda_i \) are the eigenvalues of \(\bm{L}_{sym}\) in ascending order, and the columns of \(\bm{U}\) are the corresponding eigenvectors.
While the Laplacian matrix itself is a continuous functions of the entries in the adjacency matrix, its eigen-decomposition poses challenges for gradient computation, especially w.r.t the eigenvectors.
To avoid direct gradient computation, we use results from matrix perturbation theory <cit.> to approximate the perturbed eigen-decomposition as a simpler function of the input perturbation.
The perturbation is \( \delta \bm{L}_{sym} = \Tilde{\bm{L}}_{sym} - \bm{L}_{sym} \), where \( \Tilde{\bm{L}}_{sym} \) is the Laplacian of the continuous adjacency matrix \( \Tilde{\bm{A}} \). The first-order approximations for the eigenvalues and vectors are  <cit.>:

\begin{gather}
\Tilde{\bm{\Lambda}} = \bm{\Lambda} + \delta \bm{\Lambda}, \qquad \delta \bm{\Lambda} \approx \mathsf{diag}(\bm{U}^{\mathsf{T}} \delta \bm{L} \ \bm{U} )
\\
\begin{gathered}
\Tilde{\bm{U}} = \bm{U} + \delta \bm{U}, \quad \delta \bm{U} \approx - \bm{U} \ \left( \bm{\Pi} \odot \bm{U}^{\mathsf{T}} \delta \bm{L} \ \bm{U} \right), \\
\quad \text{where} \quad \bm{\Pi}_{ij} = \begin{cases}
\frac{1}{\lambda_i - \lambda_j} & \text{if } \lambda_i \neq \lambda_j \\
0 & \text{else}
\end{cases}
\end{gathered}
\end{gather}

For the approximation to hold with repeated eigenvalues, special care for the choice of arbitrary eigenvectors that span the eigenspace is required, as described by Bamieh2020.

The SAN attention mechanism computes separate attention scores between connected and unconnected nodes, using different key and query weights.
A hyperparameter \(\gamma \in \mathbb{R}^+\) controls how the two scores are relatively scaled, varying the bias towards sparse or full attention.
To relax the binary decision of whether an edge is real or fake, we add edges with probability between $0$ and $1$ to both attention mechanisms. The contribution of the uncertain edges is weighted relative to the probabilities of being real or fake using a corresponding bias:

\begin{equation}
\begin{split}
\Tilde{\alpha}_{ij}  \ = \ &\frac{ \gamma }{1 + \gamma} \sigma \left( w_{\mathsf{fake}, ij} + \log(1 - \Tilde{\bm{A}}_{ij}) \right) \\
&+ \frac{ 1 }{1 + \gamma} \sigma \left( w_{\mathsf{real}, ij} + \log(\Tilde{\bm{A}}_{ij}) \right)
\end{split}
\end{equation}

For a discrete real edge, i.e., \( \Tilde{\bm{A}}_{ij} = 1\), the logarithm terms become $-\infty$ and $0$ respectively. The equation then simplifies to \(\alpha_{ij} = \frac{ 1 }{1 + \gamma} \mathsf{softmax} \left( w_{\mathsf{real}, ij} \right) \), thus only contributing to the `real' attention scores, as in the original SAN. The same can be shown for fake edges.

CLUSTER attack results.

§ NODE INJECTION ATTACK

We also consider the relevant case of inserting nodes into an existing graph structure. In contrast to the usual framing of Node Injection Attack (NIA), where the attacker also chooses the node features for the new vicious nodes <cit.>, we connect existing nodes from other graphs of an inductive graph dataset. Therefore, the nodes' features are fixed but physically realizable even if, e.g., they represent embeddings of natural language. Details are shown in <ref>.

During the structure attack optimization, probabilities are assigned to edges,
yet for NIAs, node probabilities are also relevant to allow for a smooth node insertion. To obtain these from the edges, we propose a simple iterative computation.
For a continuous connected graph, let \(\mathcal{N}(v_i)\) be the $1$-hop neighborhood of node \(v_i\). We can approximate the probability \( p_i \) of \(v_i\) being connected to the graph, by using the probability that it is connected to its neighbors and the probability that these neighbors are connected to the graph. We start with the assumption that all nodes are connected to the graph: \(p_i^{(0)} = 1\), and update using the edge probabilities:

\begin{equation}
p_i^{(t+1)} = 1 - \prod_{v_j \in \mathcal{N}(v_i)}(1 - \bm{A}_{ij} \cdot p_j^{(t)})
\end{equation}

To ensure that the model output is continuous w.r.t. node injections, for graph level tasks we weigh the nodes' contributions in the sum or mean graph-pooling by their probabilities.
Additionally, we use the probabilities to bias the attention scores:
\(
\hat{w}_{ij} = w_{ij} + \log(p_j) %
\), similarly to <cit.>.

§ RESULTS

Fig. <ref> shows the strongest attacks on the different GNNs for CLUSTER and the UPFD fake news detection datasets. It shows that some GTs can be surprisingly fragile.
More detailed results are reported in <ref>.

Results for three attack types are shown: adaptive, transfer, and random. Adaptive is the gradient-based PRBCD attack with our relaxations described in  <ref>. Random is a baseline attack that randomly flips as many edges as the budget allows. The random attack gets the same number of model evaluations as the adaptive attack during optimization. Of those, the strongest random perturbation is chosen.
For a transfer attack, the perturbed graph generated by an adaptive attack on one model is used as an adversarial input for a different GNN model. We report results for the strongest transfer perturbation at each budget.

We evaluate our structure attacks on the inductive node classification dataset CLUSTER <cit.>. It contains SBM-generated graphs with 6 clusters, where each cluster has one labeled node. The task is to predict which node belongs to which cluster. The node classification accuracy for the CLUSTER dataset for different attack budgets is shown in Fig. <ref>. We hypothesize that the straightforward nature of the task and dataset lead to the same type of perturbations, independent of the model. This would explain the strong transferability and little variation in robustness across models. This outcome positively indicates the effectiveness of our adaptive attacks, as they consistently identify meaningful perturbations across all GTs. They may sometimes be weaker than the transfer attacks simply due to a more difficult optimization function.
To avoid the natural fragility in the data, we also evaluate a constrained attack that prohibits modifying edges to the labeled nodes.

Graphormer attacks using relaxations for a fixed budget of $1$% for CLUSTER unconstrained (u.) and constrained (c.).

23emDeg.     23emSPD     2cAcc. (%)

CLUSTER, u.     CLUSTER, c.

\(52.61 \pm 0.57\)     \(60.00 \pm 0.42\)

\(46.78 \pm 0.46\)     \(68.45 \pm 0.37\)

\(50.81 \pm 0.41\)     \(60.66 \pm 0.21\)

2lrandom     \(66.52 \pm 0.61\)     \(70.29 \pm 0.32\)

2lclean     \(77.89\)     \(77.89\)

SAN attacks using relaxations for a fixed budget of $1$% for CLUSTER unconstrained (u.) and constrained (c.).

23emAtten.     23emLap. pert.     2cAcc. (%)

CLUSTER, u.     CLUSTER, c.

\(53.95 \pm 0.59\)     \(63.27 \pm 0.27\)

\(53.87 \pm 0.26\)     \(63.20 \pm 0.12\)

\(57.12 \pm 0.62\)     \(67.22 \pm 0.17\)

2lrandom     \(65.70 \pm 0.65\)     \(68.86 \pm 0.32\)

2lclean     \(76.12\)     \(76.12\)

Additionally, we attack the CLUSTER graphs with different combinations of our relaxations. The results for Graphormer and SAN are shown in Tab. <ref> and <ref> respectively. All continuous relaxations individually seem to provide somewhat useful gradients and can be used to get better than random results.
Yet some lead to stronger attacks than others, and using multiple does not seem to work better than just one.
Since there is not one that is consistently better than the others, a good approach might be to try all combinations as an ensemble and choose the strongest. A similar evaluation for NIAs on the UPFD datasets is shown in <ref>. It indicates that only adding the node probability bias to the attention scores seems to be sufficient and leads to some of our strongest attacks.

In conclusion, we empirically demonstrate that GTs can be catastrophically fragile in some settings and remarkably robust w.r.t. the studied attack in other settings. This diverse picture underlines the importance and need for adaptive attacks to reveal nuanced robustness properties. Similarly, also the comparison of GT's and MPNN's robustness w.r.t. the studied attacks does not allow for a conclusion about which approach is superior in terms of robustness. Nevertheless, our work sets the important cornerstone for empirical research in answering this very question.

§ ACKNOWLEDGEMENT

This paper has been supported by the DAAD programme Konrad Zuse Schools of Excellence in Artificial Intelligence, sponsored by the Federal Ministry of Education and Research.

Missing 'biblatex' package
The bibliography requires the 'biblatex' package.

booktitleProceedings of the ACM SIGKDD International Conference on
Knowledge Discovery and Data Mining
titleAdversarial attacks on neural networks for graph data

booktitleInternational Conference on Learning Representations
titleAdversarial Attacks on Graph Neural Networks via Meta

booktitleProceedings of the ACM SIGKDD International Conference on
Knowledge Discovery and Data Mining
titleCertifiable Robustness of Graph Convolutional Networks under
Structure Perturbations

booktitleInternational Conference on Learning Representations
titleSemi-Supervised Classification with Graph Convolutional

titleAttending to Graph Transformers
journaltitleTransactions on Machine Learning Research

booktitleProceedings of the 35th International Conference on
Machine Learning
titleObfuscated Gradients Give a False Sense of Security:
Circumventing Defenses to Adversarial Examples

booktitleProceedings - IEEE Symposium on Security and Privacy
titleTowards Evaluating the Robustness of Neural Networks

booktitleProceedings of the 34th International Conference on
Neural Information Processing Systems
titleOn Adaptive Attacks to Adversarial Example Defenses

booktitleProceedings of the 36th International Conference on
Neural Information Processing Systems
titleAre defenses for graph neural networks robust?

booktitleProceedings of the 40th International Conference on
Machine Learning
titleGraph Inductive Biases in Transformers without Message

booktitleProceedings of the 35th International Conference on
Neural Information Processing Systems
titleDo transformers really perform bad for graph representation?

booktitleProceedings of the 35th International Conference on
Neural Information Processing Systems
titleRethinking graph transformers with spectral attention

booktitleIJCAI'19: Proceedings of the 28th International Joint
Conference on Artificial Intelligence
titleTopology Attack and Defense for Graph Neural Networks: An
Optimization Perspective

booktitleProceedings of the 35th International Conference on
Neural Information Processing Systems
titleRobustness of graph neural networks at scale

booktitleProceedings of the 31st International Conference on
Neural Information Processing Systems
titleAttention is all you need

titleGraph Neural Networks with Learnable Structural and
Positional Representations
journaltitleInternational Conference on Learning Representations

booktitleProceedings of the 40th International Conference on
Machine Learning
titleTransformers Meet Directed Graphs

titleDistance Encoding: Design Provably More Powerful Neural
Networks for Graph Representation Learning
journaltitleThirty-seventh Conference on Neural Information
Processing Systems (NeurIPS)

titleA Generalization of Transformer Networks to Graphs
journaltitleAAAI Workshop on Deep Learning on Graphs: Methods and

titleMatrix Perturbation Theory

titleA Tutorial on Matrix Perturbation Theory (using compact
matrix notation)

titleScalable attack on graph data by injecting vicious nodes

journaltitleData Min. Knowl. Discov.

booktitleICML Workshop on NextGenAISafety
titleAttacking Large Language Models with Projected Gradient

titleBenchmarking Graph Neural Networks
journaltitleJournal of Machine Learning Research

booktitleProceedings of the 35th International Conference on
Machine Learning
titleAdversarial Attack on Graph Structured Data

titleAdversarial Attacks and Defenses on Graphs: A Review, A Tool
and Empirical Studies
journaltitleSIGKDD Explor. Newsl.

booktitleGraph Neural Networks: Foundations, Frontiers, and
titleGraph Neural Networks: Adversarial Robustness

booktitleInternational Conference on Learning Representations
titleCollective Robustness Certificates: Exploiting
Interdependence in Graph Neural Networks

booktitleAdvances in Neural Information Processing Systems,
titleRandomized Message-Interception Smoothing: Gray-box
Certificates for Graph Neural Networks

booktitleNeurIPS Workshop on Graph Learning Frontiers
titleOn the Adversarial Robustness of Graph Contrastive Learning

booktitleThe Eleventh International Conference on Learning
Representations (ICLR)
titleRevisiting Robustness in Graph Machine Learning

Elsevier B.V.

titleA graph transformer defence against graph perturbation by a
flexible-pass filter
journaltitleInformation Fusion

booktitleThirty-seventh Conference on Neural Information
Processing Systems (NeurIPS)
titleAdversarial Training for Graph Neural Networks: Pitfalls,
Solutions, and New Directions

booktitleProceedings of the ACM SIGKDD International Conference on
Knowledge Discovery and Data Mining
titleGraph Structural Attack by Perturbing Spectral Distance

titleHigh-Order Proximity Preserved Embedding for Dynamic
journaltitleIEEE Transactions on Knowledge and Data Engineering

booktitleProceedings of the 36th International Conference on
Machine Learning
titleAdversarial Attacks on Node Embeddings via Graph Poisoning

booktitleACM Web Conference - Proceedings of the World Wide Web
Conference, WWW
titleAttacking Fake News Detectors via Manipulating News Social

booktitleProceedings of the ACM SIGKDD International Conference on
Knowledge Discovery and Data Mining
titleTDGIA: Effective Injection Attacks on Graph Neural

booktitleProceedings of the 36th International Conference on
Neural Information Processing Systems
titleRecipe for a general, powerful, scalable graph transformer

booktitleProceedings of the 34th International Conference on
Neural Information Processing Systems
titleDesign space for graph neural networks

titleFast Graph Representation Learning with PyTorch Geometric

booktitleProceedings of the 44th International ACM SIGIR
Conference on Research and Development in Information Retrieval
titleUser Preference-aware Fake News Detection

booktitleNeurIPS Workshop on Graph Learning Frontiers
titlePoisoning x Evasion: Symbiotic Adversarial Robustness for
Graph Neural Networks

booktitleInternational Conference on Learning Representations
titleGraph Attention Networks

booktitleInternational Conference on Learning Representations
titleHow Attentive are Graph Attention Networks?

§ RELATED WORK

Triggered by the seminal works of Zuegner2018,Dai2018, a research area emerged spanning attacks, defenses, and certification of GNNs <cit.>. However, GTs have been entirely neglected despite their success on common benchmarks. Zhu2024 is the sole exception acknowledging this gap. However, they solely propose a robust and sparse transformer and evaluate it with non-adaptive poisoning attacks. Thus, they do not shine light on the robustness of the diverse set of graph transformers nor do they study adaptive attacks.

Our attack is rooted in the GNN robustness literature. Xu2019 proposes the first Projected Gradient Descent attack for discrete L0 perturbations of the graph structure, with a focus on message-passing architectures. Geisler2021 extend this PGD with a randomization scheme to obtain the efficient Projected Randomized Block Coordinate (PRBCD) attack. gosch2023adversarial extend PRBCD with local constraints, which is comparable with our relaxed GTs. While highlighting the general nature of our framework, we leave the empirical evaluation for future work. Further important related works are Lin2022,Zhu2018,Bojchevski2019, where the authors study similar approximations for perturbations on the eigen-decomposition of the graph Laplacian. Moreover, Wang2023 attack message-passing architectures on the UPFD fake news detection using reinforcement learning. As an entry to Node Insertion Attacks (NIA), we refer to Wang2020,Zou2021

§ GRAPH TRANSFORMERS

Graph transformers (GTs) apply the popular transformer architecture for sequences <cit.> to arbitrary graphs. A general GT architecture is depicted in Fig. <ref>. In this work, we focus on GTs that apply global self-attention, where each node can attend to all other nodes. A `vanilla' structure-unaware self-attention head is defined as:

\begin{equation}
\mathsf{Attn}(\bm{H}) = \mathsf{softmax}\left( \frac{ ( \bm{H} \bm{W}_q) (\bm{H} \bm{W}_k)^{\mathsf{T}} }{ \sqrt{d_k} } \right) (\bm{H} \bm{W}_v)
\end{equation}

where \(\bm{W}_q, \bm{W}_k \in \mathbb{R}^{d \times d_k} \) are the weights for the query and key projections, and \(\bm{W}_v \in \mathbb{R}^{d \times d} \) is the value weight matrix.
For structure awareness, prior works commonly add Positional Encodings (PEs) to the node features:

\begin{equation}
\bm{H}^{(0)} = \bm{X} + \psi(\bm{A})
\end{equation}

GT categorization. We categorize the PEs roughly in three main categories: (1) random walk encodings, (2) distance encodings, and (3) spectral encodings. In addition to PEs, many GTs adapt the attention mechanism to capture relevant topological aspects of the graph explicitly in the attention operation. Some GT architectures can optionally leverage available edge features, which we omit here since our evaluation data does not include any. Furthermore, edge features are typically not considered for pure structure perturbation attacks, as adding new edges would also require adding features for them.
Next, we introduce a representative GT for each of the PE categories.

(1) Random-walk-based GRIT. The GRIT model architecture <cit.> terms their PE Relative Random Walk Probabilities (RRWP). The random walk encodings are collected from a fixed-length walk of length \(k\), which is a hyperparameter (usually \(k > 10\)). The PEs are based on the tensor:

\begin{equation}
\label{eq:grit-rrwp}
\bm{P} = [\bm{I}, \bm{M}, \bm{M}^2,...,\bm{M}^{k-1}] \in \mathbb{R}^{n \times n \times k}, \quad \text{with} \quad \bm{M} = \bm{D}^{-1} \bm{A}\
\end{equation}

This yields an embedding vector \( \bm{P}_{ij} \in \mathbb{R}^k \) for each of the \(n^2\) node-pairs \((v_i,v_j)\). The diagonal vector entries are transformed to dimension \(d\) by a linear layer and added to the node features as PEs: \( \bm{h}_i^{(0)} = \bm{x}_i + g_1(\bm{P}_{ii}) \). Additionally, all \(n^2\) vectors are transformed by a separate linear layer and added as node-pair features:
\( \bm{h}_{i,j}^{(0)} = g_2(\bm{P}_{ij}) \).
The node representations \(\bm{h}_i\) and node-pair representations \(\bm{h}_{i,j}\) are updated in each transformer layer by a modified attention mechanism, which includes an adaptive degree-scaler that is applied to the node representations:

\begin{equation}
\label{eq:grit-degree}
\bm{h}_i = (\bm{h}_i \odot \bm{\theta}_1) + \log(1 +  \mathsf{deg}(v_i)) \cdot (\bm{h}_i \odot \bm{\theta}_2)
\end{equation}

where \( \bm{\theta}_1, \bm{\theta}_2 \in \mathbb{R}^d \) are learnable weights.

(2) Distance-based Graphormer. The Graphormer model <cit.> uses degree PEs. For each discrete degree value there is a learnable embedding vector \(\bm{z} \in \mathbb{R}^{d}\). The embeddings are added to the node features according to the node degrees:

\begin{equation}
\label{eq:graphormer-degree}
\bm{h}_i^{(0)} = \bm{x}_i + \bm{z}_{\mathsf{deg}(v_i)}
\end{equation}

Similarly, a learnable scalar \(b \in \mathbb{R}\) is assigned to each discrete Shortest Path Distance (SPD). This value is added to the raw attention scores and results in a re-weighting of the attention weights after applying the softmax function:

\begin{equation}
\label{eq:graphormer-spd}
\hat{w_{ij}} = w_{ij} + b_{\mathsf{spd}(v_i, v_j)},
\qquad \alpha_{ij} = \mathsf{softmax}(\hat{w}_{ij})
\end{equation}

where \(w_{ij} = \sfrac{ \bm{W}_q \bm{h}_i \cdot \bm{W}_k \bm{h}_j }{ \sqrt{d} }\).
For graph-level tasks, a virtual node is added to the graph with its own distinct learnable bias \(b_{\mathsf{virtual}}\)
, which is used as graph representation in the pooling stage.

(3) Spectral SAN
The SAN architecture <cit.> uses learned Laplacian-based PEs (LPEs), starting with the eigen-decomposition of the Laplacian \(\bm{L}_{sym} = \bm{U} \bm{\Lambda} \bm{U}^{\mathsf{T}}\), where diagonal entries of \( \bm{\Lambda}_{ii} = \lambda_i \) are the eigenvalues of \(\bm{L}_{sym}\) in ascending order \( \lambda_1 \leq \lambda_2 \leq ... \leq \lambda_n \), and the columns of \(\bm{U}\) are the corresponding eigenvectors.
Determined by a hyperparameter, only the \(k\)-th smallest eigenvalues and their eigenvectors are used, which we write as \( \bm{\Lambda}_k \in \mathbb{R}^{k \times k} \) and \( \bm{U}_k \in \mathbb{R}^{n \times k} \).
For each node \(v_i\), its PEs are initialized as the concatenation of the eigenvalues and the \(i\)-th row of \(\bm{U}_k\):

\begin{equation}
\label{eq:san-pe}
\bm{P}_i = \left[ \mathsf{diag}(\bm{\Lambda}_k) \mathbin\Vert \left(\bm{U}_k\right)_i \right] \in \mathbb{R}^{k \times 2}
\end{equation}

Further processing by a transformer encoder results in \( \bm{p}_i = f(\bm{P}_i) \in \mathbb{R}^{d_{p}} \), which is concatenated to the node features: \( \bm{h}_i^{(0)} = \bm{x}_i \mathbin\Vert {\bm{p}}_i \).
Additionally, the main graph transformer attention mechanism is modified to have two separate key and query weights for connected and unconnected node-pairs. The attention scores to the connected nodes and to the unconnected nodes are computed independently, each with a softmax. A hyperparameter \(\gamma \in \mathbb{R}^+\) controls how the two scores are relatively scaled, varying the bias towards sparse or full attention:

\begin{equation}
\label{eq:san-att}
\alpha_{ij} =
\begin{cases}
\frac{ 1 }{1 + \gamma} \mathsf{softmax} \left( \sfrac{ \bm{W}_{q,\mathsf{real}} \bm{h}_i \cdot \bm{W}_{k,\mathsf{real}} \bm{h}_j }{ \sqrt{d} } \right) & \text{if } (v_i, v_j) \text{ is a real edge} \\
\frac{ \gamma }{1 + \gamma} \mathsf{softmax} \left( \sfrac{ \bm{W}_{q,\mathsf{fake}} \bm{h}_i \cdot \bm{W}_{k,\mathsf{fake}} \bm{h}_j }{ \sqrt{d} } \right) & \text{otherwise} \\
\end{cases}
\end{equation}

Some graph transformer architectures (including all three chosen in this work) can optionally leverage available edge features, which we omit here since our evaluation data does not include any. Furthermore, edge features are typically not considered for pure structure perturbation attacks, as adding new edges would also require adding features for them.

§ NODE INJECTION ATTACK

We also consider the relevant case of inserting nodes into an existing graph structure. In contrast to the usual framing of Node Injection Attack (NIA), where the attacker also chooses the node features for the new vicious nodes <cit.>, we connect existing nodes from other graphs of an inductive graph dataset. Therefore, the nodes' features are fixed but physically realizable even if, e.g., they represent embeddings of natural language. NIA in this inductive setting is also interesting for attacking GTs since they allow to increase the graph size successively. This growth implies that the attention mechanism must allow for a smooth insertion of nodes.

Let \( \mathcal{D} = \{ \mathcal{G}_1,...,\mathcal{G}_N \}\) be the dataset including all graphs, where each graph \( \mathcal{G}_i = ( \mathcal{V}_i, \mathcal{E}_i ) \) has \(n_i\) nodes \( {V}_i = \{ v_{i,1},...,v_{i,n_i} \} \) with node feature matrix \(\bm{X}_i \in \mathbb{R}^{n_i \times d}\). The total number of nodes in the dataset is \(n_{\mathcal{D}} = \sum n_i\).
Let \( \mathcal{G}_{atk} \) be the graph that is being attacked.
We define the candidate set of injection nodes as the union of the nodes of all other graphs:
\( \mathcal{V}_{cs} = \bigcup_{\mathcal{G}_i \in \mathcal{D} \backslash \mathcal{G}_{atk}} \mathcal{V}_i \), which includes \( n_{cs} = n_{\mathcal{D}} - n_{atk} \) nodes with corresponding features \(\bm{X}_{cs}\). It is of course possible to restrict this candidate set if is is not sensible or not feasible to include all nodes.

We can augment the original (connected) graph by adding the injection candidate set as isolated nodes. Then \(\mathcal{G}_{atk}' = (\bm{A}_{atk}',\bm{X}_{atk}')\) is the augmented graph with:

\begin{equation}
\bm{A}_{atk}' = \begin{bmatrix}
\bm{A}_{atk} & \bm{0} \\
\bm{0} & \bm{0} \\
\end{bmatrix} \in \{0,1\}^{n_{\mathcal{D}} \times n_{\mathcal{D}}}, %
\qquad
\bm{X}_{atk}' = \begin{bmatrix}
\bm{X}_{atk}  \\
\bm{X}_{cs} \\
\end{bmatrix} \in \mathbb{R}^{n_{\mathcal{D}} \times d}
\end{equation}

Edge-flip perturbations to this augmented adjacency matrix, \(\Tilde{\bm{A}}' = \bm{A}' + \delta \bm{A}'\), model both structure perturbations and node injections together. As in Eq. <ref>, the perturbation \(\delta \bm{A}'\) can be expressed in terms of a binary edge flip matrix:

\begin{equation}
\label{eq:nia-edgeflip}
\Tilde{\bm{A}}' = \bm{A}' + (\bm{1}_n \bm{1}_n^{\mathsf{T}} - 2 \bm{A}') \odot \bm{B}', %
\qquad \text{with} \quad
\bm{B}' = \begin{bmatrix}
\bm{B} & \bm{E} \\
\bm{E}^{\mathsf{T}} & \bm{F} \\
\end{bmatrix} \in \{ 0, 1 \}^{n_{\mathcal{D}} \times n_{\mathcal{D}}}
\end{equation}

Since the number of edge flips is bounded by a budget usually much smaller than the candidate set size i.e., \(\Delta \ll n_{cs}\), the perturbed augmented graph \( \Tilde{\mathcal{G}} = (\Tilde{\bm{A}}', \bm{X}') \) still mostly contains isolated nodes. Therefore, we prune away all disconnected components, which for the unperturbed graph simply reverts the augmentation: \( \mathsf{prune}(\mathcal{G}') = \mathcal{G} \). However, for a perturbed augmented graph, this results in the perturbed graph that we are seeking:

\begin{equation}
\Tilde{\mathcal{G}} = (\Tilde{\bm{A}}, \Tilde{\bm{X}}) = \mathsf{prune}(\Tilde{\bm{A}}', \bm{X}')
\end{equation}

where, \(\Tilde{\bm{A}} \in \{ 0, 1 \}^{\Tilde{n} \times \Tilde{n}} \), \( \Tilde{\bm{X}} \in \mathbb{R}^{\Tilde{n} \times d}\), \(\Tilde{n} = n + n_{in} \) is the total number of nodes and \(n_{in}\) is the number of new injected nodes.

The node injection attack objective can thus be written as:

\begin{equation}
\max_{{\bm{B}}' \text{ s.t. } \lVert \bm{B}' \rVert_0 < \Delta} \mathcal{L}_{atk}(f_\theta(\Tilde{\mathcal{G}}))  %
\end{equation}

where, \(f_\theta\) is the trained GNN and \(\mathcal{L}_{atk}\) is a suitable attack loss. Note that the edge flip budget \(\Delta\) is also an upper bound for the number nodes that can be injected: \(0 \leq n_{in} \leq \Delta\).

Edge block sampling. To optimize the objective, we can apply the relaxation \(\bm{B}_{ij} \in [0,1]\), as shown in  <ref>. In this case, PRBCD <cit.> not only enables more efficient optimization, but setting a smaller block size is crucial to limit the number of connected injection nodes during optimization, since GTs complexity scales with \(O(\Tilde{n}^2)\).
Moreover, the edge sampling allows us to control which parts of \(\bm{B}'\) in Eq. <ref> to sample from, e.g. not sampling in \(\bm{B}\) results in `pure' node injections without modifying edges in the original graph.
For large candidate sets, we recommend only sampling from \(\bm{E}\), as sampling from the \(n_{cs}^2\) entries of \(\bm{F}\) results in many disconnected injection node pairs that get pruned away.

Node probability attention bias.

The continuous optimization of structure attacks in  <ref> assigns probabilities to edges-flips, while nodes are assumed to all be part of the graph. In contrast, during NIAs the nodes also have certain probabilities of being included. To obtain node probabilities from the edge weights in a general way, we propose a simple iterative computation.
For a continuous connected graph, let \(\mathcal{N}(v_i)\) be the $1$-hop neighborhood of node \(v_i\). We can approximate the probability \( p_i \) of \(v_i\) being connected to the graph, by using the probability that it is connected to its neighbors and the probability that these neighbors are connected to the graph. We start with the assumption that all nodes are connected to the graph and update using the edge probabilities:

\begin{equation}
p_i^{(t+1)} = 1 \ - \prod_{v_j \in \mathcal{N}(v_i)}(1 - \bm{A}_{ij} \cdot p_j^{(t)}), \quad \text{with} \quad p_i^{(0)} = 1
\end{equation}

The number of iterations should be set to match the expected longest chain of added injection nodes. Therefore very few iterations ($2$-$3$) should suffice for most NIAs.

We use the node probability to compute a weighted sum or mean in the graph-pooling for graph-level tasks, to ensure that the model output is continuous w.r.t. node injections.
Additionally for GTs, we use the node probability to bias the global pairwise attention scores which results in a continuous weighting of the attention scores:

\begin{equation}
\hat{w}_{ij} = w_{ij} + \log(p_j), \qquad \hat{\alpha}_{ij} = \mathsf{softmax}(\hat{w}_{ij}) = \frac{e^{\hat{w}_{ij}}}{\sum_{k}{ e^{\hat{w}_{ik}}}} = \frac{p_j \cdot e^{w_{ij}}}{\sum_{k}{p_k \cdot e^{w_{ik}}}}
\end{equation}

§ EVALUATION DETAILS

We build our implementation on top of GPS <cit.>, which uses the flexible GraphGym <cit.> framework of the PyG <cit.> library. All our experiments ran on an internal GPU cluster. Experiments that require less than 10GB of GPU memory were conducted on a Nvidia GTX1080Ti (10GB), the others on V100 and A100 GPUs ($32$/$40$GB). Attacking a single graph in our experiments takes anywhere from a few seconds to a few minutes, depending on the graph and model sizes.

We evaluate our structure attacks on the inductive node classification dataset CLUSTER <cit.>. It contains SBM-generated graphs with 6 clusters, where each cluster has one labeled node. The average number of nodes is $117$. The task is to predict which node belongs to which cluster. For training, we use the standard PyG train/val/test split of $10000$/$1000$/$1000$ graphs, respectively.
We use the UPFD Twitter fake news detection datasets from <cit.> to evaluate our node injection attacks. There are $2$ datasets: politifact, with political; and gossipcop with celebrity fake news. The average number of nodes is $131$ and $58$, respectively. The graphs consist of retweet trees, where the root node has features concerning both the news content and the user who posted the news. All other nodes' features are related to the users who retweeted the news. The task is binary classification of whether the graph contains fake news or not. We use the standard PyG train/val/test split of $20$/$10$/$70$% of the $314$/$5464$ graphs for politifact and gossipcop, respectively.

Due to the quadratic scaling in the number of nodes of the three chosen GTs, their application is limited to smaller graphs. This renders evaluation on larger graph datasets commonly used in robustness studies impractical.
While GTs are most widely applied to molecule data, adversarial attacks are of little practical relevance in that domain. Thus, we omit molecule data from our evaluations.

In this work, we focus on untargeted white-box evasion attacks, i.e., an attacker with full knowledge of the model and data attempts to change the trained model's prediction to any incorrect class at test time by slightly perturbing the input graph structure. See <cit.> for structure attacks in the poisoning setting, and <cit.> for a mixture of evasion and poisoning. For node-level tasks, we focus on global attacks that minimize the overall performance metric across all nodes. We solely consider supervised learning and refer to <cit.> for structure attacks in a contrastive setting.
For model training we do a random hyperparameter search, choosing the model with the highest validation metric. This approach is consistent with common practice.
As described in  <ref>, we show results for three attack types: adaptive, transfer, and random for a range of different budgets.

For both CLUSTER and the UPFD datasets, we evaluate our attacks on the 50 first graphs in the test set and report average and standard deviation over $4$ random seeds. For node classification, we use tanh-margin attack loss, shown to be effective in <cit.>. For the binary graph classification, we simply minimize/maximize the raw prediction score (before sigmoid) for labels $1$/$0$ as our attack loss. For CLUSTER attacks, we use a PRBCD block size of $20000$. For UPFD, we use a small block size of $1000$, which is necessary due to the $n^2$ scaling of GTs. For GCN it is possible to increase the block size, but we keep it the same for comparability.
We optimize all our adaptive attacks for $125$ steps and sample $20$ discrete perturbations from the result, of which we take the strongest. For all other attack hyperparameters, we use default values that performed well in preliminary evaluations.
For all results except the ablations, we use all of our continuous relaxations proposed in  <ref>.

CLUSTER constrained attack results.

§ ADDITIONAL RESULTS

We present the first principled analysis on the robustness of GTs on three representative architecture types (GRIT, Graphormer, SAN). We define different goals for our evaluation: (A) efficacy of the proposed adaptive attacks, (B) providing an accurate assessment of GT robustness for relevant real-world tasks. To this end, we perform our evaluation on datasets with varying complexity. Towards (A) we explore the robustness of GTs on CLUSTER, which comprises simple, interpretable structures. This exploration helps us evaluate the effectiveness of the proposed relaxations, ideally leading our attacks to target semantically meaningful structures within the dataset. We address (B) through evaluations on UPFD. Here, we constrain our attack to remain within the predefined tree structure of the dataset. As a result, the attack represents impersonating an existing user who is retweeting the respective news article. This evaluation goes beyond previous robustness analyses of citation networks in GNNs <cit.>, offering a more practical use case and semantically meaningful attacks.

CLUSTER. The node classification accuracy for the CLUSTER dataset for different attack budgets is shown in Fig. <ref>. Since only a single node in each cluster is labeled, attacking these labeled nodes requires little budget and leads to strong attacks. We manually inspected the perturbations and confirmed that most edge modifications are connected to the labeled nodes, which shows the efficacy of the attacks. The difference in attack strength between the adaptive and transfer attacks is insignificant. This confirms our hypothesis that the straightforward nature of the task leads to the same type of semantically meaningful perturbations, independent of the model (modifying the edges to labeled nodes). This would explain the strong transferability and little variation in robustness across models. This outcome positively indicates the effectiveness of our adaptive attacks (A), as they consistently identify meaningful perturbations across all GTs. They may sometimes be weaker than the transfer attacks simply due to a more difficult optimization function (GCN has fewer non-differentiable components).
To avoid the natural fragility in the data, we also evaluate a constrained attack that prohibits modifying edges to the labeled nodes, for which results are shown in Fig. <ref>. For CLUSTER, we additionally attack the GAT <cit.> and GATv2 <cit.> GNN models and include the adversarial perturbations for these in the transfer attack. Results for these are also shown in Fig <ref>.

GRIT pol.

Graphormer pol.

SAN, pol.

GCN, pol.

GRIT, gos.

Graphormer, gos.

SAN, gos.

GCN, gos.

Attack results for the UPFD twitter datasets politifact (pol.) and gossipcop (gos.).

For our node injection attack, we add all dataset nodes except for the graph roots into the candidate set since they have unique properties and include user and news features. We do not allow for perturbations of the original tree structure. If the discretely sampled perturbations do not have a tree structure, we take the maximum spanning tree (using the edge probabilities) to ensure all perturbations are valid retweet trees.

The graph classification accuracy for different attack budgets is shown in Fig. <ref>. In contrast to the results observed for the CLUSTER dataset, we note big robustness differences across models for UPFD. In general, Graphormer seems to be the least robust and for which our adaptive attacks work best in comparison to the baselines. For Graphormer on gossipcop the random baseline creates significantly stronger attacks than the transfer attacks, highlighting the importance of adaptive attacks. The adaptive attacks for GRIT are also significantly stronger than the baselines. The SAN attacks are the outlier, and for gossipcop the random baseline generates significantly stronger attacks than both adaptive and transfer. The reason may be that the Laplacian eigen-decomposition perturbation approximation does not hold well in the case of node injection. The ablation in Tab. <ref> also indicates that by disabling this relaxation much stronger attacks than reported in Fig. <ref> are possible.

Our results reveal that GTs showcase catastrophic vulnerabilities to adversarial modifications of the graph structure, even when these changes are constrained to meaningful perturbations. In comparison, the GCN model exhibits considerably higher robustness. Furthermore, we cannot derive a consistent pattern concerning the robustness of the different GT architectures and results differ depending on the dataset and attack. Both findings underscore the need for research into robust design choices of architecture components, such as PEs, and modifications to the attention mechanism.

We enable each of the continuous relaxations individually and in different combinations together. We report the results for Graphormer and SAN in Tab. <ref> and <ref> respectively. The node probability relaxation only applies to the node injection attacks on UPFD. The main insights from the results are:
(a) all continuous relaxations individually seem to give somewhat useful gradients and can be used to get better than random results.
(b) some work better than others, and using multiple does not seem to always work better than only one. We argue that they lead the optimization towards different adversarial perturbations, targeting features relevant for different components. However, one is not consistently better than the other.
(c) adding the node probability bias to the attention scores for node injection results is usually sufficient and leads to some of the strongest attacks.
(d) A good approach might be to try all individually as an ensemble and choose the strongest.
Additionally, we check the attack strength for GRIT when enabling or disabling gradient computation through certain parts of the model and show the results in Tab. <ref>. It is possible to get strong attacks even without computing gradients through RRWP, which could be much more efficient computationally, depending on the model and graph size. For node injection attacks, as for the other models, using only the node probability bias in the attention scores already leads to the strongest attacks we report.

Ablations for the Graphormer relaxations for a fixed budget of $1$% for CLUSTER unconstrained (u.) and constrained (c.), and $10$% for UPFD politifact (pol.) and gossipcop (gos.). Mean and standard deviation over $4$ runs with different seeds.

23emDeg.     23emSPD     2cAcc. (%)     23emNode prob.     2cAcc. (%)

(lr)3-4 (lr)6-7
CLUSTER, u.     CLUSTER, c.          UPFD pol.     UPFD gos.

\(52.61 \pm 0.57\)     \(\bm{60.00} \pm 0.42\)         \(67.0 \pm 2.0\)     \(\bm{38.0} \pm 0.0\)

\(\bm{46.78} \pm 0.46\)     \(68.45 \pm 0.37\)         \(67.0 \pm 2.0\)     \(\bm{38.0} \pm 0.0\)

\(50.81 \pm 0.41\)     \(60.66 \pm 0.21\)         \(\bm{66.5} \pm 1.9\)     \(39.5 \pm 1.9\)

\(\bm{66.5} \pm 1.9\)     \(38.5 \pm 1.0\)

\(80.5 \pm 3.4\)     \(53.5 \pm 1.0\)

2lrandom     \(66.52 \pm 0.61\)     \(70.29 \pm 0.32\)          \(85.0 \pm 2.6\)     \(61.5 \pm 4.1\)

2lclean     \(77.89\)     \(77.89\)          \(92.0\)     \(98.0\)

Ablations for the SAN relaxations for a fixed budget of $1$% for CLUSTER unconstrained (u.) and constrained (c.), and $10$% for UPFD politifact (pol.) and gossipcop (gos.). Mean and standard deviation over $4$ runs with different seeds.

23emAtten.     23emLap. pert.     2cAcc. (%)     23emNode prob.     2cAcc. (%)

(lr)3-4 (lr)6-7
CLUSTER, u.     CLUSTER, c.          UPFD pol.     UPFD gos.

\(53.95 \pm 0.59\)     \(63.27 \pm 0.27\)         \(83.5 \pm 1.0\)     \(91.5 \pm 4.1\)

\(\bm{53.87} \pm 0.26\)     \(\bm{63.20} \pm 0.12\)         \(77.5 \pm 1.0\)     \(91.5 \pm 2.5\)

\(57.12 \pm 0.62\)     \(67.22 \pm 0.17\)         \(83.5 \pm 1.0\)     \(89.5 \pm 1.9\)

\(\bm{77.0} \pm 1.2\)     \(89.5 \pm 3.4\)

\(86.0 \pm 0.0\)     \(90.1 \pm 6.0\)

2lrandom     \(65.70 \pm 0.65\)     \(68.86 \pm 0.32\)          \(86.0 \pm 0.0\)     \(\bm{87.5} \pm 1.0\)

2lclean     \(76.12\)     \(76.12\)          \(86.0\)     \(98.0\)

Ablations for the GRIT relaxations for a fixed budget of $1$% for CLUSTER unconstrained (u.) and constrained (c.), and $10$% for UPFD politifact (pol.) and gossipcop (gos.). Mean and standard deviation over $4$ runs with different seeds.

23emRRWP grad.     23emDeg. grad.     2cAcc. (%)     23emNode prob.     2cAcc. (%)

(lr)3-4 (lr)6-7
CLUSTER, u.     CLUSTER, c.          UPFD pol.     UPFD gos.

\(\bm{44.07} \pm 0.79\)     \(\bm{65.25} \pm 0.22\)         \(\bm{34.5} \pm 1.0\)     \(75.0 \pm 2.6\)

\(46.27 \pm 0.36\)     \(65.70 \pm 0.35\)         \(\bm{34.5} \pm 1.0\)     \(74.5 \pm 2.5\)

\(49.51 \pm 0.90\)     \(66.49 \pm 0.49\)         \(\bm{34.5} \pm 1.0\)     \(\bm{73.5} \pm 1.0\)

\(\bm{34.5} \pm 1.0\)     \(\bm{73.5} \pm 1.0\)

\(54.5 \pm 1.9\)     \(83.0 \pm 2.0\)

2lrandom     \(69.13 \pm 0.10\)     \(72.25 \pm 0.29\)          \(76.0 \pm 4.3\)     \(82.0 \pm 0.0\)

2lclean     \(78.98\)     \(78.98\)          \(98.0\)     \(84.0\)

§ LIMITATIONS

All our adversarial attacks do neither provide a guarantee nor insights about how close they are to the optimal adversarial example. We note that this is common practice in the adversarial learning community. Nevertheless, if we are able to find an adversarial example, this proves the non-robustness of the studied model.
Furthermore, we only look at three specific graph transformer architectures. While the continuous relaxations described here may not always be directly applicable to other GTs, our approach for designing adaptive attacks should provide a useful guide for further relaxations of similar components.