Integrating Graph Contextualized Knowledge into Pre-trained Language Models

Bin He, Di Zhou, Jinghui Xiao, Xin Jiang, Qun Liu, Nicholas Jing Yuan, Tong Xu

Abstract

General-purpose language models like BERT often struggle with the specialized terminology and complex relationships inherent in medical data. This paper presents BERT-MK (BERT integrated with Medical Knowledge), a framework that enhances pre-trained models by incorporating "graph contextualized knowledge" from medical Knowledge Graphs (KGs). Unlike previous methods that treat knowledge as isolated triples, BERT-MK models entire subgraphs to capture the topological context of entities. Our approach achieves state-of-the-art results on medical entity typing and relation classification tasks, demonstrating that structured knowledge can significantly accelerate domain adaptation.

Introduction

While pre-trained language models have revolutionized NLP, their performance in specialized domains like medicine is often limited by a lack of structured expertise. Previous attempts to inject knowledge, such as ERNIE-Tsinghua, have relied on Knowledge Representation Learning (KRL) techniques like TransE. However, these methods typically treat knowledge as a collection of disjointed triples (Subject $\rightarrow$ Relation $\rightarrow$ Object).

The KG Distributional Hypothesis

The authors propose the KG distributional hypothesis: "you shall know an entity by the relationships it involves." In medical KGs, an entity's meaning is deeply tied to its neighborhood. For instance, the clinical significance of "Bacterial pneumonia" is defined by its causative agents, pathological processes, and associated symptoms.

Example of a medical Knowledge Graph neighborhood centered on 'Bacterial pneumonia', illustrating the complex web of relationships that define medical entities.

Standard triple-based models ignore this graph-level context, failing to capture the "n-to-n" and multi-hop interactions that are prevalent in medical data.

Methodology: The BERT-MK Framework

BERT-MK introduces two primary components: Graph Contextualized Knowledge Encoding (GCKE) and a Knowledge Integration module.

Graph Contextualized Knowledge Encoding (GCKE)

The GCKE module moves beyond single triples by extracting subgraphs around entities. These subgraphs are converted into sequences of nodes (entities and relations) and encoded using a Transformer architecture. To preserve the original graph topology within the sequence, a specialized masking function is employed in the self-attention mechanism, ensuring that each node only attends to its direct neighbors and itself.

The process of converting a medical subgraph into a node sequence, including position indexing and the construction of an adjacency matrix for graph-aware self-attention.

Knowledge Integration

The resulting graph embeddings are fused with token-level information from a BERT-style backbone using an "Aggregator" block. This allows the model to simultaneously leverage textual context and structured medical knowledge.

Experimental Results

The model was pre-trained on the Unified Medical Language System (UMLS), which contains 2.8 million entities, and a massive corpus of 9.9 billion tokens from PubMed. Evaluation across several benchmarks showed significant improvements:

  • Relation Classification: On the GAD dataset, BERT-MK achieved an F1 score of 86.87, outperforming both BioBERT (81.66) and the triple-based MedERNIE (86.23).
  • Entity Typing: The model reached 99.54% accuracy on the BC5CDR dataset.

One of the most striking findings was the efficiency of this approach: BERT-MK outperformed BioBERT while using only 10% to 20% of the pre-training corpus, suggesting that structured knowledge provides a powerful shortcut for domain-specific learning.

Conclusion

By modeling the topological context of Knowledge Graphs rather than isolated triples, BERT-MK provides a more robust way to integrate domain expertise into language models. This approach not only improves performance on downstream tasks but also offers a more data-efficient path for adapting models to specialized fields.

Summary updated

BibTeX
@inproceedings{he2020integrating,
  author = {Bin He and Di Zhou and Jinghui Xiao and Xin Jiang and Qun Liu and Nicholas Jing Yuan and Tong Xu},
  title = {{Integrating Graph Contextualized Knowledge into Pre-trained Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  doi = {10.18653/v1/2020.findings-emnlp.207},
}
Figure