Table of Contents
Fetching ...

Modality-free Graph In-context Alignment

Wei Zhuo, Siqiang Luo

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.

Modality-free Graph In-context Alignment

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.
Paper Structure (48 sections, 2 theorems, 63 equations, 5 figures, 13 tables, 2 algorithms)

This paper contains 48 sections, 2 theorems, 63 equations, 5 figures, 13 tables, 2 algorithms.

Key Result

Theorem 3.1

Let $G_i$ and $G_j$ be graphs sampled from domains $\mathcal{D}_i$ and $\mathcal{D}_j$ respectively, with corresponding gradient fingerprints $\Delta \theta_i, \Delta \theta_j \in \mathbb{R}^{d_o \times d}$ computed using task loss $\mathcal{L}_i$ and $\mathcal{L}_j$ (e.g., cross-entropy). The domai where $\mathcal{W}_2(\cdot, \cdot)$ measures inherent distance between two domains, and $\widetilde

Figures (5)

  • Figure 1: Overview of MF-GIA. (Left) Modality-free Alignment: The pretraining graphs are mapped to a unified space via domain-conditioned transformations. Domain descriptors $e$ ensure similar domains occupy neighboring subspaces. (Middle) Episodic Pretraining: The model learns from $m$-way $k$-shot episodes using domain-aligned features and labels. The DPAA mechanism matches queries to classes using only prompts as context. (Right) In-context Prediction: For an unseen graph, the frozen model performs few-shot classification using the support set as a prompt.
  • Figure 2: Domain embedder.
  • Figure 3: Domain-conditioned label alignment.
  • Figure 4: Effect of core components.
  • Figure 5: Pretraining curves of MF-GIA.

Theorems & Definitions (9)

  • Definition 1
  • Theorem 3.1
  • Definition 2: Graph Domain
  • Definition 3: Graph Distance
  • Definition 4: Domain Distance
  • Lemma B.1
  • proof
  • proof
  • proof