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

Self-supervised Quantized Representation for Seamlessly Integrating Knowledge Graphs with Large Language Models

Qika Lin, Tianzhe Zhao, Kai He, Zhen Peng, Fangzhi Xu, Ling Huang, Jingying Ma, Mengling Feng

Introduction

Knowledge Graphs (KGs) and Large Language Models (LLMs) represent two different paradigms of information storage. KGs provide structured, factual data in the form of triples (subject-relation-object), while LLMs excel at processing and generating natural language sequences. Bridging the "representation gap" between these two formats is a critical challenge in artificial intelligence. Current methods, such as converting graph data into long textual prompts or using continuous embedding adapters, often suffer from high computational costs or poor alignment between latent spaces.

This paper introduces SSQR (Self-supervised Quantized Representation), a framework designed to compress complex KG structures and semantics into short sequences of discrete tokens. By expanding an LLM’s vocabulary with these "entity codes," the researchers demonstrate that massive amounts of factual data can be integrated into models like LLaMA using as few as 16 tokens per entity, significantly reducing the "token tax" of traditional prompting while enhancing reasoning performance.

The Representation Gap

Integrating KGs into LLMs currently faces two primary hurdles:

  1. Textual Prompting Inefficiency: Describing an entity’s neighborhood in natural language is context-intensive. A single entity's 2-hop neighborhood can require thousands of tokens, quickly exhausting the context window and slowing inference.
  2. Continuous Embedding Alignment: Using adapters to map KG vectors into the LLM’s latent space is architecturally complex. These continuous representations often fail to capture the holistic structure of the graph and can be difficult for the LLM to interpret natively.

SSQR asks a fundamental question: Can we represent a complex graph entity as a short, discrete "word" that the LLM can understand natively?

The SSQR Framework

The SSQR framework operates in two distinct stages: learning the discrete codes and integrating them into the LLM via instruction tuning.

Stage 1: Self-supervised Quantized Representation

To create information-dense codes, the framework combines structural and semantic modeling:

  • Structural Modeling: A Graph Convolutional Network (GCN) captures the relationships between entities and their neighbors.
  • Semantic Distilling: High-quality text embeddings (e.g., OpenAI’s text-embedding-3-large) ensure the codes capture the linguistic meaning of entity descriptions.
  • Vector Quantization (VQ): Inspired by VQ-VAEs, the model maintains a codebook of learnable vectors. Continuous entity embeddings are mapped to a sequence of $N$ discrete indices from this codebook.
  • Reconstruction: The model is trained to reconstruct the graph structure and align with semantic text, ensuring the resulting discrete codes are highly representative of the original data.

Stage 2: LLM Integration

Once the codes (e.g., [CODE_47] [CODE_12]...) are learned, they are added as new tokens to the LLM's tokenizer. The LLM (such as LLaMA2 or LLaMA3.1) is then fine-tuned on KG-specific instructions, such as link prediction or triple classification, where these codes serve as the primary features for entities.

Experimental Evaluation

The researchers evaluated SSQR using three standard benchmarks: WN18RR (lexical relations), FB15k-237 (world facts), and FB15k-237N (triple classification).

Key Results

  • Link Prediction: SSQR-LLaMA3.1 outperformed state-of-the-art embedding models and other LLM-based methods. On the FB15k-237 dataset, it achieved a 16.45% improvement in Mean Reciprocal Rank (MRR) over unsupervised quantization baselines.
  • Triple Classification: On the FB15k-237N dataset, SSQR-LLaMA2 reached an accuracy of 79.4%, surpassing specialized models like KoPA (77.7%) and zero-shot GPT-3.5 (60.2%).
  • Efficiency: While a standard prompt might require 3,000 tokens to describe an entity's neighborhood, SSQR achieves superior results using a fixed sequence of just 16 tokens.

Discussion and Insights

Fighting Anisotropy

Raw text embeddings often suffer from anisotropy, where vectors cluster in a narrow "cone," making them difficult for models to distinguish. The quantization process in SSQR effectively "spreads out" these representations, making the resulting entity codes more distinguishable and useful for the LLM's attention mechanisms.

Structure vs. Semantics

Ablation studies revealed that the importance of structure versus semantics varies by dataset. For WordNet (WN18RR), semantic text information is more critical, whereas for Freebase (FB15k-237), the GCN-captured graph structure is the dominant factor. SSQR’s ability to balance both allows it to remain robust across different types of knowledge.

Conclusion and Future Work

SSQR demonstrates that discrete quantization is a viable and efficient path for KG-LLM integration. By treating graph entities as native vocabulary tokens, the framework eliminates the need for complex adapters or long-form textual descriptions.

Future research will focus on improving generalization. Currently, the LLM must be fine-tuned for specific Knowledge Graphs. The authors suggest that developing "Unified LLMs for KGs"—models capable of handling multiple graphs within a single discrete token space—is the next logical step in creating truly knowledgeable large language models.

Summary updated

BibTeX
@inproceedings{lin2025self,
  author = {Qika Lin and Tianzhe Zhao and Kai He and Zhen Peng and Fangzhi Xu and Ling Huang and Jingying Ma and Mengling Feng},
  title = {{Self-supervised Quantized Representation for Seamlessly Integrating Knowledge Graphs with Large Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure