NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Graph Language Models

Moritz Plenz, Anette Frank

Abstract

Graph Language Models (GLMs) represent a novel architectural approach designed to unify the semantic richness of pretrained Language Models (LMs) with the structural precision of Knowledge Graphs (KGs). By repurposing Transformer weights and introducing graph-native positional encodings, GLMs navigate complex relational data without the need for exhaustive pretraining from scratch. This paper explores the GLM framework, demonstrating its superiority in reasoning over interleaved textual and structural data compared to traditional linearization or hybrid Graph Neural Network (GNN) approaches.

Introduction

In the current AI landscape, researchers often grapple with a fundamental tension between two powerful modalities: Language Models, which are masters of textual semantics, and Knowledge Graphs, which explicitly map relationships between entities (e.g., Thailand → Capital → Bangkok).

Existing methods to integrate these modalities typically fall into two categories: Linearization, which flattens graphs into text strings at the cost of structural topology, and GNN Hybrids, which preserve structure but often lack the nuanced semantic depth required to process complex node and edge descriptions. GLMs address this gap by creating a unified architecture that treats graphs as a native input type, enabling the "early fusion" of textual and structural information.

Methodology

The core innovation of the GLM is a non-invasive modification of the standard Transformer architecture (specifically the T5 model). The framework introduces three primary components:

1. Extended Levi Graphs

To align graph structures with the sequential nature of language models, the authors utilize Extended Levi Graphs. This process converts edges into nodes, transforming a standard triplet like (Subject, Relation, Object) into a sequence of tokens that the model can process while maintaining the relational identity of the connection.

2. Graph-Native Positional Encoding (PE)

Standard LMs utilize positional encodings to understand the linear order of words. GLMs replace this with relative graph distances. Instead of identifying a token as "the third word in a sentence," the model learns "how many hops away" tokens are within the graph topology. This allows the model to navigate the input as a map rather than a list.

3. Dual Attention Mechanisms

The framework supports two distinct attention strategies:

  • Local GLM (ℓGLM): This mode restricts attention to tokens within the same triplet, effectively mimicking the "message passing" behavior found in traditional GNNs.
  • Global GLM (gGLM): This mode allows every token to attend to every other token, utilizing a "proximity bias" inherited from the pretrained LM to prioritize closer neighbors in the graph.

Experimental Setup and Datasets

The researchers evaluated GLMs against two primary benchmarks to test different facets of structural reasoning:

  • ConceptNet (CN): A common-sense knowledge graph used to test how well models handle long-range structural dependencies across subgraphs of varying complexity.
  • Wikidata & Wikipedia: A large-scale dataset where Wikipedia abstracts are aligned with Wikidata triplets. This was used for Knowledge Graph Population tasks, requiring the model to predict missing relations based on both existing graph data and supporting natural language text.

Key Insights

Weight Compatibility and Transferability

One of the most significant findings is that graph expertise does not require training from scratch. By initializing a Graph Transformer with weights from a standard pretrained LM, the model retains its conceptual understanding of language while the new positional encodings allow it to apply that knowledge to non-linear structures.

The Power of Structural Priors

Linear probing tests—where the model's weights are frozen and only a small classification layer is trained—revealed that GLMs produce inherently more structurally-aware embeddings. While standard LMs struggle to distinguish relevant from irrelevant information when a graph is flattened, the GLM’s inductive bias allows it to filter out noise from distant, unrelated nodes.

Results

  • Reasoning Performance: On ConceptNet relation classification, the gGLM consistently outperformed both linearized T5 baselines and specialized GNNs like GCN and GAT.
  • Zero-Shot Capabilities: In linear probing settings, the gGLM achieved approximately 59.5% accuracy on complex graphs, significantly higher than the 53% achieved by the standard T5 baseline.
  • Joint Modality Success: In KG population tasks involving both text and graphs, GLMs outperformed strong LM baselines by up to 6 points in Macro F1, proving their ability to simultaneously process and integrate both modalities.

Limitations and Future Directions

While GLMs show great promise, the current research is limited to English-language knowledge graphs. Furthermore, the framework is currently optimized for bidirectional encoders like T5 or BERT. Adapting this to unidirectional, "decoder-only" models (such as the GPT or Llama families) remains a challenge, as the unidirectional flow of information is inherently at odds with the non-linear nature of graphs. Future work will also explore how these graph-native biases scale within massive LLMs exceeding 70 billion parameters.

Summary updated

BibTeX
@inproceedings{plenz2024graph,
  author = {Moritz Plenz and Anette Frank},
  title = {{Graph Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.acl-long.245},
}
Figure