Best of Both Worlds: Advantages of Hybrid Graph Sequence Models

Ali Behrouz, Ali Parviz, Mahdi Karami, Clayton Sanford, Bryan Perozzi, Vahab Mirrokni

Introduction

For years, the graph machine learning community has been split between two dominant paradigms. On one side, Message Passing Neural Networks (MPNNs) excel at capturing local structures but struggle with long-range dependencies due to "over-smoothing" and "over-squashing." On the other side, Graph Transformers (GTs) offer powerful global reasoning but are hampered by quadratic computational complexity ($O(N^2)$), making them impractical for very large graphs.

Recently, researchers have attempted to apply linear sequence models—like State Space Models (SSMs, e.g., Mamba) or linear RNNs—to graphs to achieve the best of both worlds. However, graphs lack a natural causal order. Simply flattening a graph into a sequence often destroys crucial structural information. To address this, researchers have introduced the Graph Sequence Model (GSM) framework, providing a mathematical foundation for ordering graph data so sequence models can learn effectively. Building on this, they propose GSM++, a hybrid model that bridges the gap between complex graph topologies and linear sequences.

The GSM++ Architecture

The GSM framework standardizes the process into three distinct stages: Tokenization, Local Encoding, and Global Encoding. GSM++ introduces two major innovations within this pipeline:

  1. Hierarchical Affinity Clustering (HAC) Tokenization: Instead of relying on random or degree-based node ordering, GSM++ utilizes HAC. This algorithm groups similar nodes into a tree structure. By traversing this tree (using Depth-First or Breadth-First Search), the model creates a sequence where structurally "close" nodes remain adjacent in the linear sequence. This is vital because sequence models like SSMs exhibit a "recency bias" and are more sensitive to nearby tokens.
  2. Hybrid Global Encoder: Rather than relying on a single model type, the global encoder uses a hybrid block consisting of a Mamba (SSM) layer followed by a Transformer layer. The SSM provides a strong inductive bias for local and sequential patterns, while the Transformer ensures the model retains global permutation equivariance and avoids "representational collapse" in deep architectures.
GSM++ Pipeline

Additionally, recognizing that no single ordering is universally optimal, the authors implement a Mixture of Tokenization (MoT). This "router" adaptively selects the best tokenization strategies for different regions of the graph.

Key Insights and Theoretical Findings

The paper provides several mathematical and empirical insights into why hybrid models succeed where others fail:

  • The "Counting" Advantage: Recurrent models (SSMs/RNNs) are fundamentally better at "counting" tasks (e.g., determining the number of specific nodes in a graph) than non-causal Transformers, which struggle without complex positional encodings.
  • Sensitivity vs. Distance: SSMs are highly sensitive to the distance between tokens, whereas standard Transformers maintain constant sensitivity. By using HAC to position relevant nodes close together, GSM++ effectively "primes" the SSM to maximize its learning potential.
  • The U-Shape Effect: Both causal Transformers and SSMs tend to preserve information best at the very beginning and very end of a sequence, a phenomenon the authors mathematically formalize.
  • No Free Lunch: The research confirms that there is no single "best" sequence model or tokenizer for all graph problems, motivating the flexible MoT approach.
Tokenization Heatmap

Evaluation and Results

GSM++ was rigorously evaluated across a massive battery of benchmarks, including standard GNN tasks (MNIST, CIFAR10), Long-Range Graph Benchmarks (LRGB), heterophilic datasets, and large-scale graphs like products-ogbn (2.4 million nodes).

  • State-of-the-Art Performance: GSM++ outperformed existing baselines in 8 out of 10 major benchmark categories.
  • Unprecedented Efficiency: On the massive products-ogbn dataset, many standard Graph Transformers crashed due to Out-of-Memory (OOM) errors. GSM++ not only ran successfully but achieved the highest performance with significantly lower memory usage.
  • Speed: In large-scale tests, GSM++ remained competitive with simple GatedGCNs in training time while delivering the accuracy of much heavier Transformer models.
  • Ablation Success: Removing the HAC tokenization or the hybrid nature of the encoder led to significant accuracy drops, confirming that the hybrid approach is essential to the model's success.

Limitations and Future Directions

While HAC is highly parallelizable and scales to billions of nodes in under an hour, it still introduces an additional preprocessing step compared to standard MPNNs. Furthermore, the MoT router adds a slight parameter overhead (~10k parameters), though this is negligible in practice. Future work will explore integrating even more sophisticated sequence backbones, such as xLSTM or TTT, within the GSM framework to push the boundaries of graph machine learning even further.

Summary updated

BibTeX
@inproceedings{behrouz2025best,
  author = {Ali Behrouz and Ali Parviz and Mahdi Karami and Clayton Sanford and Bryan Perozzi and Vahab Mirrokni},
  title = {{Best of Both Worlds: Advantages of Hybrid Graph Sequence Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=GJKe8WYHxq},
}
Figure