[Paper Review] Gophormer: Ego-Graph Transformer for Node Classification
Gophormer proposes a novel graph transformer model that applies self-attention to ego-graphs—local subgraphs centered on individual nodes—instead of full graphs, significantly improving scalability and performance on node classification. By combining Node2Seq for ego-graph sampling, proximity-enhanced attention, consistency regularization, and multi-sample inference, Gophormer achieves state-of-the-art results across six benchmark datasets, demonstrating the viability of transformers in graph learning despite data scarcity and structural noise challenges.
Transformers have achieved remarkable performance in a myriad of fields including natural language processing and computer vision. However, when it comes to the graph mining area, where graph neural network (GNN) has been the dominant paradigm, transformers haven't achieved competitive performance, especially on the node classification task. Existing graph transformer models typically adopt fully-connected attention mechanism on the whole input graph and thus suffer from severe scalability issues and are intractable to train in data insufficient cases. To alleviate these issues, we propose a novel Gophormer model which applies transformers on ego-graphs instead of full-graphs. Specifically, Node2Seq module is proposed to sample ego-graphs as the input of transformers, which alleviates the challenge of scalability and serves as an effective data augmentation technique to boost model performance. Moreover, different from the feature-based attention strategy in vanilla transformers, we propose a proximity-enhanced attention mechanism to capture the fine-grained structural bias. In order to handle the uncertainty introduced by the ego-graph sampling, we further propose a consistency regularization and a multi-sample inference strategy for stabilized training and testing, respectively. Extensive experiments on six benchmark datasets are conducted to demonstrate the superiority of Gophormer over existing graph transformers and popular GNNs, revealing the promising future of graph transformers.
Motivation & Objective
- Address the scalability and overfitting issues of existing graph transformers that apply full-attention to entire graphs.
- Overcome the limitations of message-passing GNNs, such as over-smoothing and over-squashing, by leveraging the attention mechanism’s long-range modeling capability.
- Mitigate the negative impact of ego-graph sampling uncertainty through consistency regularization and multi-sample inference.
- Improve performance in low-data regimes by treating ego-graph sampling as an effective data augmentation technique.
- Demonstrate that graph transformers can outperform GNNs and existing graph transformers on node classification when properly designed with structural inductive bias.
Proposed method
- Introduce the Node2Seq module to sample ego-graphs centered on each node, reducing input size from |V| to |V_E| and enabling efficient training on large graphs.
- Design a proximity-enhanced attention mechanism that incorporates structural bias by encoding node proximity and edge types within ego-graphs, improving local inductive bias.
- Apply consistency regularization during training to align predictions across multiple sampled ego-graphs of the same node, stabilizing learning under sampling uncertainty.
- Implement a multi-sample inference strategy during testing, aggregating predictions from multiple sampled ego-graphs to reduce variance and improve robustness.
- Introduce $n_g$ shared global nodes into each ego-graph to inject global structural information without increasing model parameters per node.
- Use a stack of Gophormer layers with residual connections and layer normalization to progressively refine node representations through multi-head self-attention and feed-forward networks.
Experimental results
Research questions
- RQ1Can a graph transformer model based on ego-graphs outperform full-graph transformers and GNNs in node classification under data-scarce and large-scale settings?
- RQ2How does ego-graph sampling affect model generalization, and what strategies can stabilize training and inference under sampling-induced uncertainty?
- RQ3What is the optimal number of global nodes and transformer layers for balancing performance and generalization in ego-graph-based graph transformers?
- RQ4Does proximity-enhanced attention in ego-graphs improve performance compared to standard feature-based attention in graph transformers?
- RQ5To what extent does multi-sample inference improve robustness and accuracy compared to single-sample or full-ego-graph inference?
Key findings
- Gophormer achieves state-of-the-art performance on six benchmark node classification datasets, including Cora, Citeseer, and PubMed, outperforming both GNNs and existing graph transformers.
- The multi-sample inference strategy significantly improves performance over single-sample and full-ego-graph inference, with performance peaking at k=5 samples and stabilizing beyond that.
- Consistency regularization during training leads to more stable and accurate predictions by aligning outputs across multiple sampled ego-graphs of the same node.
- The optimal number of global nodes ($n_g$) is 2–3, as performance peaks at $n_g=2$ or $n_g=3$ and declines with higher values due to overfitting and increased parameter count.
- The optimal number of Gophormer layers ($L$) is 2–3 for small graphs (e.g., Cora, Citeseer) and 3–4 for larger graphs (e.g., Reddit, Photo), with deeper models suffering from overfitting.
- The proximity-enhanced attention mechanism effectively captures local structural patterns, contributing to improved performance compared to standard attention in ego-graphs.
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.