Abstract
Graph representation learning has recently transitioned from local message-passing to global Graph Transformers (GTs). However, GTs suffer from quadratic computational complexity and semantic entanglement in heterogeneous graphs. We present HeSRN (Heterogeneous Slot-aware Retentive Network), which replaces self-attention with a linear-time retention mechanism and introduces a slot-aware encoder to preserve the unique semantics of different node types. HeSRN achieves state-of-the-art accuracy on multiple benchmarks while being significantly more scalable than traditional Graph Transformers.
Introduction
The evolution of graph representation learning has seen a shift from Graph Neural Networks (GNNs) to Graph Transformers (GTs) to capture long-range dependencies. Despite their success, GTs face two primary challenges. First, the self-attention mechanism scales at $O(N^2)$, making it impractical for large-scale graphs. Second, real-world graphs are often heterogeneous, containing diverse node and edge types. Standard GTs often "entangle" these distinct semantics by forcing them into a unified feature space too early, which degrades model performance. HeSRN addresses these issues by combining the efficiency of Retentive Networks with a novel slot-aware encoding strategy.
Methodology
HeSRN's architecture is built upon three core innovations designed to balance expressiveness and efficiency.
Slot-Aware Structure Encoding
To prevent semantic entanglement, HeSRN projects node features into independent "slots" based on their specific types. This process involves Slot Alignment (normalization) and Slot Retention, which allows the model to learn the relative importance of different node types before fusion. By keeping these representations separate during the initial encoding phase, the model avoids the "blurry" understanding common in models that unify types prematurely.
Retention-based Encoder
Borrowing from the RetNet architecture, HeSRN replaces standard self-attention with a Retention Mechanism. This mechanism utilizes a decay mask and complex-valued positional modulation ($xPos$) to model dependencies in linear time ($O(N)$). This shift proves that the quadratic bottleneck of Transformers is not a requirement for high-performance graph learning.
Heterogeneous Retention Encoder (HRE)
The HRE captures both local structure and global context through a multi-scale approach. It integrates type-specific neighborhood information via GCN-like aggregation directly into the retention layers. This allows the model to attend to different semantic scales simultaneously, leveraging the exponential decay factor ($\gamma$) as an inductive bias where closer nodes have a stronger influence.
Experiments and Results
The performance of HeSRN was evaluated on four heterogeneous graph benchmarks: DBLP, IMDB, ACM, and Freebase.
Performance Metrics
HeSRN consistently outperformed state-of-the-art models such as HINormer and PHGT. On the IMDB dataset, HeSRN achieved a Micro-F1 score of 69.86%, surpassing the previous best of 68.81%. Ablation studies confirmed that both the "Slot" components and the "Retention" mechanism are critical; removing either led to significant performance degradation.
Efficiency and Scalability
A key advantage of HeSRN is its computational efficiency. The model operates with a complexity of $O(E + N)$, where $E$ is the number of edges and $N$ is the number of nodes. This is a substantial improvement over models like HINormer, which scales at $O(E + NL^2)$ based on sampled sequence lengths.
Discussion and Conclusion
HeSRN demonstrates that linear-time retention mechanisms can effectively replace self-attention in the graph domain. The introduction of "slots" provides a robust method for handling heterogeneity without losing semantic clarity. While currently optimized for static graphs, future work will focus on extending HeSRN to dynamic graphs through temporal retention mechanisms and scaling the architecture to handle industrial-grade graphs with billions of nodes.
Summary updated