Self-Supervised Compatibility Weights for Heterophilic Heterogeneous Graphs

Many real networks hold several kinds of nodes and links at once: movies, actors and directors; transactions, cards and banks. These are called heterogeneous graphs. Their links often join nodes that differ in the property we care about, a condition called heterophily. Two movies that share an actor can belong to completely different genres. Graph neural networks average each node's neighbors, which quietly assumes neighbors are alike. Contrastive pre-training adds a second version of the same assumption. It learns without labels by pulling "positive" pairs together, and positives are usually defined as nodes connected by a typed chain of relations such as Movie–Actor–Movie, called a meta-path. When the graph is heterophilic, both the averaging and the choice of positives inject noise.

This note proposes a fix inside label-free pre-training. Instead of assuming that connected nodes are similar, the model learns a small compatibility matrix for each relation type. The matrix states which latent groups tend to link to which, and it may contain negative entries that push representations apart. The latent groups are discovered at the coarse, graph-wide level by soft clustering of the contrastive embeddings. The compatibility matrices then turn those group memberships into a signed weight on every individual edge. Each weight does two jobs. It controls how much, and in which direction, a neighbor's message counts during aggregation, and it decides how strongly that neighbor counts as a positive or a negative in the contrastive loss. In two sentences: coarse clusters supply a label-free stand-in for classes, and per-relation compatibility turns that stand-in into signed, edge-level neighbor weights. Those weights replace both the "neighbors are similar" averaging and the "meta-path neighbors are positives" sampling rule.

Core Claim

Heterophily in heterogeneous graphs is known to depend on the meta-path. AHGNN and H2SGNN show in supervised settings that some meta-paths need smoothing and others need sharpening filters. Our claim goes further and makes two testable points. First, heterophily also varies within a meta-path, from edge to edge, in a structured way that follows latent groups. An actor links a drama to a thriller, not to a random movie. Second, this structure can be recovered without labels, and using it at the edge level is better than either one scalar weight per meta-path or static connection counts.

Concretely, let $p_i \in \mathbb{R}^K$ be node $i$'s soft assignment to $K$ prototypes (cluster centers learned on the embeddings of its node type), and let $\Omega_r \in \mathbb{R}^{K \times K}$ be a learnable, unconstrained compatibility matrix for relation or meta-path $r$. The weight on edge $(i,j)$ under $r$ is

$$ w^{r}_{ij} = \frac{p_i^{\top} \Omega_r \, p_j}{\sum_{k \in \mathcal{N}_r(i)} |p_i^{\top} \Omega_r \, p_k|}, $$

where $\mathcal{N}_r(i)$ is $i$'s neighborhood under $r$. The denominator is a weighted-degree normalization, in the spirit of the "Neighbor Norm" in HA-GAT, rather than a softmax. As a result, weights can be negative. A negative weight subtracts the neighbor's features, which acts like a sharpening (high-pass) filter on that edge. A positive weight acts like smoothing (low-pass).

In the contrastive loss, a meta-path neighbor $j$ of anchor $i$ enters as a positive with strength $\max(w^r_{ij},0)$ and as an extra hard negative with strength $\max(-w^r_{ij},0)$. Writing $s(\cdot,\cdot)$ for temperature-scaled cosine similarity between embeddings $z$, the neighbor-level term becomes

