Message Passing Does More with Less for In-Context Learning on Graphs
Organizations: Nums AI · KAIST · Seoul National University
Abstract
Achieving strong performance with graph neural networks (GNNs) typically requires training and hyperparameter tuning for each dataset, incurring repeated costs and effort. Graph in-context learning (ICL) avoids this by using a single pretrained model to predict unknown node labels directly from labeled context nodes. Existing approaches, however, rely on dense attention across nodes, making inference increasingly expensive as graphs grow. In this work, we present Ephris, a new graph in-context learner built on sparse message passing, scaling linearly with the number of node-feature entries and graph edges. Ephris is pretrained entirely on synthetic graphs generated from structural causal models with diverse graph structures and relational dynamics, exposing the model to varied dependencies among topology, features, and labels. We evaluate Ephris on 51 node-classification datasets against 15 extensively tuned GNNs and existing graph ICL methods under both high- and low-label train/validation/test splits. Across both settings, Ephris ranks first on all four aggregate measures: Elo, improvability, average rank, and accuracy. Its inference cost remains comparable to training a single GNN once, while being over 10 times faster than previous graph ICL models. Together, these results advance the performance-runtime Pareto frontier, demonstrating that strong graph ICL does not require dense attention. Code and model weights are available at https://github.com/nums-ai/ephris.
Figures & tables
| Model | Computation |
| NodePFN | |
| GraphPFN | |
| Ephris |
| Stage 1 | Stage 2 | |
| # Node | 512–1,024 | 128–16,384 |
| # Feature | 2–128 | 2–1,024 |
| # Steps | 50,000 | 10,000 |
| Muon LR | ||
| AdamW LR |
Appendix figures & tables16 assets
Supplementary material from the paper’s appendix.
Appendix
| Setting | Choices or range |
| Rule | Diffusion, cascade, degree-dependent mixing |
| Aggregation | Mean, max, min, softmax |
| Direction | Incoming, outgoing, bidirected |
| Mixing coefficient | |
| Steps (diffusion and cascade) | |
| Seed fraction (cascade) |
| Parameter | Distribution |
| Spectral decay | |
| Nuisance rank | Uniform over |
| Nuisance amplitude | |
| Noise scale | |
| Lognormal scale |
| Component | Setting | Value |
| Tokenization | Feature-token dimension | 128 |
| Per-feature refinement | Inducing tokens | 128 |
| Attention heads | 8 | |
| Per-node refinement | Refinement blocks | 3 |
| Node-inducing tokens per node | 4 | |
| layers per block | 2 |
| Component | Setting | Stage 1 | Stage 2 |
| Task distribution | Updates | 50,000 | 10,000 |
| Graphs per update | 64 | 64 | |
| Node-count bounds | 512 to 1,024 | 128 to 16,384 | |
| Feature-count bounds | 2 to 128 | 2 to 1,024 | |
| Requested class count | 2 to 10 | 2 to 10 | |
| Context fraction | Uniform on |
| Dataset | Domain | Citation | |||||
| actor | Web | 7,600 | 932 | 5 | 7.02 | 0.003 | ( Pei et al., 2020 ) |
| amazon_computer | Commerce | 13,752 | 767 | 10 | 35.76 | 0.682 | ( Shchur et al., 2018 ) |
| amazon_photo | Commerce | 7,650 | 745 | 8 | 31.13 | 0.785 | ( Shchur et al., 2018 ) |
| amazon_ratings | Commerce | 24,492 | 300 | 5 | 7.60 | 0.140 | ( Platonov et al., 2023 ) |
| amherst41 | Social | 2,235 | 1,193 | 2 | 81.39 | 0.060 | ( Lim et al., 2021 ) |
| artnet-exp | Social | 50,405 | 75 | 2 | 11.12 | 0.155 | ( Bazhenov et al., 2026 ) |
| Method | Ref. | Default | Search space |
| Shared training | – | Adam; lr ; wd ; 2,500 epochs; patience | lr ; wd ; patience |
| APPNP | ( Gasteiger et al., 2018 ) | ; dropout ; ; ; prop. dropout | ; dropout ; ; ; prop. dropout |
| FAGCN | ( Bo et al., 2021 ) | ; dropout ; ; ; edge dropout | ; feature/edge dropout ; ; |
| GAT | ( Veličković et al., 2018 ) | ; heads ; dropout ; attn. dropout ; ; norm=None; residual=False; pre-transform=False | ; heads ; dropout ; attn. dropout ; ; norm ; residual/pre-transform |
| GATv2 | ( Brody et al., 2021 ) | ; heads ; dropout ; attn. dropout ; ; norm=None; residual=False; pre-transform=False | ; heads ; dropout ; attn. dropout ; ; norm ; residual/pre-transform |
| GCN | ( Kipf and Welling, 2017 ) | ; dropout ; ; norm=None; residual=False; pre-transform=False | ; dropout ; ; norm ; residual/pre-transform |
| No shift — ID-selected | |||||||
| Method | Cora | Arxiv | WebKB | Twitch | Avg. rank | ||
| Word | Degree | Time | Degree | University | Language | ||
| ERM | {\color[rgb]{0.0859,0.5,0.2344}\mathbf{73.02}}\,{\scriptstyle\pm\,0.14} | {\color[rgb]{0.0859,0.5,0.2344}\mathbf{72.99}}\,{\scriptstyle\pm\,0.12} | 5.92 | ||||
| IRM | 7.25 | ||||||
| VREx | 7.25 | ||||||
| GroupDRO | {\color[rgb]{0.0859,0.5,0.2344}\mathbf{69.19}}\,{\scriptstyle\pm\,0.28} | 5.75 | |||||
| ID-selected | |||||||
| Method | Cora | Arxiv | WebKB | Twitch | Avg. rank | ||
| Word | Degree | Time | Degree | University | Language | ||
| ERM | {\color[rgb]{0.8398,0.1523,0.1563}\mathbf{65.70}}\,{\scriptstyle\pm\,0.42} | {\color[rgb]{0.082,0.3945,0.7539}\mathbf{61.77}}\,{\scriptstyle\pm\,0.29} | {\color[rgb]{0.0859,0.5,0.2344}\mathbf{48.57}}\,{\scriptstyle\pm\,0.17} | 4.17 | |||
| IRM | {\color[rgb]{0.0859,0.5,0.2344}\mathbf{61.00}}\,{\scriptstyle\pm\,0.34} | {\color[rgb]{0.082,0.3945,0.7539}\mathbf{65.69}}\,{\scriptstyle\pm\,0.55} | {\color[rgb]{0.082,0.3945,0.7539}\mathbf{49.77}}\,{\scriptstyle\pm\,0.82} | 5.50 | |||
| VREx | 6.00 | ||||||
| GroupDRO | {\color[rgb]{0.0859,0.5,0.2344}\mathbf{64.38}}\,{\scriptstyle\pm\,0.34} | {\color[rgb]{0.0859,0.5,0.2344}\mathbf{65.57}}\,{\scriptstyle\pm\,0.66} | 5.67 | ||||
| Method | Cora | CiteSeer | PubMed | Cora-CA | DBLP-CA |
| Published: AllSet (ICLR 2022), Table 2 | |||||
| AllSetTransformer | {\color[rgb]{0.0859,0.5,0.2344}\mathbf{73.08}}{\scriptstyle\pm 1.20} | ||||
| AllDeepSets | {\color[rgb]{0.0859,0.5,0.2344}\mathbf{88.75}}{\scriptstyle\pm 0.33} | ||||
| MLP | |||||
| CECGN | |||||
| CEGAT | |||||
| Characteristic | Subgroups |
| Nodes | Tiny ( K), Small ( K to K), Medium ( K to K), Large ( K) |
| Avg. degree | Low ( ), Medium ( to ), High ( ) |
| Adj. homophily | Negative ( ), Low ( to ), High ( ) |
| Features | Low ( ), Medium ( to K), High ( K) |
| Nonzero fraction | Sparse ( ), Medium ( to ), Dense ( ) |
| Classes | Binary ( ), Medium ( to ), Many ( ) |
In-Context Learning
In-context learning studies how models adapt to new tasks from examples or instructions supplied at inference time, without changing their weights.
See all 402 papers