Calibrating Graph Networks Against Expected Disagreement

Graph neural networks, models that predict a node's label by pooling information from its neighbors, often report confidences that do not match how often they are right. The fixes that work best today are post-hoc calibrators, which rescale each node's confidence after training. They share one hidden rule: if a node's neighbors disagree with its prediction, lower its confidence. That rule is sound on graphs where linked nodes tend to share a label. Many important graphs do not work that way. In fraud, cybersecurity and academic knowledge graphs, links routinely join different classes, and those links carry many kinds of relations and node types. On such graphs, disagreement with neighbors is normal. It is not a warning sign, and a calibrator that treats it as one will wrongly shrink the confidence of correct predictions.

We propose replacing "do my neighbors agree with me?" with a better question: "do my neighbors look the way neighbors of my predicted class usually look, along this particular relation?" For each relation path in a typed graph, we estimate a class-compatibility table, which records, for nodes of class $c$, the typical label mix of their neighbors along that path. We then score each node by how surprising its observed neighbors are given its predicted class. These per-relation surprise scores, combined with a cheap weighting that trusts confident neighbors more than doubtful ones, feed a small network that outputs a per-node temperature. Because only a temperature changes, accuracy is untouched. The method reduces to existing agreement-based calibration when the compatibility table is the identity matrix, and it remains correct when classes systematically link to other classes. As far as we can find, it would also give the first calibration measurements on graphs that are both typed and heterophilous.

Core Claim

Existing topology-aware calibrators all read neighborhood disagreement as evidence of error. Ratio-Binned Scaling in On Calibration of Graph Neural Networks for Node Classification bins nodes by the fraction of neighbors that share their predicted label and fits one temperature per bin. CaGCN in Be Confident! Towards Trustworthy Graph Neural Networks via Confidence Calibration spreads logits with a second graph convolution under a "confidence homophily" assumption, meaning neighbors are assumed to be about equally sure. GATS in What Makes Graph Neural Networks Miscalibrated? attends over one-hop neighbor logit similarity and distance to the training nodes. The authors of the first and third papers state that their designs assume assortative graphs, meaning graphs where links mostly join same-class nodes, and they leave heterophilous calibration open. These papers motivate the gap.

Our claim is that the right calibration signal is deviation from expected neighborhood composition, measured separately for each relation path. Let $\hat y_i$ be node $i$'s predicted class. Let $m$ index metapaths, which are typed relation paths that start and end at the target node type, such as paper–author–paper. Let $\bar q_{i,m}$ be the confidence-weighted average predicted class distribution of $i$'s neighbors reached along $m$. Let $H_m[c,:]$ be the row of the compatibility table for class $c$, estimated from calibration nodes with known labels. The surprise feature is

$$ s_{i,m} = \mathrm{KL}\big(\bar q_{i,m} \,\|\, H_m[\hat y_i,:]\big), $$

where KL is the Kullback–Leibler divergence. The node temperature is $T_i = \mathrm{softplus}(f_\theta(s_{i,1},\dots,s_{i,M}, \log d_{i,1},\dots,\log d_{i,M}, \max_c p_{ic}))$. Here $d_{i,m}$ is the number of metapath neighbors, $p_i$ is the model's predicted distribution, $f_\theta$ is a two-layer network, and softplus is a smooth function that keeps the temperature positive. When every $H_m$ is the identity, $s_{i,m}$ becomes a smooth version of the agreement ratio used by Ratio-Binned Scaling. Longer metapaths give multi-hop context without edge-level attention. Multi-hop context matters because MixHop and H2G-former show that informative same-class signals often sit two or more hops away on heterophilous graphs. Avoiding edge-level attention matters because GATS runs out of memory on Reddit, as reported by GETS and WATS.

Research Program

The work has three parts.

The first part is diagnostic. It is the first calibration audit of heterophilous typed graphs. When Heterophily Meets Heterogeneity released the H2GB benchmark, nine datasets across five domains, together with the H2G-former model and a metapath-based heterophily index. It reported only accuracy and macro-F1. We will measure expected calibration error (ECE), the average gap between stated confidence and actual accuracy across confidence bins. We will report it for HGT from Heterogeneous Graph Transformer, H2G-former, and a flattened graph convolutional network, broken down by each node's local heterophily. The goal is to learn whether the under-confidence documented on citation graphs carries over, or reverses, when attention over typed relations is involved.

The second part is the calibrator itself. It is fitted on the standard calibration split with the base model frozen. We estimate $H_m$ with additive smoothing, so that rare classes in small calibration sets do not produce extreme values. GATS reports peaking with under 5% of nodes used for calibration, so the size of the calibration set is a central variable.

The third part is analysis. We will study whether surprise under the learned $H_m$ predicts errors better than raw disagreement does. We will also study which metapaths the temperature network relies on, and whether it tracks the metapath-level heterophily index.