$$ \mathcal{L}_{\text{local}} = -\sum_i \sum_{r}\sum_{j\in\mathcal{N}_r(i)} \max(w^r_{ij},0)\,\log\frac{e^{s(z_i,z_j)}}{e^{s(z_i,z_j)} + \sum_{k} e^{s(z_i,z_k)} + \sum_{j'} \max(-w^r_{ij'},0)\,e^{s(z_i,z_{j'})}}, $$

where $k$ ranges over ordinary random negatives. The coarse level is trained with a standard prototype-consistency loss between two augmented views. It produces the $p_i$, and gradients from the local loss into $p$ are stopped to avoid a self-confirming loop.

Relation to Prior Work

The closest work is HGMS, which motivates this proposal. It shows that meta-path homophily varies, and that the number of distinct meta-paths between two nodes (its Metapath-based Connection Strength) correlates with label agreement. It uses that count to protect edges during augmentation, and uses a self-expressive matrix to flag false negatives. Its signal is a static count, however, and it never changes how messages are aggregated. Our weights are learned, signed, edge-specific, and drive both aggregation and pair selection.

M2HGCL is the design we argue against. It contrasts at local–local and local–global levels and attends over 1-, 2- and 4-hop scales, but it treats every meta-path-reachable node as a positive. HGMS's IMDB evidence suggests this rule is harmful under heterophily.

Two papers supply our method. HA-GAT supplies the mechanism of edge preferences from category-distribution outer products, a learned inter-category matrix, and non-softmax normalization. It is supervised, its "explorer" is a GCN trained on labels, and it works only on single-relation graphs. We replace its explorer with self-supervised prototypes and give each relation its own matrix. AHGNN supplies the evidence that per-meta-path filtering is needed, and its decoupled propagation shows how to stay near-linear. Its weights are per-path coefficients, not per-edge, and it is trained with labels.

Homogeneous contrastive methods for heterophily, HLCL and GCL-IVG, constrain the design. Both split edges into similar and dissimilar sets before filtering. HLCL splits by raw feature similarity and degrades on Penn94, where features barely predict labels. GCL-IVG's counterfactual generator costs $O(|V|^2)$. We therefore avoid raw-feature similarity as the homophily signal and avoid all-pairs computation. Our weights cost $O(|E|K^2)$ with small $K$. Finally, FUEL tunes a graph-wide "convolution dial" over $X$, $\hat{A}X$ and $\hat{A}^2X$ using cluster separability. It is the natural per-graph (and, extended, per-meta-path) scalar version of our idea.

Research Program

We will build the encoder as relation-specific signed aggregation layers using $w^r_{ij}$, with type-specific input projections so that differently-typed features are never averaged directly. We will run it on the original typed graph and on meta-path neighborhoods, with a coarse prototype head per node type. Propagation over fixed meta-paths will be precomputed sparsely in the decoupled style of AHGNN, so that only the $K \times K$ matrices and the prototypes change during training.

Two analyses accompany the method. The first measures within-meta-path heterogeneity, using labels only for analysis. For each meta-path we will compute how much edge-level label agreement varies across edges, and how much of that variance a $K \times K$ group-compatibility model explains with oracle groups versus learned prototypes. This number decides whether edge-level weighting can matter at all. The second checks the learned weights directly, as the correlation between $w^r_{ij}$ and true label agreement. We will compare it against HGMS's connection-strength count and against raw feature cosine similarity.

We will also study failure risks. Prototypes can collapse or merely echo feature clusters. To test this, we will vary $K$, initialize prototypes from features versus randomly, and report results on Penn94-like low feature–label correlation regimes. There, any gain must come from structure-derived groups, because feature clusters are known to fail.

Baselines

The naive reference points are two. One is a linear probe on raw node features with type-specific projections. The other is standard meta-path-projected contrastive learning, which converts each meta-path to a homogeneous graph and runs a GRACE-style InfoNCE. On homogeneous Texas, GRACE reports 63.54% accuracy against GCL-IVG's 90.09% (GCL-IVG), so we expect this baseline to be weak on IMDB. It is still the floor every method must clear.

The strongest self-supervised competitor is HGMS in both variants: HGMS-N with the neural self-expressive model and HGMS-C with closed-form Woodbury inversion. It targets exactly this question. The file reports only relative gains for it: a 19.07% Macro-F1 improvement on IMDB, an 11.5% and 22.3% NMI improvement on ACM and AMiner, and a 100% ARI improvement on IMDB, all over prior methods. No absolute reported result was found on Lacuna for HGMS on any dataset, so we will rerun it from its released configuration. M2HGCL is the second self-supervised competitor, representing reachability-based positives. The file reports a 36% NMI and 49% ARI gain over HGCML on Freebase, and nearly 2% Macro-F1 over the nearest competitor on AMiner. Again no absolute numbers are reported, so we will rerun it.

Every self-supervised method gets the same embedding dimension and the same linear-probe and k-means evaluation, and the same split seeds. Each method gets an equal hyperparameter search budget of the same number of trials over its own key parameters. Matched GPU-hours are reported.

As a supervised ceiling on large heterophilic heterogeneous graphs, we cite H2G-former from the H²GB benchmark paper. It reports 28.47% accuracy on oag-cs against a best prior baseline of 22.51%, and an F1 of 31.55 on IEEE-CIS-G. We will also train AHGNN with labels as a supervised reference on the academic datasets. We do not expect a linear probe on frozen embeddings to beat these supervised models with full labels. Beating them in the few-label regime, with 20 labels per class, would be meaningful.

The ablations isolate the key ingredient, edge-level signed compatibility. In the first, $\Omega_r$ is replaced by a single learnable scalar per meta-path. This is the FUEL/AHGNN-style dial run inside our identical pipeline. In the second, the weights are clamped non-negative with softmax normalization, which is GAT-style. In the third, prototypes are replaced by raw-feature cosine similarity, which is HLCL-style. In the fourth, $w$ is used only in the loss, or only in aggregation. Beating the strongest baseline means a higher mean across five seeds than HGMS's best variant on IMDB, Freebase and the H²GB datasets, outside seed standard deviation, in both linear-probe Macro-F1 and clustering NMI. On ACM and DBLP, results must be no worse than HGMS.

Why not just…?

Why not just learn one weight per meta-path, as AHGNN or a per-path FUEL dial would? This is the real threat. If heterophily is uniform within each meta-path, a scalar per path captures everything, and our $K \times K$ matrices add only variance. The within-meta-path heterogeneity analysis settles it before any method comparison. If edge-level label agreement barely varies within IMDB's MAM path or H²GB's relations, we will report that and the edge-level claim fails. The matched-pipeline scalar ablation then measures the actual gain. We will only claim the idea if the gain concentrates on the meta-paths where within-path heterogeneity is high.

Why not just use HGMS, which already detects false negatives? HGMS uses its self-expressive matrix to remove false negatives, and uses connection counts to choose which edges to keep. Aggregation itself still averages, so heterophilic neighbors that survive augmentation still blur the encoder. Its closed-form variant also needs matrix inversions that do not scale without downsampling. Our comparison on ogbn-mag and the H²GB datasets, together with the "weights in loss only" ablation, separates the benefit of better pair selection, which HGMS already has, from the benefit of signed aggregation, which it lacks.

Why not just put GAT or HAN attention inside the contrastive encoder? Softmax attention can only form convex combinations of neighbors, so it remains a smoothing filter whatever it learns. On Chameleon, vanilla GAT reaches 65.89% against HA-GAT's 72.58% (HA-GAT), and that gap comes from exactly the non-convex normalization and category-affinity matrix we reuse. Our non-negative softmax ablation tests whether the gap carries over to the self-supervised heterogeneous setting.

Why not just drop the graph and use features, given heterophily? Feature-only models lose substantial signal. HA-GAT's structural explorer adds about 6% on Squirrel over an MLP, and HLCL's authors find that feature-only classification is insufficient. On Penn94-like data, features are themselves the weak signal. The raw-feature probe is included as the floor.

Decisive Checks

The experiments use the heterogeneous benchmarks ACM, DBLP, AMiner, Freebase and IMDB, with IMDB as the known heterophilic case. Scale and heterophily are tested on the H²GB datasets oag-cs, IEEE-CIS-G and PDNS under their temporal splits, and on ogbn-mag. Penn94 and Chameleon, Squirrel and Actor serve as single-relation checks, where the method reduces to one $\Omega$. Cora and PubMed confirm there is no collapse on homophilic graphs.

Three outcomes would decide the proposal. The first is whether learned $w^r_{ij}$ tracks true edge label agreement better than HGMS's connection counts and raw feature similarity, measured as correlation on held-out labels. The second is whether the edge-level model beats the per-meta-path scalar ablation specifically on paths with high within-path heterogeneity. The third is whether the method runs on ogbn-mag and the H²GB graphs within memory limits where GCL-IVG and HGMS-C require downsampling. If the first two fail, the honest conclusion is that path-level filtering suffices, and the proposal reduces to a self-supervised AHGNN.