A new class of graph models learns to classify nodes without ever seeing a real labeled graph. These models are trained only on millions of synthetic graphs and, at test time, read a handful of labeled nodes from a real graph and predict the rest in a single forward pass. The leading example, NodePFN, reaches 71.27% average accuracy across 23 real benchmarks this way. The synthetic generator, however, is fixed in advance and never consults the target graph. The sim-to-real literature has a name for what happens next: when the simulator cannot produce data that looks like the real deployment, a model trained on it fails, and better randomization alone does not fix this.
We propose closing that loop for graphs. Before predicting on a real graph, we read off statistics that need no labels or only a few: the degree distribution, clustering, how strongly node features agree across edges, and a rough class-to-class connection matrix estimated from the few labels plus the model's own first-pass predictions. We use these statistics to locate the region of a richer synthetic generator that produces look-alike graphs. We then briefly fine-tune the in-context model on graphs from that region before predicting. In two sentences: zero-shot graph models fail where the real graph lies outside what their simulator can produce, and we fix this by fitting the simulator to the target's observable structure and adapting to the fitted simulator. We also test, rather than assume, whether the gain comes from targeting or simply from a richer simulator.
Core Claim
The claim is narrower than "target-specific priors help," and the reason matters. A prior-fitted network, meaning a model trained to approximate Bayesian prediction under a synthetic data prior, already conditions on the target's labeled context. In the ideal case, narrowing its prior adds nothing, because the network already integrates over generator settings consistent with the context. Targeting can help in only two situations. The first is when the target lies outside the generator's support, for example a graph with heavy-tailed degrees or triangle-rich structure that a contextual stochastic block model cannot produce. (A contextual stochastic block model, or cSBM, plants communities with tunable within- versus across-class edge rates and class-dependent Gaussian features.) The second is when the network has spent too little capacity on the relevant region of a broad prior.
We therefore make two testable claims. First, a measurable gap between the target's statistics and the statistics the prior can generate predicts where zero-shot NodePFN underperforms per-dataset training. Second, on high-gap targets, fine-tuning on a target-fitted region of an enlarged generator beats both the original prior and the same enlarged generator used without targeting, at equal compute.
Positioning Against Prior Work
Two papers motivate the problem.
Learning Posterior Predictive Distributions for Node Classification from Synthetic Graph Priors trains on 250,000 cSBM graphs, with features and labels drawn from random structural causal models, and infers passively. It has no mechanism for detecting or repairing a mismatch between its generator and the target. We keep its architecture and add the diagnose-and-fit step.
Synthetic Graph Generation to Benchmark Graph Learning (GraphWorld) shows that real benchmarks occupy a narrow band of generator parameter space and that model rankings shift sharply around 0.5 edge homogeneity. This is evidence that a fixed broad prior spends most of its capacity far from real graphs. We reuse GraphWorld-style generation to build held-out synthetic targets whose mismatch we control exactly.
Two papers supply mechanism.
Sim2SG fixes the "content gap" in visual scene graphs. It predicts scene structure on unlabeled real images and re-renders matching synthetic scenes, beating plain domain randomization on CLEVR (0.888 vs 0.356 Recall@20). Our loop is its graph analogue, with one difference: the inputs are graphs rather than images, so there is no appearance gap to remove, and the whole gap is structural.
Structural Re-weighting Improves Graph Domain Adaptation estimates a target class-to-class connection matrix from pseudo-labels and re-weights a real source graph's edges to match it. It also proves that aligning feature distributions is suboptimal when class-conditional connectivity shifts. We borrow its pseudo-label estimate of the connection matrix. We use that estimate to steer a generator rather than to re-weight a real source graph, because our setting has no real labeled source.
Two papers constrain the design.
When Do Graph Foundation Models Transfer? A Data-Centric Theory decomposes transfer error into a sampling term and a "graphon mismatch" term. A graphon is a continuous limit object that generates dense random graphs. The paper also shows that sampling synthetic graphs from an estimated target graphon helps on COLLAB, reducing error from 0.4384 to 0.4069. This is the closest existing idea. It differs from ours in three ways: its theory covers dense graphs without node features, its target is graph classification, and its estimated graphon produces no labels or features. Our citation and web graphs are sparse and labeled, so we fit a sparse, feature- and label-generating simulator. We treat the decomposition only as motivation that a mismatch term should be measured and reduced.
Matcha adapts GNN hop-aggregation weights at test time with a clustering loss on the model's own predictions. It reports collapse when the initial predictions are near-random. We take this failure mode seriously in two ways: our loop starts from a zero-shot model that is usually far from random, and we use Matcha as a complementary baseline.
Research Program
The first component is an enlarged generator. To NodePFN's cSBM and causal-model features we add three things: degree correction with power-law exponents, a triadic-closure step that controls clustering, and a tunable coupling between feature similarity and edge formation that sets how informative features are relative to structure. Every parameter setting $\theta$ yields graphs with nodes, features and labels.
The second component is the target summary. We compute a vector $s(G)$ of label-free statistics: degree quantiles, average clustering, leading normalized-Laplacian eigenvalues, and feature cosine agreement across edges. We append a class-to-class connection estimate from the few labeled nodes plus the zero-shot model's predictions on the rest, refined over two or three rounds in the style of StruRW.
The third component is fitting. We draw candidate settings from the broad prior, simulate, and keep those whose summaries fall near the target's. This is approximate Bayesian computation, a simulation-based way to infer generator settings from data. It produces the tilted prior
$$p(\theta \mid G^{*}) \propto p(\theta)\, \exp\!\left(-\lVert s(G_\theta) - s(G^{*}) \rVert^2_{\Sigma} / \tau\right),$$
where $G^{*}$ is the target graph, $G_\theta$ a graph simulated at setting $\theta$, $\Sigma$ a per-statistic scale estimated from the broad prior's simulations, and $\tau$ a bandwidth chosen so that a fixed fraction of candidates survives. The distance from $s(G^{*})$ to its nearest broad-prior simulations is our gap score.
The fourth component is adaptation. We fine-tune the pretrained in-context model on a few thousand graphs drawn from the tilted prior, for a fixed small step budget, and then predict on the target. The target's own labels are never used for gradient steps. They enter only as in-context examples and in the connection-matrix estimate, which keeps the method from overfitting to a handful of labels.
Baselines
The do-nothing reference is zero-shot NodePFN with its original prior. Over the 23 benchmarks it reports 71.27% average accuracy, and 65.14% on the heterophily subset (NodePFN). This is the strongest existing method on exactly this question. No per-dataset or per-label-budget number was found on Lacuna for NodePFN, so we rerun it ourselves on its splits and on our reduced-label splits. Beating it means a statistically reliable gain over seeds in the average, and a larger gain on high-gap targets than on low-gap ones.
The key ablation is the same enlarged generator used without targeting. We pretrain on the broad enlarged prior for the original budget plus the fine-tuning budget, so total gradient steps match, and we spend none of it on targeting. This isolates the contribution of fitting from that of enlarging the simulator. A second ablation keeps targeting but drops the label-dependent connection estimate, which tells us whether the few labels matter beyond label-free topology.
A cheap targeting baseline selects among NodePFN models fine-tuned on fixed homophily slices, choosing by accuracy on held-out context labels. A Graph Merging analogue fits a degree-corrected block model directly to the target and fine-tunes on samples from it, following When Do Graph Foundation Models Transfer?.
On the adaptation side, we run Matcha on top of zero-shot NodePFN's message-passing branch. Matcha reports gains of up to 31.95% standalone under structure shift, but on different source models, so that number is not directly comparable here.
Among real-graph methods we include two. One is GraphCL-style contrastive pretraining on the target followed by fine-tuning on the few labels (Graph Contrastive Learning with Augmentations). The other is a GCN trained per dataset. All learned baselines get the same label sets, the same 20-configuration tuning budget, and the same validation protocol, which draws validation nodes only from the labeled pool.
Why not just…?
Why not just use a broader prior and skip targeting? This is the real threat. If the enlarged-but-untargeted model matches the targeted one, the honest conclusion is that NodePFN's failures come from simulator support rather than from capacity allocation, and the contribution shrinks to the enlarged generator plus the gap diagnostic. The matched-compute ablation above settles the question directly. GraphWorld's finding that real graphs cluster in a narrow region is the reason we expect targeting to still help on high-gap graphs.
Why not just fine-tune NodePFN on the target's few labeled nodes? With one to five labels per class, gradient steps on a large attention model are likely to overfit. Using those same labels as in-context examples is already what the model was trained for. We include direct fine-tuning as a baseline at every label budget, so if it wins, that will show.
Why not just run test-time adaptation such as Matcha? Matcha adjusts only how hops are mixed. That can repair degree or homophily drift, but it cannot teach the model a structural pattern its prior never contained. Matcha also documents collapse when initial predictions are weak. We run it both alone and stacked on our method, and we report whether the two are complementary.
Why not just do contrastive pretraining on the real graph? That approach learns invariances from a single graph and its hand-designed augmentations, which assume that perturbed neighborhoods keep their labels, an assumption that fails under heterophily. The comparison above is run on heterophilic sets such as Cornell, Texas, Wisconsin and Chameleon, where we expect it to lag. On homophilic citation graphs it may well be competitive.
Proposed Experiments and Decisive Checks
The first test is controlled and has known ground truth. We generate GraphWorld-style targets whose true settings lie inside the cSBM support, on its boundary, and outside it through power-law degrees and high clustering. The prediction is that the zero-shot deficit grows with distance from the support and that the gap score tracks that distance. On the in-support targets, targeting should give roughly nothing, consistent with the Bayesian argument above. A gain there would mean the method is exploiting something else, and we would investigate before claiming anything.
The second test uses NodePFN's 23 real benchmarks. These include Cora, CiteSeer, PubMed, DBLP, the heterophilic web graphs, Twitch, and ogbn-arxiv. We use the original splits and also 1, 3 and 5 labels per class, and report accuracy with variance over ten label draws. The decisive real-data check is a rank correlation, across datasets, between the gap score and zero-shot NodePFN's shortfall relative to a tuned GCN. We pre-register this test, along with the requirement that the targeted model's gains be concentrated in the high-gap half.
As a third check, we compare our estimated connection matrix with one computed from all true labels. This measures how much the pseudo-label refinement recovers when labels are scarce.
The project fails cleanly in either of two cases: the gap score does not predict where NodePFN fails, or the untargeted enlarged prior matches the targeted one on high-gap graphs. We will report either outcome.
References
- Learning Posterior Predictive Distributions for Node Classification from Synthetic Graph Priors
- Synthetic Graph Generation to Benchmark Graph Learning
- Sim2SG: Sim-to-Real Scene Graph Generation for Transfer Learning
- Structural Re-weighting Improves Graph Domain Adaptation
- When Do Graph Foundation Models Transfer? A Data-Centric Theory
- Matcha: Mitigating Graph Structure Shifts with Test-Time Adaptation
- Graph Contrastive Learning with Augmentations