We also use one idea from Uncertainty Estimation for Heterophilic Graphs Through the Lens of Information Theory. That paper shows that on heterophilous graphs, intermediate layers still hold label information, and it detects out-of-distribution nodes (AUC-ROC 100.0 on Roman Empire far feature shifts) with a nearest-neighbor density over all layers. It reports no ECE. We test a cheap version of its insight by computing $\bar q_{i,m}$ from intermediate-layer predictions as well as final ones. This is an ablation, not the core method.

Baselines

The naive reference points are the uncalibrated model and a single global temperature. We add type-and-relation-binned temperature scaling, which fits one temperature per bin of target node type and dominant incoming relation. This is the cheapest way to "use the schema."

The strongest existing methods are GATS, GETS and WATS, each run on the flattened graph. GETS routes each node to one of several graph convolutional experts using features, degree and logits. It reports 28.60% lower ECE than CaGCN and 26.62% lower than GATS on assortative graphs. WATS feeds multi-hop heat-kernel wavelet features into an MLP. It reports up to 41.2% lower ECE and already includes some heterophilous homogeneous graphs, which makes it the most direct competitor. The strongest per-dataset figure in the file is GATS reducing ECE on Cora with a GAT backbone from 23.31% to 3.18% (What Makes Graph Neural Networks Miscalibrated?). No reported ECE result was found on Lacuna for any calibrator on H2GB, Roman Empire, Chameleon or Squirrel, so every heterophilous number will be produced by us. For context on the base models, the file reports H2G-former at 28.47% accuracy on oag-cs versus 22.51% for HGT.

All calibrators get the same frozen base model, the same calibration and test splits, and ten seeds. Each gets the same hyperparameter search budget, tuned on the calibration split by negative log-likelihood. Methods that run out of memory are reported as such, not dropped.

Beating the baselines means lower mean ECE than the best of GETS and WATS on a majority of H2GB datasets, with non-overlapping seed intervals. It also means no loss on Cora, Citeseer and Pubmed.

Two ablations isolate the key ingredient. The first sets every $H_m$ to the identity, which gives an agreement-based calibrator over metapaths. The second feeds the raw neighbor class histograms $\bar q_{i,m}$ to $f_\theta$ with no compatibility normalization.

Why not just…?

Why not just fit one temperature per node or relation type? On many H2GB tasks the prediction targets are a single node type, so per-type scaling collapses to global scaling. Per-relation binning cannot tell a paper whose co-author neighbors look typical for its class from one whose neighbors look atypical. That distinction is exactly the signal we claim matters. The binned baseline will show directly whether the schema by itself carries the gain.

Why not just flatten the graph and run WATS or GETS? Adapting Homogeneous Graph Learning to Heterogeneous Structures argues that flattening mixes distinct relation semantics. The WATS authors themselves note that their temperatures degrade when structure correlates only weakly with confidence. Still, this is a real threat, because WATS already handles some heterophily. If flattened WATS matches us on H2GB, then typed compatibility does not matter for calibration, and we will report that.

Why not just give an MLP the raw per-relation neighbor histograms and let it learn the compatibility? This is the most serious alternative. A flexible network could in principle learn $H_m$ on its own. Our bet is that normalizing by an explicitly estimated $H_m$ is a strong inductive bias when calibration sets are small and class counts are large. We will settle this by sweeping the calibration set from 1% to 20% of nodes. If the raw-histogram network matches our method at every size, we will drop the compatibility normalization and present the contribution as the metapath-surprise features and the diagnostic study.

Proposed Experiments

We run on all nine H2GB datasets (ogbn-mag, mag-year, oag-cs, oag-eng, oag-chem, RCDD, IEEE-CIS-G, H-Pokec, PDNS). We add the homogeneous heterophilous graphs Roman Empire, Amazon Ratings, Chameleon and Squirrel, where the only metapath is the edge itself, and Cora, Citeseer and Pubmed as a check that the method reduces to agreement-based behavior. We report ECE, classwise ECE, negative log-likelihood and Brier score, which is the mean squared error of predicted probabilities. We also report ECE within bins of local heterophily, and peak memory.

There are three decisive checks.

The first check targets strongly heterophilous regions. There, agreement-based calibrators (Ratio-Binned Scaling, GATS, and our identity-$H$ ablation) should lower confidence on correct predictions, which shows up as under-confidence in reliability diagrams. The full method should not.

The second check uses a synthetic graph built from Cora by rewiring. Each class $c$ links mainly to class $\pi(c)$, where $\pi$ is a fixed permutation of the classes. Accuracy-relevant structure is unchanged, but agreement is destroyed. Our method's ECE should stay roughly constant as rewiring increases, while agreement-based calibrators should degrade.

The third check tests whether the whole approach is needed. If surprise $s_{i,m}$ does not predict errors better than raw disagreement, as measured by error-detection AUROC on the test split, then the premise is wrong and the method should not be pursued.