Abstract
Knowledge Graph (KG) tasks have traditionally relied on geometric embeddings that assign unique, high-dimensional vectors to every entity. While effective for small graphs, this approach struggles with scalability and versatility as graph sizes reach millions of nodes. This paper introduces KGT5, a unified approach that treats KG completion and Question Answering (KGQA) as a sequence-to-sequence (seq2seq) text-to-text task. By leveraging a standard Transformer architecture and representing entities as text strings, KGT5 achieves competitive results on massive real-world graphs while reducing model parameters by up to 98%.
Introduction
Knowledge Graphs like Wikidata are foundational for many AI applications, yet their scale—often containing millions of entities and billions of facts—poses a significant challenge. Traditional Knowledge Graph Embedding (KGE) models assign an "atomic" vector to each entity. This leads to two primary issues:
- Scalability: Storing billions of parameters for embeddings requires immense VRAM, often exceeding the capacity of standard research hardware.
- Versatility: Integrating these rigid embeddings into downstream tasks like KGQA typically necessitates complex, multi-stage pipelines that are difficult to optimize.
KGT5 addresses these hurdles by replacing millions of atomic embeddings with a single, compact generative language model.
Methodology: The KGT5 Framework
KGT5 utilizes a standard T5-small encoder-decoder Transformer architecture with approximately 60 million parameters. The core innovation lies in how it processes graph data.
Verbalization and Prompting
Instead of using opaque entity IDs (e.g., Q76), KGT5 "verbalizes" entities into text strings (e.g., "Barack Obama"). To maintain uniqueness, descriptions or IDs can be appended. A KG triple $(s, p, o)$ is then converted into a natural language prompt. For example, to predict a missing tail, the input might be predict tail: Barack Obama | born in, with the target output being Honolulu.
Training and Inference
Training follows the standard teacher-forcing paradigm with cross-entropy loss. A key advantage is the absence of explicit negative sampling. Because the model predicts tokens from a fixed vocabulary, the softmax layer implicitly treats all other token combinations as negatives, streamlining the training process.
During inference, KGT5 predicts missing entities by sampling sequences from the decoder. These strings are then mapped back to entity IDs. This generative approach differs significantly from traditional methods that must score every entity in the graph.
Experimental Setup and Datasets
The authors evaluated KGT5 across several large-scale benchmarks:
- Link Prediction: WikiKG90Mv2 (91M entities), Wikidata5M (4.8M entities), and standard sets like WN18RR.
- KGQA: MetaQA, WebQuestionsSP (WQSP), and ComplexWebQuestions (CWQ).
Key Insights
The Compositional Advantage
By operating on entity names rather than IDs, KGT5 leverages semantic information. While a traditional KGE sees Q76 and Q123 as arbitrary symbols, KGT5 understands the linguistic relationship between "Barack Obama" and "United States," allowing for better generalization.
The Memorization Gap
An interesting trade-off was observed: while KGT5 excels at generalizing to unseen facts, it is less efficient at memorizing the training set compared to traditional models. With only 60M parameters, it lacks the "storage" capacity of a massive embedding table. However, the authors suggest that scaling to larger T5 variants could bridge this gap.
Pre-training Synergy
The study found that pre-training on KG link prediction is significantly more effective for KGQA tasks than standard language model pre-training on general web text. This suggests that the structured knowledge captured during link prediction is highly transferable.
Results and Performance
KGT5 demonstrates remarkable efficiency. On the WikiKG90Mv2 dataset, it achieved results competitive with state-of-the-art models while being 98% smaller (60M parameters vs. 18.2B). In KGQA, KGT5 outperformed complex baselines on CWQ and WQSP without requiring task-specific hyperparameter tuning, highlighting its versatility as a unified model.
Conclusion and Future Work
KGT5 represents a shift toward more scalable and integrated KG modeling. While it faces challenges with entity disambiguation and many-to-many relations, its ability to compress massive graphs into a small, generative model opens new avenues for KG research. Future work will likely explore larger model scales and improved disambiguation techniques to further enhance performance.
Summary updated