KLMo: Knowledge Graph Enhanced Pretrained Language Model with Fine-Grained Relationships

Lei He, Suncong Zheng, Tao Yang, Feng ZhangEMNLP 2021

Introduction

While Pretrained Language Models (PLMs) like BERT excel at capturing linguistic nuances, they often lack the "world knowledge" necessary for complex reasoning. Previous attempts to bridge this gap have focused on injecting entity information—essentially mapping text spans to Knowledge Graph (KG) entries. However, these approaches often overlook the edges in the graph: the fine-grained relationships that define how entities interact. KLMo (Knowledge Graph Enhanced Pretrained Language Model) addresses this by integrating relational data through a novel architecture.

The Text-Knowledge Alignment Problem

The primary hurdle in integrating structured knowledge is the Text-Knowledge Alignment (TKA) problem. Simple entity recognition is often insufficient for tasks like fine-grained entity typing. For example, knowing that "Lang Lang" is a pianist provides some context, but understanding his specific relationship to a program—as a "Guest" versus a "Performer"—is what allows a model to correctly distinguish between a "TV Show" and a "Concert."

Figure 1: The importance of fine-grained relationships. Specific relations like 'Guest' or 'Performer' provide the semantic constraints needed for accurate entity typing.

The KLMo Architecture

KLMo introduces several innovations to fuse textual and structural information effectively:

Figure 2: The KLMo architecture, highlighting the Knowledge Aggregator and the multi-task pre-training framework (MLM, Relation Prediction, and Entity Linking).
  • Knowledge Aggregator: A dedicated $M$-layer encoder designed to fuse the token embedding space with the KG embedding space.
  • Structural Graph Attention: To maintain the KG's topology, KLMo uses a "visible matrix" in its attention mechanism. This ensures that entities and relations only attend to their immediate neighbors in the graph, preventing the loss of structural context.
  • Entity-level Cross-KG Attention: Instead of word-level alignment, the model pools tokens into "entity spans." These spans interact with the KG via cross-attention, allowing the text to "absorb" relevant relational data.

The model is pre-trained on a massive crawl of Baidu Baike using three simultaneous objectives: Masked Language Modeling (MLM), Relation Prediction (RP), and Entity Linking (EL).

Key Results and Insights

KLMo was evaluated on Chinese entity typing and relation classification, demonstrating significant improvements over baselines like BERT and ERNIE.

  • Entity Typing: KLMo achieved an F1 score of 83.50, outperforming the standard BERT baseline (80.92). It particularly excelled in recall, suggesting a broader capability in identifying fine-grained categories.
  • Relation Classification: On the CCKS 2019 Task 3 (IPRE) dataset, KLMo reached an F1 of 25.05. Notably, it improved precision by over 2 points, indicating that fine-grained relations help the model navigate noisy, distantly-supervised data.

A key insight from the study is that relations act as semantic constraints. Furthermore, ablation studies revealed that KLMo retains its performance advantages even when the KG is removed during fine-tuning, suggesting that the model successfully "bakes" relational logic into its weights during pre-training.

Conclusion

KLMo moves beyond simple entity injection to teach language models the "connective tissue" of knowledge. By preserving the structural integrity of Knowledge Graphs through specialized attention mechanisms, it achieves state-of-the-art results in understanding complex entity relationships in Chinese text.

Summary updated

BibTeX
@inproceedings{he2021klmo,
  author = {Lei He and Suncong Zheng and Tao Yang and Feng Zhang},
  title = {{KLMo: Knowledge Graph Enhanced Pretrained Language Model with Fine-Grained Relationships}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  doi = {10.18653/v1/2021.findings-emnlp.384},
}
Figure