Per-Relation Depth Budgets for Heterogeneous Graph Transformers

Graph neural networks pass messages along edges, and each extra layer averages a node's features with those of its neighbors. A few layers of this averaging help: a node with many neighbors gets a cleaner estimate of its local context. Many layers hurt, because all node features drift toward the same vector. This failure is called over-smoothing. Real graphs are usually heterogeneous: they contain several node types (papers, authors, venues) and several edge types, and those edge types can differ in density by orders of magnitude. Current hybrid models stack a few message-passing layers and then a global attention module that lets any node read from any other. They use one local depth for every edge type. Our claim is that this is the wrong design unit. Dense relations should get very few local hops, because they denoise fast and collapse fast. Sparse relations should get more local hops, or hand their long-range reach to the global module.

The proposal has two parts. The first is an analysis that measures, per edge type, how quickly propagation collapses the target type's feature space. The second is a simple rule that sets each relation's local depth from that measurement before training starts, with one shared tolerance knob. If a heterogeneous Graph Transformer built this way beats the same model with the best uniform depth, at matched tuning budget, then relation density is a design variable for these models and not only a property of the dataset. If it does not, the "density governs smoothing per relation" story is wrong for practical models, and we will say so.

Core Claim

The research file contains an unresolved tension. On one side, density is an asset. Shallow two-layer GNNs provably achieve perfect matching on noisy random geometric graphs as edge probability rises, because redundant neighbors average out feature noise (Perfect Recovery for Random Geometric Graph Matching with Shallow Graph Neural Networks). On the other side, density is a liability. Neighbor overabundance on dense knowledge graphs like FB15k-237 shrinks the gains from neighbor-anchor context relative to sparse WN18RR (Knowledge Graph Completion with Relation-Aware Anchor Enhancement). And attention GNNs collapse to a rank-one representation at an exponential rate whatever the attention weights are, because softmax weights stay positive and so never cut an edge (Demystifying Oversmoothing in Attention-Based Graph Neural Networks).

We read these as two regimes of the same process, separated by depth. In a heterogeneous graph, each relation sits at its own point on that depth axis. A citation relation with dozens of edges per paper finishes its useful denoising in one hop and then starts erasing differences. A paper–venue relation with one edge per paper has barely begun. A single depth is therefore always too deep for some relations and too shallow for others. The global attention stage of a hybrid model is the natural place to deliver reach that sparse relations cannot get locally without over-smoothing the dense ones.

Research Program

The measurement tool is effective rank. Effective rank is the exponential of the entropy of a feature matrix's normalized singular values. It is a scale-invariant count of how many independent directions the representations still occupy. We use it because Are we measuring oversmoothing in graph neural networks correctly? found that it tracks accuracy collapse with an average Pearson correlation of 0.91, while Dirichlet energy (the usual smoothness measure, based on squared feature differences across edges) fails once normalization layers are present. That paper also warns that preserving rank is necessary but not sufficient, so we always pair rank with accuracy.

For a target node type $t$ and a relation (or relation round-trip, such as paper–venue–paper) $r$, let $E_{t,r}(k)$ be the effective rank of type-$t$ features after $k$ untrained propagation steps along $r$ alone. The depth budget is

$$k_r = \max\{k : E_{t,r}(k) \ge \rho \, E_{t,r}(0)\},$$

where $\rho \in (0,1)$ is the single tolerance shared by all relations. Computing this takes a few sparse matrix products per relation before training. The model then runs relation-specific local message passing for $k_r$ hops per relation, in the style of Heterogeneous Graph Transformer (HGT), which uses attention weights indexed by (source type, edge type, target type). After that comes a global stage. We build it in two variants. The first is a learnable summary token in the style of GraphTrans (Representing Long-Range Context for Graph Neural Networks with Global Attention). The second uses cluster-level global tokens in the style of PHGT (Heterogeneous Graph Transformer with Poly-Tokenization), which keeps memory bounded on large graphs.

We keep a local stage at all, rather than pure attention, because Self-Attention in Colors: Another Take on Encoding Graph Structure in Transformers shows that global attention alone cannot express local connectivity.

The analysis half of the program tests the assumption the rule depends on. The assumption is that the per-relation collapse rate is set mainly by relation density, and not by feature content or by type. We test it with controlled edits on real schemas. On DBLP and ACM, we subsample one relation's edges, or add degree-preserving random edges to it, across a range of mean degrees. We then record per-type effective-rank curves and the accuracy-optimal uniform depth.

The file contains a direct challenge to using the spectral gap as a stand-in for density. Generically, a larger spectral gap means faster mixing and therefore faster smoothing. Yet Spectral Graph Pruning Against Over-Squashing and Over-Smoothing shows that targeted edge deletions can raise the gap while slowing energy decay. For this reason we define budgets from measured rank decay and not from the gap. We report the gap alongside, to see which proxy actually predicts the depth that gives the best accuracy.

Relation to Prior Work

