Introduction
Large Language Models (LLMs) have revolutionized natural language processing, but their application to Text-Attributed Graphs (TAGs)—where nodes possess both textual descriptions and structural links—remains a challenge. Current approaches typically rely on verbose natural language descriptions of graph topology, which quickly exhaust context windows, or decouple text and structure by using LLMs merely as feature extractors for Graph Neural Networks (GNNs).
GDL4LLM (Graph-Defined Language for Large Language Models) introduces a paradigm shift: treating graph structures as a unique language. By tokenizing nodes and pre-training on random-walk sequences, GDL4LLM enables LLMs to master structural dependencies with unprecedented efficiency and accuracy.
Methodology: The Graph-Defined Language
The core innovation of GDL4LLM is the elimination of natural language "translations" for graph topology. Instead, the framework treats the graph as its own corpus.
Graph Tokenization and Corpus Sampling
Every node in the graph is assigned a unique token (e.g., <node_i>), which is added to the LLM's vocabulary. To capture the structural context, the framework employs random walks to generate "sentences" of node tokens. These sequences form a graph language corpus that reflects the connectivity and local geometry of the TAG.
Structural Pre-training and Fine-tuning
The LLM undergoes a structural pre-training phase using a next-token prediction task on the graph corpus. This process forces the model to encode connectivity patterns and node degrees into its hidden representations. For downstream tasks like node classification, the model utilizes a Dual-LoRA architecture. One LoRA module preserves the structural knowledge from pre-training, while a second module adapts the model to specific task requirements using node attributes.
Experimental Evaluation
The framework was tested on three diverse real-world datasets: ACM (citation network), Wiki (hyperlink network), and Amazon (co-purchase network). These datasets vary significantly in density, with Wiki containing over 1.1 million edges across approximately 36,500 nodes.
Performance and Efficiency
GDL4LLM consistently outperformed specialized frameworks like GLEM, LLAGA, and InstructGLM. On the ACM dataset, the GDL4LLM w/ attr variant achieved a test accuracy of 82.8%, significantly higher than description-based models which often plateau around 80%.
Beyond accuracy, the framework offers substantial efficiency gains:
- Token Usage: Reduced by 44% to 63% compared to description-based methods, as single tokens replace lengthy text descriptions.
- Inference Speed: On ACM, GDL4LLM completed inference in approximately 2 minutes, more than twice as fast as InstructGLM.
- High-Order Reasoning: Unlike traditional GNNs that often suffer from oversmoothing beyond 2-3 hops, GDL4LLM effectively models dependencies up to 5 hops.
Key Insights
The success of GDL4LLM supports the "New Language" Hypothesis: LLMs are inherently adept at learning new linguistic patterns. By representing topology as syntax, the model bypasses the noise of natural language descriptions. Furthermore, the pre-training phase acts as a form of "neural message passing," where token embeddings converge based on their structural proximity and connectivity.
Conclusion and Future Work
GDL4LLM demonstrates that treating graphs as a native language allows LLMs to capture deep structural insights without the overhead of verbose descriptions. While the approach is highly effective, future research is needed to address the scaling of vocabularies for massive graphs (millions of nodes) and to explore model pruning techniques to reduce the memory footprint of the LLM backbone while maintaining performance.
Summary updated