Rethinking Tokenized Graph Transformers for Node Classification

Jinsong Chen, Chenyang Li, Gaichao Li, John E. Hopcroft, Kun He

Abstract

Node classification is a critical task in graph data mining, traditionally dominated by Graph Neural Networks (GNNs). While Graph Transformers (GTs) have been introduced to overcome GNN limitations like over-smoothing, existing tokenized GTs are often "short-sighted," relying on local neighborhood information that fails to capture long-range semantic dependencies. This paper presents SwapGT, a framework designed to enhance tokenized GTs through two primary innovations: a token swapping operation and a center alignment loss. The token swapping mechanism expands the model's receptive field to multi-hop neighbors without the computational overhead of global attention, while the center alignment loss ensures representation consistency across different views. Experimental results across eight benchmark datasets demonstrate that SwapGT consistently outperforms state-of-the-art models, showing remarkable robustness in sparse data scenarios.

1. Introduction

In the realm of graph data mining, node classification—the process of predicting labels for nodes based on their features and structural context—serves as a foundational task for applications ranging from citation analysis to social network modeling. For years, Graph Neural Networks (GNNs) have been the architecture of choice. However, GNNs are prone to "over-smoothing," a phenomenon where node representations become increasingly similar as the network depth increases, eventually losing discriminative power.

Graph Transformers (GTs) were developed to address these limitations by treating nodes as sequences of tokens, enabling the capture of global relationships. Despite their promise, "tokenized GTs" often rely on a token generation process limited to first-order (1-hop) neighbors. This constraint restricts the diversity of information available to the Transformer, preventing it from learning deeper, multi-hop semantic dependencies essential for accurate classification.

2. The SwapGT Framework

To overcome the "short-sightedness" of traditional tokenized GTs, we propose SwapGT. This framework introduces a more dynamic approach to token generation and a robust regularization strategy.

2.1 Token Swapping Operation

The core innovation of SwapGT is the token swapping operation. In standard models, a target node $v_i$ is represented by a sequence of its immediate neighbors in a similarity or topology graph. SwapGT extends this by performing a recursive "swap": for a target node $v_i$, the model selects a neighbor $v_j$ and replaces it with a random node from $v_j$’s own token set.

By repeating this process $t$ times, the model effectively navigates the graph to include $(t+1)$-hop neighbors in the token sequence. This mechanism allows the Transformer to explore a "semantic neighborhood" far beyond the immediate vicinity of the target node, capturing long-range dependencies without the quadratic complexity associated with full global attention.

2.2 Dual-View Backbone and Center Alignment Loss

SwapGT processes node sequences through two distinct lenses:

  1. Attribute View: Focuses on feature similarity between nodes.
  2. Topology View: Focuses on structural connectivity and graph distance.

To ensure that the model learns a stable identity for each node across these different views and the stochastic nature of the swapping operation, we introduce the Center Alignment Loss ($L_{ca}$). This loss function calculates the "center" (mean representation) of multiple augmented sequences for a single node in the latent space and penalizes the distance between individual representations and this center. This acts as a powerful regularizer, forcing the model to prioritize core, invariant features over noisy, neighborhood-specific details.

3. Experimental Evaluation

The efficacy of SwapGT was evaluated on eight diverse benchmark datasets, including academic graphs (ACM, Citeseer, WikiCS, UAI2010), co-purchase graphs (Photo, Computer), and social graphs (BlogCatalog, Flickr).

The experiments were conducted under two primary settings:

  • Dense Splitting: 50% of the data used for training.
  • Sparse Splitting: Only 2.5% of the data used for training.

The sparse setting is particularly significant as it reflects real-world scenarios where labeled data is expensive or difficult to obtain.

4. Results and Analysis

SwapGT demonstrated superior performance across all tested environments, outperforming eleven baseline models, including established GNNs (e.g., APPNP) and contemporary GTs (e.g., NAGphormer).

4.1 Performance in Data-Scarce Environments

The advantages of SwapGT were most evident in the sparse (2.5%) training setting. For instance, on the Flickr dataset, SwapGT achieved an accuracy of 72.16%, a substantial improvement over the next best performing model, PolyFormer, which reached 67.85%. This suggests that the combination of semantic augmentation via swapping and the stabilizing effect of the Center Alignment Loss is highly effective when the model has limited labels to learn from.

4.2 Ablation Study

Ablation experiments confirmed the necessity of the proposed components. Removing the Center Alignment Loss (referred to as SwapGT-O) resulted in a consistent drop in accuracy. This highlights that constraining multiple token sequences to a shared "center" is vital for the model's ability to generalize across different samplings of the graph.

5. Conclusion and Future Work

SwapGT addresses a critical bottleneck in tokenized Graph Transformers by expanding their receptive field through structured token swapping and ensuring representation consistency via center alignment. While the model sets a new state-of-the-art, it currently utilizes a uniform swapping strategy across all graph types.

Future research will focus on developing adaptive token selection strategies that can automatically adjust to the specific topological and attribute distributions of different graphs. Furthermore, the challenge of scaling these multi-hop tokenization techniques to billion-node graphs remains a priority for future iterations of the framework.

Summary updated

BibTeX
@inproceedings{chen2025rethinking,
  author = {Jinsong Chen and Chenyang Li and Gaichao Li and John E. Hopcroft and Kun He},
  title = {{Rethinking Tokenized Graph Transformers for Node Classification}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=ofBqR4l0TD},
}
Figure