KELM: Knowledge Enhanced Pre-Trained Language Representations with Message Passing on Hierarchical Relational Graphs

Yinquan Lu, Haonan Lu, Guirong Fu, Qun Liu

Introduction

Pre-trained language models (PLMs) like BERT and RoBERTa have revolutionized natural language processing by learning deep linguistic representations from massive text corpora. However, these models often struggle to efficiently capture and recall explicit factual knowledge. While Knowledge Graphs (KGs) provide structured facts (e.g., (ban, hypernyms, prohibition)), integrating this information into PLMs typically requires massive computational resources for re-pretraining. KELM (Knowledge Enhanced Language Model) introduces a novel framework to inject KG knowledge during the fine-tuning phase, significantly reducing costs while improving performance on complex reasoning tasks.

The Challenge of Knowledge Injection

Existing methods for knowledge enhancement face two primary hurdles. First, the computational cost of re-pretraining models on combined text and KG datasets is often prohibitive. Second, knowledge ambiguity creates "noise"; a word like "ban" may refer to a prohibition or a Romanian currency unit. Without context-aware mechanisms, models may inject irrelevant facts, degrading performance.

The KELM Framework

KELM addresses these challenges through a model-agnostic architecture that operates entirely during fine-tuning. The framework relies on two core innovations: the Unified Knowledge-enhanced Text Graph (UKET) and a Hierarchical Message Passing (HMP) mechanism.

Unified Knowledge-enhanced Text Graph (UKET)

For every input sentence, KELM constructs a three-part graph that bridges the gap between raw text and structured knowledge.

The Unified Knowledge-enhanced Text Graph (UKET) integrates text tokens with KG entities and their relational neighbors across three distinct layers.

As shown in Figure 1, the UKET consists of:

  1. KG-only graph: Sub-graphs extracted from external KGs (e.g., WordNet or NELL) containing mentioned entities and their immediate neighbors.
  2. Entity-link-to-token graph: A bipartite graph connecting words in the text to potential entity matches in the KG.
  3. Text-only graph: A fully connected graph representing the words in the input sentence.

Hierarchical Message Passing (HMP)

Once the graph is constructed, KELM employs a hierarchical mechanism to facilitate information flow between the text and the KG.

The Hierarchical Knowledge Enhancement Module architecture, showing the flow from PLM embeddings through GNNs and attention layers to produce knowledge-enriched representations.

As illustrated in Figure 2, the HMP process involves:

  • Relational GCNs (rGCN): Dynamically updating KG embeddings based on their structural neighbors.
  • Graph Attention (GAT): Allowing text tokens to "query" the KG. This mechanism ensures that the context of the sentence dictates which entity definition receives the most weight, effectively resolving ambiguity.
  • Self-Attention: Enabling newly enriched tokens to interact before final prediction.

Experimental Results

KELM was evaluated on several SuperGLUE benchmarks, including ReCoRD (extractive reading comprehension), MultiRC (multi-sentence reasoning), and COPA (commonsense causal reasoning). The results demonstrate that KELM consistently outperforms both vanilla PLMs and previous state-of-the-art knowledge-enhanced models like KT-NET.

  • ReCoRD: KELM (using BERT-large) achieved a +5.2 EM and +3.7 F1 improvement over vanilla BERT-large.
  • COPA: The model boosted BERT-large's accuracy from 70.6% to 78.0%, highlighting its strength in out-of-domain causal reasoning.
  • MultiRC: KELM provided a +3.6 EM improvement over KT-NET on the development set.

Key Insights

  1. Fine-Tuning Efficiency: Factual knowledge can be successfully injected during fine-tuning, eliminating the need for expensive re-pretraining and allowing for flexible, domain-specific KG swapping.
  2. Contextual Disambiguation: By using attention to query the KG, the model suppresses "knowledge noise." In case studies, KELM correctly identified relevant definitions (e.g., "prohibition" for "ban") with high confidence while ignoring irrelevant KG entries.
  3. Domain Nuance: The benefits of KG injection are most pronounced in out-of-domain tasks. For in-domain tasks where the PLM has already internalized relevant knowledge during pre-training, the marginal gains are smaller.

Conclusion

KELM provides a scalable and effective path for enhancing language models with structured factual knowledge. By utilizing hierarchical message passing on unified graphs, it resolves entity ambiguity and achieves state-of-the-art results on complex reading comprehension tasks without the overhead of massive re-pretraining.

Summary updated

BibTeX
@inproceedings{lu2022kelm,
  author = {Yinquan Lu and Haonan Lu and Guirong Fu and Qun Liu},
  title = {{KELM: Knowledge Enhanced Pre-Trained Language Representations with Message Passing on Hierarchical Relational Graphs}},
  booktitle = {DLG4NLP @ ICLR},
  year = {2022},
  url = {https://openreview.net/forum?id=rG-NDTSWGc},
}
Figure