Calibrating Synthetic Graph Priors to the Deployment Graph

Some recent graph models are trained only on randomly generated graphs and then applied, with no further training, to real networks. The model reads a few labeled nodes of the new graph as context and predicts labels for the rest in a single forward pass. This is attractive because synthetic graphs are cheap and plentiful. The catch is the same one robotics calls the sim-to-real gap: the model learns the habits of the random-graph generator rather than the structure of real networks. We propose a different way to supply synthetic data. Before deployment, measure a handful of structural statistics on the unlabeled target graph, then fit a cheap generator to them. That generator should also deliberately produce graphs in which the labeled context nodes and the query nodes come from different structural regimes, so that the model practices handling distribution shift inside a single graph. The bet is that a few CPU-minutes of target-matched, shift-aware synthesis buys more out-of-distribution accuracy than either broadening the generic prior with the same GPU budget or running an expensive learned graph generator.

The opportunity sits where three problems meet. Graph neural networks fail sharply when topology shifts between training and deployment. Synthetic data that might fix this is often produced by costly generators. And cheap synthetic data carries its own realism gap. Current work treats these separately. Expensive generators are used to fix shift, and cheap generators are used only to benchmark. We treat the cheap generator as a simulator that can be tuned to reality, and we account for its cost honestly.

Core Claim

Our hypothesis is that most of the synthetic-to-real gap of graph in-context learners comes from mismatch in a small set of measurable structural statistics. These are size, degree heterogeneity, triangle density, how strongly features vary smoothly over edges, and homophily (the tendency of linked nodes to share labels). Homophily is the one statistic that needs labels, and we estimate it from the few labeled context nodes. A second source of gap is that the generic prior never shows the model context and query nodes drawn from different distributions, which is exactly the situation in graph out-of-distribution benchmarks. We expect two cheap steps to close a large share of the gap at a cost measured in seconds of CPU generation and minutes of GPU adaptation. The first is a short continued pretraining on graphs from a degree-corrected block model with triangle closure, fitted to the target. The second is building context-to-query shifts into those synthetic graphs.

The closest existing work is NodePFN, and it motivates this proposal. NodePFN pretrains a prior-fitted network on about 250,000 contextual block-model and Erdős–Rényi graphs in about 6 GPU hours. It reports 71.27% average zero-shot accuracy across 23 real benchmarks and 65.14% on heterophilic ones. Its authors acknowledge that the prior cannot produce realistic motifs such as triangles and cliques. The prior is fixed and target-agnostic, and as far as the file describes, its context and query nodes are statistically exchangeable. We change both properties.

Research Program

The first piece is a calibrated generator. We build on the hierarchical degree-corrected block model of GraphUniverse, which generates a 1,000-node graph in about 1.3 seconds on a CPU and whose model rankings correlate with real-data rankings at Spearman above 0.8. We add a triangle-closure step so clustering can be controlled. Node features come from random structural causal models, as in NodePFN. GraphUniverse supplies the method, but it is used there only for evaluation; we use it as a trainable simulator. Calibration fits a posterior over generator parameters to statistics of the target graph. Statistics that do not need labels are read off the unlabeled graph. Homophily gets a broad posterior centered on the labeled-context estimate. This mirrors real-to-sim fitting in robotics, as in X-Sim and neural-augmented robot simulation. Those methods correct a physics simulator from real rollouts. We apply the idea to a graph generator, which has far fewer parameters and is much cheaper.

The second piece is shift-aware synthesis. Within each synthetic graph we split context and query nodes along a sampled structural axis: degree bins, community membership, or a temporal-like ordering by attachment. This reproduces the kinds of node-level covariate shift catalogued in GOOD. With some probability we also flip which communities carry which label, so that concept shift appears too. DEROG constrains this design. It shows that on real data the environment can itself be informative of the label, and that a causal pattern's usefulness can change across environments. We therefore do not force a strict split into a causal core and spurious context. Instead we let the generator vary how much environment and label depend on each other, and we calibrate that dependence too.

The third piece is cost accounting. Every method is charged for generation time, pretraining or adaptation time, and inference time, in GPU-seconds or CPU-seconds reported separately. The comparison is accuracy at matched total cost, not accuracy alone.

The fourth piece is gap attribution. Across targets we regress the zero-shot error of the generic model on the distance between target statistics and the prior's typical range, one statistic at a time. This tests whether the "few statistics" hypothesis holds at all. A statistic that the prior covers but still predicts error would point to gaps this proposal cannot fix, such as feature realism.

Baselines

The naive reference point is a GCN trained by ordinary empirical risk minimization on each GOOD node-level training split. GOOD documents that this kind of model collapses under shift, for example from about 78% to 28% on GOOD-CMNIST, though that dataset is graph-level. We run it with the GOOD codebase's default hyperparameter search.

