TL;DR
GOFA (Generative One-For-All) is a new graph foundation model that natively integrates structural awareness into Large Language Models (LLMs) by interleaving Graph Neural Network (GNN) layers directly between frozen LLM layers. This architecture allows the model to handle arbitrary graph tasks through text generation while maintaining a deep understanding of graph topology, leading to state-of-the-art zero-shot performance across diverse domains.
What Problem Does This Paper Address?
While foundation models have revolutionized text (LLMs) and vision (LVMs), the graph domain has lagged behind. Graphs are tricky because they lack a definitive, linear structure. Current attempts to build Graph Foundation Models (GFMs) usually fall into two camps:
- LLM as a Predictor: You flatten the graph into a text description and feed it to an LLM. This is flexible (you can ask anything), but LLMs are notoriously bad at "seeing" complex connections in long text strings.
- LLM as an Enhancer: You use an LLM to generate features for nodes, then train a GNN on top. This captures structure well but locks the model into specific tasks (like classification), losing the "fluidity" and generative power of an LLM.
The authors of GOFA set out to create a model that does both: a generative model that is natively "graph-aware" and capable of handling a wide variety of tasks—from sentence completion to structural understanding—within a single framework.
Methods
The core innovation of GOFA is its interleaved architecture. Instead of treating the GNN and LLM as separate stages, GOFA weaves them together organically.
- Graph Language Encoder: The model takes node and edge text and passes it through a pre-trained "compressor." This turns a sentence into a fixed set of $K$ memory tokens.
- Interleaved GNN Layers: Randomly initialized GNN layers are placed between the frozen layers of the LLM. As information flows through the model, the GNN layers perform message passing on these memory tokens, allowing structural information to "infect" the semantic representations.
- Generative Graph Modeling: The authors define a new objective called "graph completion." By introducing Nodes of Generation (NOG)—specific nodes where the model starts generating text—they can frame any graph task (classification, shortest path, QA) as a standard next-token prediction problem.
- Gated Integration: To ensure the model doesn't "forget" how to be a good language model, they use a tanh gating mechanism. This allows the model to ignore graph information when it's not helpful, essentially starting as a pure LLM and gradually learning to incorporate structure during training.
Datasets
The model underwent massive pre-training on a diverse corpus to build its foundational knowledge:
- Pre-training: MAG240M (academic), Arxiv, Pubmed, Wikikg90mv2 (knowledge graph), and Ultrachat200k. They also introduced WikiGraph, a new dataset generated by using an LLM to extract entities and relationships from Wikipedia text.
- Evaluation: The model was tested in zero-shot scenarios on unseen datasets like Cora, WikiCS, Amazon Products, ExplaGraphs (commonsense), and SceneGraphs.
Key Insights and Ideas
- Pooling is a Bottleneck: Most previous work pools an entire node's description into a single vector. GOFA shows that using multiple "memory tokens" per node preserves much more semantic nuance, which is critical for complex reasoning.
- Structural Pre-training is Essential: By explicitly training the model to solve "low-level" graph problems (like finding the shortest path or counting common neighbors), the model develops a "graph-native" intuition that transfers to high-level tasks like document classification.
- Efficiency through Sparsity: Prompting an LLM with a full graph description often leads to massive, memory-intensive text sequences. GOFA’s architecture leverages graph sparsity, making it significantly faster and more memory-efficient than "text-only" LLM baselines.
Key Results
- Zero-Shot Dominance: GOFA-T (the version tuned on academic graphs) achieved 71.17% accuracy on WikiCS in a zero-shot 10-way classification task, significantly outperforming Mistral-7B (63.63%) and specialized GFMs like OFA (21.20%).
- Better Graph "Vision": In structural tasks, GOFA reduced the error (RMSE) for counting common neighbors by over 68% compared to a base Mistral-7B model.
- Inference Speedup: On the Cora-Link dataset, GOFA was 56.5% faster per sample than an LLM prompted with the same information, while also being much more accurate.
Limitations and Future Work
The authors identify a few areas for improvement:
- Global vs. Local: GOFA currently operates on $k$-hop subgraphs. While it's great at local reasoning, it struggles with global graph properties, such as counting the total number of nodes in a massive network.
- Frozen Components: The LLM compressor is currently frozen. Unfreezing or co-training this component might allow for even tighter integration between text and structure.
- Common Sense Gaps: On the SceneGraph dataset, GOFA only performed on par with base LLMs, suggesting that the current instruction-tuning data might need more "common sense" variety to help the model reason about everyday objects and relationships.
Summary updated