One For All: Towards Training One Graph Model For All Classification Tasks

Hao Liu, Jiarui Feng, Lecheng Kong, Ningyue Liang, Dacheng Tao, Yixin Chen, Muhan Zhang

Introduction

One for All (OFA) is the first general-purpose graph foundation model designed to handle diverse classification tasks across completely different domains—from molecular structures to social networks—using a single set of weights. By leveraging Large Language Models (LLMs) to unify features and introducing a novel "graph prompting" paradigm, OFA enables impressive zero-shot and few-shot learning capabilities on graphs.

The Challenge: Fragmentation in Graph Learning

In the world of Natural Language Processing, foundation models like GPT-4 have revolutionized the field because text acts as a "universal interface." You can train one model on everything from poetry to Python code.

Graphs, however, have remained stubbornly fragmented. If you want to predict if a molecule is toxic, you build one model. If you want to categorize research papers in a citation network, you build another. This fragmentation is due to three main "walls":

  1. Feature Discrepancy: A node in a molecular graph represents an atom (features: atomic number, chirality), while a node in a citation network represents a paper (features: title, abstract). They live in different mathematical universes.
  2. Task Diversity: Node classification, link prediction, and graph-level classification usually require different architectures and pooling strategies.
  3. Lack of Prompting: There hasn't been a standard way to "prompt" a graph model to perform a new task without extensive fine-tuning.

The OFA Framework

The authors propose OFA, a framework that breaks down these walls using three key innovations to create a single, unified pipeline.

The One for All (OFA) framework pipeline.
  • Text-Attributed Graphs (TAGs): To solve the feature problem, OFA describes every node and edge using natural language. An atom isn't just "Index 6"; it's described as "Feature node. Atom: Carbon, Atomic number 6..." These descriptions are passed through an LLM (like Llama2 or e5) to create initial feature vectors in a shared, cross-domain embedding space.
  • Nodes-of-Interest (NOI) Subgraphs: To unify task types, OFA identifies the specific nodes involved in a task (e.g., the two nodes in a link prediction) and extracts their local neighborhood. This turns every task into a standardized subgraph-level problem.
  • Graph Prompting Paradigm (GPP): This is the "secret sauce" for in-context learning. OFA appends a "prompt graph" to the input. This includes an NOI Prompt Node (carrying the task description) and Class Nodes (carrying descriptions of the possible labels).
Unifying node, link, and graph-level tasks using the Graph Prompting Paradigm.

By structuring the input this way, the model simply performs binary classification on the appended class nodes to make a prediction, regardless of whether the original task was at the node, link, or graph level.

Datasets and Evaluation

The researchers curated a massive "Graph Universe" consisting of 9 diverse datasets covering three major domains:

  • Citation Networks: Cora, PubMed, ogbn-arxiv.
  • Knowledge Graphs / Web Links: Wiki-CS, FB15K237, WN18RR.
  • Molecular Graphs: PCBA, HIV, ChEMBL.

These datasets span node, link, and graph-level classification, providing a rigorous test for a "one-size-fits-all" model.

Key Insights and Results

  • Language as the Universal Glue: The most powerful insight is that while raw graph data is heterogeneous, human descriptions of that data are not. By using LLMs as feature encoders, we can finally train a single Graph Neural Network (GNN) on citation data and molecular data simultaneously.
  • Cross-Domain Synergy: The paper finds that joint training often improves performance. Knowledge learned from a citation network can actually help the model understand a knowledge graph, suggesting that there are fundamental structural patterns that transcend specific domains.
  • Supervised Learning: A single OFA model (using Llama2-13b features) matched or outperformed specialized, state-of-the-art GNNs (like GCN, GAT, and GIN) across almost all 9 datasets.
  • Zero-Shot Reasoning: Because the class labels are represented by text-encoded nodes, the model can reason about classes it has never seen before. On the ogbn-arxiv dataset, it achieved 46.19% accuracy in a 5-way classification task without ever seeing those specific classes during training.
  • Few-Shot Efficiency: In transfer learning (training on one domain and testing on another), OFA significantly outperformed existing meta-learning baselines like GPN and Prodigy.

Limitations and Future Work

While a major leap forward, the authors note a few hurdles:

  • Classification Only: OFA is currently designed for classification. It cannot yet handle regression tasks (predicting continuous values like a molecule's boiling point) because regression targets are unbounded.
  • Computational Cost: Using large LLMs like Llama2-13b to encode every node and edge is computationally expensive, though this is primarily a one-time preprocessing cost.
  • Unsupervised Potential: Currently, OFA relies on supervised or few-shot data. Future iterations could explore "self-supervised" pre-training (like predicting masked nodes) to create an even more robust foundation.

OFA represents a significant step toward a "GPT moment" for graph machine learning, proving that with the right prompting and a common language, one model really can rule them all.

Summary updated

BibTeX
@inproceedings{liu2024one,
  author = {Hao Liu and Jiarui Feng and Lecheng Kong and Ningyue Liang and Dacheng Tao and Yixin Chen and Muhan Zhang},
  title = {{One For All: Towards Training One Graph Model For All Classification Tasks}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=4IT2pgc9v6},
}
Figure