[Paper Review] Structure-Aware Transformer for Graph Representation Learning
Structure-Aware Transformer (SAT) augments graph transformers with a structure-aware self-attention that incorporates local subgraph information, achieving state-of-the-art results on several graph benchmarks by combining GNN-based subgraph extraction with Transformer attention.
The Transformer architecture has gained growing attention in graph representation learning recently, as it naturally overcomes several limitations of graph neural networks (GNNs) by avoiding their strict structural inductive biases and instead only encoding the graph structure via positional encoding. Here, we show that the node representations generated by the Transformer with positional encoding do not necessarily capture structural similarity between them. To address this issue, we propose the Structure-Aware Transformer, a class of simple and flexible graph Transformers built upon a new self-attention mechanism. This new self-attention incorporates structural information into the original self-attention by extracting a subgraph representation rooted at each node before computing the attention. We propose several methods for automatically generating the subgraph representation and show theoretically that the resulting representations are at least as expressive as the subgraph representations. Empirically, our method achieves state-of-the-art performance on five graph prediction benchmarks. Our structure-aware framework can leverage any existing GNN to extract the subgraph representation, and we show that it systematically improves performance relative to the base GNN model, successfully combining the advantages of GNNs and Transformers. Our code is available at https://github.com/BorgwardtLab/SAT.
Motivation & Objective
- Address limitations of standard GNNs (expressiveness, over-smoothing, over-squashing) in graph representation learning.
- Move beyond purely attribute-based attention by embedding explicit structural information into Transformer attention.
- Reuse or plug in any existing GNN to extract subgraph representations and improve overall performance.
- Provide theoretical guarantees on expressiveness and demonstrate empirical gains across diverse graph tasks.
Proposed method
- Reformulate Transformer self-attention as a kernel smoother and extend the exponential kernel to account for local graph structure via subgraphs.
- Introduce SA-attn, a structure-aware attention that uses a subgraph representation S_G(v) for each node and a kernel κ_graph comparing subgraphs: SA-attn(v) = sum_u κ_graph(S_G(v), S_G(u)) / sum_w κ_graph(S_G(v), S_G(w)) f(x_u).
- Define structure extractors φ(u,G) to generate subgraph representations, including k-subtree GNN extractors and k-subgraph GNN extractors, optionally concatenated with original node features.
- Allow the structure extractor to be any differentiable model (GNNs, graph kernels) and support edge attributes via capable extractors.
- Integrate the structure-aware attention into a Transformer block with skip connections, FFN, layer normalization, and a degree-based skip-factor to mitigate highly connected nodes.
- Combine SAT with absolute encodings (e.g., RWPE) for complementary information, improving performance further.
Experimental results
Research questions
- RQ1Can explicit structure-aware self-attention capture structural similarities between nodes beyond what absolute position encodings provide?
- RQ2What is the impact of using different subgraph extractors (k-subtree vs k-subgraph, and choice of base GNN) on predictive performance?
- RQ3Does SAT provide theoretical guarantees on expressiveness relative to the subgraph representations used by the structure extractors?
- RQ4How does SAT perform compared to state-of-the-art GNNs and graph Transformers across graph and node prediction benchmarks?
- RQ5Is SAT a practical enhancer that can improve any underlying GNN by providing structure-aware attention?
Key findings
- SAT achieves state-of-the-art performance on five graph prediction benchmarks, outperforming both GNNs and graph Transformers.
- Replacing or augmenting standard self-attention with structure-aware SA-attn yields representations that are at least as expressive as the underlying subgraph representations.
- Both k-subtree SAT and k-subgraph SAT consistently improve the base GNN across multiple datasets, with k-subgraph often offering higher expressiveness.
- Incorporating structural information via SAT provides notable gains over vanilla Transformer with RWPE absolute encoding alone.
- A theoretical result shows SA-attn preserves expressiveness relative to the subgraph extractor, and a Lipschitz-based bound relates node representation similarity to subgraph and feature similarity (Theorem 1).
- Experimental results on OGB datasets (CODE2, PPA) illustrate strong performance gains, with SAT variants outperforming several baselines.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.