The strongest existing method is off-the-shelf NodePFN. It is the only model in the file that transfers from synthetic graphs to real graphs without per-dataset training, and it is the model our intervention modifies. Its reported figure is 71.27% average accuracy on its own 23-benchmark suite. We found no reported result on Lacuna for NodePFN on GOOD out-of-distribution splits, so we will measure it ourselves using the released checkpoint. NodePFN handles at most about 1,000 nodes. On GOOD-Arxiv and GOOD-Twitch we therefore evaluate every model, including ours, on the same sampled subgraphs of at most 1,000 nodes.

The equal-budget broadened prior is the baseline we consider most dangerous. It continues NodePFN pretraining for exactly the GPU time our adaptation uses, but on graphs drawn from a wider, target-agnostic prior. That prior is the same generator with triangle closure and random context-to-query shifts, with parameters sampled uniformly. Beating it is what isolates calibration from simply having more and more varied synthetic data.

We also run invariant-learning methods from the GOOD suite, namely VREx, GroupDRO and DANN, trained per dataset with the GOOD default tuning grid. We found no reported result on Lacuna for these methods on GOOD node-level splits that we can quote, so these numbers will also be produced ourselves.

Two ablations isolate our ingredients: calibration without shift-aware splits, and shift-aware splits without calibration. Success means that the full method beats the equal-budget broadened prior on the out-of-distribution test splits. The bar is a mean improvement larger than the across-seed standard deviation, on at least three of the four node-level GOOD datasets. Total added cost must stay below 10% of NodePFN's 6-GPU-hour pretraining.

Why not just…?

Why not just widen the generic prior until it covers every real graph? This is a real threat, and it is the domain-randomization answer to sim-to-real. Coverage might matter more than matching. The equal-budget broadened-prior baseline tests this directly. If it matches the calibrated version, we will report that calibration is unnecessary and that adding triangles and shift-aware splits to a single universal prior is the actual contribution. There are reasons to expect calibration to help. GraphWorld finds that real benchmarks occupy a narrow cluster of graph-property space and that model behavior changes sharply at boundaries such as 0.5 edge homophily. A uniformly broad prior spends most of its samples far from any given target.

Why not just train a GNN with an invariant-learning objective on the target's labeled split? Those methods need environment labels and per-dataset training. GOOD's 510 baseline runs show no single method wins across both covariate and concept shift. The invariant-learning baselines measure this on the same splits. If one of them wins at comparable total cost, the in-context route is not worth it for node-level shift.

Why not just inject random edge noise into clean synthetic graphs, in the style of adversarial point dropping? ASM shows that degrading clean synthetic LiDAR scans with learned point-drop masks narrows the gap: 22.8% mIoU against 15.2% source-only on SynLiDAR to SemKITTI. That result suggests "too clean" can matter more than "wrong statistics." We include random edge dropping and adding on the broad prior as an extra ablation. If noise alone recovers most of the gain, the gap is about cleanliness rather than calibration, and the proposal's story changes.

Why not just generate out-of-distribution graphs with a diffusion model? CODA does this for graph-level covariate shift, gaining 18.23% over the best augmentation baseline on GOOD-CMNIST. However, it requires a quadratic-cost graph transformer and iterative denoising, and its authors do not report generation latency. It is also not built for node classification within a single large graph. We will not claim to beat it on accuracy. We will report that the cost of our generator is measured in CPU-seconds, and we treat a node-level diffusion comparison as out of scope.

Proposed Experiments

The first experiment is a controlled study entirely in simulation. We hold out GraphUniverse families whose triangle density, degree exponent and homophily lie outside the generic prior's mass, with context and query split by degree. We then compare generic, broadened, and calibrated priors as the held-out family moves farther from the prior. If the hypothesis is right, the calibrated prior's advantage should grow with that distance and vanish near the prior's center. If it does not, the core claim is wrong.

The second experiment is the real benchmark: GOOD-Cora, GOOD-WebKB, GOOD-Twitch and GOOD-Arxiv, using both covariate and concept splits and capped subgraphs where needed. We report out-of-distribution accuracy, the gap between in-distribution and out-of-distribution accuracy, and the full cost breakdown, over five seeds. A secondary check on NodePFN's homophilic and heterophilic benchmarks verifies that calibration does not hurt where no shift is induced.

The decisive check combines the gap-attribution regression with the equal-budget comparison. The proposal succeeds if two things hold. Structural-statistic distance must explain a substantial share of the generic model's error. And calibration must beat equal-compute broadening exactly on the targets with high triangle density or extreme homophily. If broadening wins or ties everywhere, the result is still useful: it means graph priors should be made wider, not tuned to the target.