Three hybrid heterogeneous models motivate this work and supply its parts. PHGT sends a two-to-three-layer local GNN into node, meta-path, and cluster tokens. H2G-former, from When Heterophily Meets Heterogeneity: New Graph Benchmarks and Effective Methods, restricts attention with type-specific feed-forward layers and $k$-hop masks. TAGDN, from TAGDN: type-aligning graph diffusion network for capturing long-range dependencies in heterogeneous graphs without over-squashing and over-smoothing, aligns type distributions with Gaussian optimal transport and then diffuses for up to 40 steps. All three use one propagation depth or one mask radius across relations. We change exactly that variable and leave their other components alone.

The research file's own "Gap 1" proposes monitoring effective rank during training to switch dynamically between local and global computation. Our version is deliberately more static and cheaper. We measure once, before training, at the level of relations rather than individual nodes, and we state a hypothesis that can be falsified. Spectral pruning (PROXYDELETE) both constrains the design and gives us a competitor. It changes density on homogeneous graphs by deleting edges. We keep every edge, because the dense hop is where the denoising happens, and change only how many times each relation is applied.

Baselines

The naive reference is HGT with a uniform local depth and no global stage, with depth tuned over one to six layers. This measures what heterogeneity-aware local attention achieves without any density treatment.

The central comparison is the same hybrid architecture with a uniform local depth for every relation. We tune that depth on validation over one to six, and our method tunes $\rho$ over the same number of values (six). Both get the same seeds, optimizer, hidden size, and global module. This isolates the key ingredient: whether depth is assigned per relation.

Two further ablations bound the effect. The first assigns the same multiset of budgets to relations at random, which tests whether gains come from matching budgets to density or merely from having mixed depths. The second searches exhaustively over per-relation depths on the small ACM and DBLP schemas. This gives an upper bound that tells us how much of the available gain the one-knob rule captures.

The strongest existing method on the heterophilic heterogeneous benchmark is H2G-former. On oag-cs it reports 28.47% accuracy, against 22.51% for HGT (When Heterophily Meets Heterogeneity: New Graph Benchmarks and Effective Methods). We will rerun it with its released configuration and give our model an equal hyperparameter-trial budget. Beating it means higher mean accuracy over five seeds, with non-overlapping standard deviations, on a majority of the H2GB datasets we run.

On the HGB datasets (DBLP, ACM, IMDB, Freebase), PHGT is the strongest hybrid baseline. The file states only that it achieved the highest Micro-F1 on all four, so there is no reported result found on Lacuna for PHGT's numeric Micro-F1. We will reproduce it and compare against our reproduced numbers. TAGDN serves as the deep-diffusion competitor. It reports average gains of 5.02% in node classification over 12 baselines, but the file gives no per-dataset figures.

Why not just…?

Why not just tune one depth and add residual connections? This is the most likely way for the idea to fail. Residuals already slow collapse, and a well-tuned single depth might sit close enough to every relation's optimum. The uniform-depth hybrid with residuals and normalization is our central baseline, under matched tuning. If per-relation budgets do not beat it on schemas whose relation densities differ widely, the claim is falsified. We expect the gap to grow with the spread of densities across relations, and the controlled density edits let us test that trend directly.

Why not just subsample the dense relations down to a fixed degree, as HGT's balanced sampling partly does? This is a real threat, because it attacks density directly and costs nothing. Our argument is that capping degree throws away exactly the redundant neighbors that make one dense hop a good denoiser, the effect proven in the random-geometric-graph matching result. We will include per-relation degree caps tuned over the same trial budget. The deciding test is feature-noise injection on DBLP: if we are right, degree capping should lose more accuracy than depth capping as noise rises. If it does not, then degree capping is the better and simpler method.

Why not just let attention learn to down-weight dense relations? HGT's type-specific attention can in principle learn relation-level gates. However, Wu et al. prove that positive softmax weights cannot cut connectivity, so attention only delays collapse. A finite budget does stop propagation. We include a learned scalar gate per relation, applied at uniform depth. If those gates reach near-zero values on dense relations at deep layers and match our accuracy, the explicit budget adds nothing.

Why not just prune with PROXYDELETE per relation? Pruning removes edges for every layer, including the first, useful one. It is also defined only for homogeneous normalized Laplacians. We will apply it to each relation's projected graph on ACM and DBLP as a comparison, and report both accuracy and preprocessing time.

Proposed Experiments

The first decisive check tests the assumption. Across the controlled density edits, the per-layer effective-rank decay rate of a target type should rank relations in the same order as their mean degree, and the best uniform depth should fall as the degree of the dominant relation rises. If decay is driven by feature content rather than density, the budget rule has no basis, and we stop at the analysis.

The second check is a swap experiment. On DBLP, we sparsify one dense relation and densify a sparse one. The computed budgets should flip accordingly, and accuracy should be preserved under the new budgets but degrade under the old budgets frozen in place.

The third check is the head-to-head comparison on HGB (DBLP, ACM, IMDB, Freebase), measured by Micro- and Macro-F1. It also runs on H2GB (oag-cs, mag-year, RCDD, IEEE-CIS-G), measured by accuracy, against the baselines above at matched trial budgets and five seeds. For every model we report per-type effective-rank curves across depth. This lets us see whether accuracy gains coincide with preserved rank in the types fed by dense relations.

Finally, we report the cost of computing budgets and the memory use of the global stage. A method that wins only by spending more compute on its local stage would not count as a win.