Modality-free Graph In-context Alignment
Organizations: Nanyang Technological University
Abstract
In-context learning (ICL) converts static encoders into task-conditioned reasoners, enabling adaptation to new data from just a few examples without updating pretrained parameters. This capability is essential for graph foundation models (GFMs) to approach LLM-level generality. Yet current GFMs struggle with cross-domain alignment, typically relying on modality-specific encoders that fail when graphs are pre-vectorized or raw data is inaccessible. In this paper, we introduce Modality-Free Graph In-context Alignment (MF-GIA), a framework that makes a pretrained graph encoder promptable for few-shot prediction across heterogeneous domains without modality assumptions. MF-GIA captures domain characteristics through gradient fingerprints, which parameterize lightweight transformations that align pre-encoded features and indexed labels into unified semantic spaces. During pretraining, a dual prompt-aware attention mechanism with episodic objective learns to match queries against aligned support examples to establish prompt-based reasoning capabilities. At inference, MF-GIA performs parameter-update-free adaptation using only a few-shot support set to trigger cross-domain alignment and enable immediate prediction on unseen domains. Experiments demonstrate that MF-GIA achieves superior few-shot performance across diverse graph domains and strong generalization to unseen domains.
Figures & tables
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Configuration | Pretraining Datasets | Domain Coverage | In-Domain | Out-of-Domain | Avg OOD | Overall | ||
| Cora | Products | Physics | BlogCatalog | |||||
| Single | PubMed | Citation | 42.76 | 12.43 | 68.15 | 41.28 | 40.62 | 40.91 |
| Arxiv | Citation | 48.31 | 13.86 | 76.42 | 43.67 | 44.65 | 45.57 | |
| WikiCS | Web | 39.23 | 14.72 | 65.83 | 45.91 | 42.15 | 41.67 | |
| Amazon | E-commerce | 35.47 | 17.28 | 61.26 | 38.74 | 39.09 | 38.19 | |
| Two | PubMed + Arxiv | Citation | 52.14 | 14.92 | 79.87 | 47.35 | 47.38 | 48.57 |
| Method | Computers | Physics | BlogCatalog | |||
| 1-shot | 5-shot | 1-shot | 5-shot | 1-shot | 5-shot | |
| MF-GIA | 41.49 | 53.71 | 79.12 | 88.92 | 49.46 | 67.31 |
| MF-GIA (w. DIA) | 41.96 | 54.60 | 80.15 | 89.74 | 48.37 | 66.53 |
| ogbn-Products | Computers | FB15K237 | |
| 0.05 | 21.45 | 52.10 | 91.82 |
| 0.2 (Default) | 22.61 | 53.71 | 91.38 |
| 0.5 | 22.60 | 53.93 | 90.45 |
| 1 | 22.15 | 53.29 | 90.27 |
| Computers | Physics | BlogCatalog | |
| 1-layer, 1-head (Shared) | 53.71 | 88.92 | 67.31 |
| 1-layer, 1-head (Separated) | 51.25 | 88.10 | 67.05 |
| 1-layer, 4-head | 52.47 | 86.58 | 66.15 |
| 2-layer, 1-head | 54.05 | 88.53 | 67.46 |
| 2-layer, 4-head | 53.39 | 87.52 | 66.83 |