SAMGPT: Text-free Graph Foundation Model for Multi-domain Pre-training and Cross-domain Adaptation

Xingtong Yu, Zechuan Gong, Chang Zhou, Yuan Fang, Hui Zhang

Abstract

Foundation models have transformed natural language processing and computer vision, yet their application to graphs remains challenging due to structural diversity across domains. While existing graph foundation models often rely on text descriptions to align datasets, many real-world graphs are "text-free." This paper introduces SAMGPT, a novel framework designed to learn from multiple diverse graph domains and adapt to unseen ones without natural language descriptions. By utilizing "structure tokens" for multi-domain alignment and a "dual-prompt" strategy for cross-domain adaptation, SAMGPT achieves state-of-the-art performance in few-shot classification tasks.

Introduction

In the current AI landscape, foundation models like GPT-4 leverage massive, diverse datasets to achieve generalizability. However, graphs—representing everything from social networks to molecular bonds—present a unique challenge: structural incompatibility. A social network's connectivity patterns differ vastly from those of a citation graph or a financial transaction network.

Most current graph foundation models use Large Language Models (LLMs) as a "universal language" to bridge these gaps, relying on node text attributes. However, many critical datasets (e.g., protein interactions, web logs) lack text. SAMGPT addresses this by treating graph topology as a first-class citizen, enabling a universal "language" for graphs based purely on their structural properties.

The SAMGPT Framework

SAMGPT (Structure Alignment framework for Multi-domain Graph Pre-Training) operates in two distinct phases: multi-domain pre-training and cross-domain adaptation.

1. Multi-domain Pre-training with Structure Tokens

To harmonize structurally diverse source domains, SAMGPT introduces learnable structure tokens. These tokens are injected into each layer of a shared Graph Neural Network (GNN) encoder during pre-training. They act as domain-specific tuners, allowing the model to accommodate the unique structural "vibe" of each domain while maintaining a single set of core weights. This prevents the "interference" typically seen when training on heterogeneous graph topologies.

2. Cross-domain Adaptation with Dual Prompts

When adapting to a previously unseen target domain, the pre-trained encoder remains frozen. SAMGPT utilizes a dual-prompt strategy to bridge the gap:

  • Holistic Prompts: Learnable vectors that capture general, domain-agnostic structural knowledge.
  • Specific Prompts: A learnable mixture of the pre-trained structure tokens from source domains. This mechanism allows the model to treat a new domain as a combination of known structural patterns (e.g., a new graph might be 70% similar to a social network and 30% to an e-commerce graph).
The SAMGPT architecture: (a) Multi-domain pre-training with structure tokens and (b) Cross-domain adaptation using dual prompts.

Experimental Results

The researchers evaluated SAMGPT across seven diverse benchmark datasets, including citation networks (Cora, Citeseer, Pubmed), e-commerce (Amazon Photo, Computers), and social networks (Facebook, LastFM). The model was primarily tested on few-shot classification, where it must learn a new category from very few examples.

Performance and Robustness

SAMGPT consistently outperformed existing state-of-the-art multi-domain models. For instance, on the Cora dataset, SAMGPT achieved 47.80% accuracy in 1-shot node classification, a significant improvement over the previous state-of-the-art model, GCOPE (~35.6%).

Few-shot performance comparison of SAMGPT against baselines across four target domains (Cora, Photo, Facebook, LastFM).

Beyond accuracy, the model demonstrated remarkable robustness to heterophily—graphs where connected nodes are dissimilar. While many GNNs struggle in such environments, SAMGPT maintained high performance on heterophilic datasets like Squirrel and Chameleon, proving its structural alignment strategy is more resilient than traditional feature-based methods.

Discussion and Conclusion

SAMGPT represents a significant step toward universal graph foundation models. Its key innovation lies in knowledge recombination: the insight that new domains are often unique mixtures of existing structural patterns. By using structure tokens and dual prompts, the model avoids the "objective gap" between pre-training and downstream tasks.

Future work may expand SAMGPT's capabilities to include link prediction and graph generation, as well as developing more efficient selection mechanisms for "Specific Prompts" as the number of source domains scales into the thousands. Nevertheless, SAMGPT proves that structural alignment is a viable and powerful alternative to text-based alignment for universal graph learning.

Summary updated

BibTeX
@inproceedings{yu2025samgpt,
  author = {Xingtong Yu and Zechuan Gong and Chang Zhou and Yuan Fang and Hui Zhang},
  title = {{SAMGPT: Text-free Graph Foundation Model for Multi-domain Pre-training and Cross-domain Adaptation}},
  booktitle = {The Web Conference},
  year = {2025},
}
Figure