GFMate: Test-Time Prompt Tuning for GFMs
- GFMate is a test-time prompt tuning framework that adjusts frozen Graph Foundation Models using few-shot labeled data and unlabeled target data for cross-domain adaptation.
- It employs centroid prompts and layer prompts to refine class representations and balance multi-layer contributions for improved node and graph classification.
- The method integrates a complementary learning objective on unlabeled data to mitigate distribution shifts, achieving significant gains over baseline approaches.
GFMate is a test-time prompt-tuning framework for Graph Foundation Models (GFMs) that is designed for cross-domain adaptation on a target graph using both few-shot labels and abundant unlabeled target-domain data. In the formulation introduced in "GFMate: Empowering Graph Foundation Models with Test-time Prompt Tuning" (Jiang et al., 14 May 2026), the underlying GFM is pre-trained in a label-free manner and then frozen; adaptation occurs only through prompts introduced after pre-training. The method combines centroid prompts, layer prompts, and a complementary learning objective, with the stated aim of avoiding prompt entanglement with specific source domains or pre-training strategies while exploiting unlabeled target nodes during test-time tuning (Jiang et al., 14 May 2026).
1. Problem setting and motivation
GFMate is defined in a setting where a Graph Foundation Model has been pre-trained in a label-free manner, for example via link prediction or contrastive learning, on a set of source-domain graphs . At downstream time, one observes a single target graph , where is the node set, is the adjacency matrix, and contains node features. A few-shot subset has labels , while the remaining nodes form the unlabeled set (Jiang et al., 14 May 2026).
The paper places GFMate against earlier graph prompt tuning methods that tune prompts learned during source pre-training. In that standard few-shot setting, one tunes a prompt set by solving
0
Two limitations are identified. First, there is pre-training entanglement: prompts specialized to a source domain or to a particular pre-training objective may not generalize to unseen target domains or to GFMs pre-trained by different objectives. Second, there is neglect of unlabeled data: abundant unlabeled nodes in the target graph are not actively used, leaving a substantial train-test distribution shift unaddressed (Jiang et al., 14 May 2026).
GFMate addresses these issues by introducing prompts only after pre-training is fixed. The test-time objective is written as
1
with 2 frozen. In the terminology of the paper, this makes the prompts pre-training-agnostic, because they do not participate in source pre-training and therefore are not tied to a particular source-domain set or self-supervised pre-training loss (Jiang et al., 14 May 2026).
2. Prompt parameterization: centroid prompts and layer prompts
The method assumes that the pre-trained GFM consists of 3 layers of a GNN backbone, such as GCN or GAT. Layer-wise embeddings are denoted
4
where the row 5 is the embedding of node 6 at layer 7 (Jiang et al., 14 May 2026).
For each class 8, GFMate first computes a few-shot centroid at each layer: 9 where 0. A learnable additive prompt 1 is then introduced, yielding the refined centroid
2
The collection of centroid prompts is
3
These centroid prompts alter the class representatives directly in embedding space rather than modifying the pre-training process or encoding source-domain-specific prompt parameters (Jiang et al., 14 May 2026).
In parallel, GFMate introduces a layer prompt in the form of a learnable scalar weight 4 for each layer. The vector
5
controls how strongly each layer contributes to final classification. The paper describes these weights as adapting automatically to the “hop-aggregation” patterns of the target graph (Jiang et al., 14 May 2026).
Prediction is performed by a multi-layer ensemble score. For any node 6 and class 7,
8
where cosine similarity is used: 9 Class probabilities are then obtained through a temperature-scaled softmax,
0
with 1 (Jiang et al., 14 May 2026).
3. Complementary learning at test time
The optimization objective combines ordinary few-shot supervision with an unlabeled-data term derived from complementary labels. On the labeled set 2, GFMate uses the standard cross-entropy
3
This term anchors the prompt tuning to the observed few-shot labels (Jiang et al., 14 May 2026).
For unlabeled nodes, the method first computes a per-layer confidence statistic. For each layer 4, the average entropy over 5 is
6
where 7 is defined using only layer 8 in the score. The pivot layer is then selected as
9
that is, the layer with highest confidence on the unlabeled target nodes (Jiang et al., 14 May 2026).
Using that pivot layer, each unlabeled node 0 is assigned a complementary label
1
namely the class least similar to the node representation at the pivot layer. The corresponding loss is
2
This explicitly pushes the probability of the complementary class toward zero (Jiang et al., 14 May 2026).
The full objective is a convex combination: 3 Only 4 and 5 are learnable; the GFM parameters 6 remain fixed. Updates are performed by gradient descent,
7
with learning rate 8, and optimization stops when the validation loss on a small held-out part of 9 converges or after a fixed number of steps (Jiang et al., 14 May 2026).
4. Algorithmic workflow and computational profile
The test-time procedure begins by computing layer embeddings 0 on the target graph. Centroid prompts 1 and layer prompts 2 are initialized randomly, and the few-shot centroids 3 are computed for all layers and classes. Each optimization step then refines the centroids, computes per-layer probabilities and entropies on unlabeled nodes, selects the pivot layer, determines complementary labels, evaluates 4 and 5, forms the total loss, and updates 6 and 7 by SGD. Final predictions on 8 are given by
9
This is the complete workflow described as the GFMate test-time prompt tuning algorithm (Jiang et al., 14 May 2026).
The paper gives the per-step complexity as
0
which is stated to be linear in graph size. It also emphasizes parameter efficiency: GFMate tunes only 1 parameters, in contrast to 2 parameters in instance-level prompt methods (Jiang et al., 14 May 2026).
A practical consequence is reported in downstream adaptation on Arxiv-year. SAMGPT requires 3 s, 4 M tunable parameters, and 5 GB GPU memory, while GFMate requires 6 s, 7 k parameters, and 8 GB GPU memory, corresponding to 98% faster adaptation and 97% less memory in that experiment (Jiang et al., 14 May 2026).
5. Experimental evaluation
GFMate is evaluated on 12 benchmarks across node and graph classification. The node-classification portion includes Cornell, Texas, Wisconsin, Chameleon, Squirrel, Cora, Citeseer, Arxiv-year, and Amazon-Photo in a one-versus-all cross-domain setting; the graph-classification portion includes BZR, COX2, and PROTEINS. The task range is from one-shot to full-shot classification with 5 random runs (Jiang et al., 14 May 2026).
The baseline suite spans several categories. Supervised GNNs include GCN, GAT, GraphSAGE, H2GCN, and GPR. Self-supervised pre-train plus fine-tune baselines include LP+FT, DGI+FT, and GCL+FT. Single-domain prompt-tuning baselines include GPPT, ProNoG, GraphPrompt, GPF, DAGPrompt, and All-In-One. Cross-domain GFM baselines include GCOPE, MDGPT, SAMGPT, MDGFM, BRIDGE, and RiemannGFM, while GraphAny and GTrans are considered in the full-shot setting (Jiang et al., 14 May 2026).
For one-shot node classification, the paper reports the following accuracies in a representative table: GFMate attains 9 on Cora, 0 on Cite, 1 on Chameleon, and 2 on Squirrel. The stated average improvement over the best baseline is up to +30.63% (relative) on Chameleon (Jiang et al., 14 May 2026). Across varying few-shot sizes 3, GFMate is reported to consistently outperform GFMs. When plugged into different pre-training strategies—LP, DGI, and GCL—and different backbones—GCN, SAGE, GAT, and H2GCN—the method is reported to yield always +10–30% gain (Jiang et al., 14 May 2026).
Ablation studies attribute the performance to all three main components. On one- versus three-shot node classification averaged over five graphs, removing centroid prompts causes a 4 drop, removing layer prompts causes a 5 drop, and removing complementary learning so that only few-shot supervision remains causes a 6 drop (Jiang et al., 14 May 2026). In the binary classification setting, the paper reports even larger relative gains, described as being in line with the 7 risk bound in Proposition 1 (Jiang et al., 14 May 2026).
6. Scope, interpretation, and limitations
The central claim about generalization is that GFMate’s prompts are agnostic to both the source pre-training domain set and the GFM’s self-supervised loss. The method is said to plug seamlessly into any GNN-based GFM backbone and pre-training objective, and the active use of unlabeled testing data through complementary labels is presented as a mechanism for mitigating train-test distribution shifts (Jiang et al., 14 May 2026).
The term pre-training-agnostic has a precise meaning in this framework. It does not denote adaptation without optimization; rather, it denotes that prompt parameters are introduced only after the source pre-training stage and are therefore not entangled with a particular source-domain prompt design. The learnable objects are the centroid prompts 8 and layer prompts 9, while the foundation model parameters 0 remain fixed (Jiang et al., 14 May 2026).
The paper also identifies clear limitations. GFMate is designed for GNN-based GFMs on text-free graphs and does not immediately extend to LLM-based GFMs on text-attributed graphs. Its test-time tuning protocol requires access to the full target graph, so the setting is transductive; inductive test-time tuning is explicitly left as an open direction. In addition, the complementary labeling mechanism is characterized as heuristic, and the authors suggest that more robust uncertainty-based or self-training mechanisms could be investigated in future work (Jiang et al., 14 May 2026).
Within the graph prompt-tuning literature, GFMate is therefore best understood as a target-domain adaptation mechanism that relocates prompt optimization from pre-training or source-domain transfer into inference-time adjustment on the target graph itself. This suggests a distinct design principle for GFMs: rather than encoding source-domain knowledge into prompt parameters in advance, one can leave the foundation model frozen and use structurally lightweight prompts plus unlabeled target-domain signals to specialize predictions at test time (Jiang et al., 14 May 2026).