SMedBERT: A Knowledge-Enhanced Pre-trained Language Model with Structured Semantics for Medical Text Mining

Taolin Zhang, Zerui Cai, Chengyu Wang, Minghui Qiu, Bite Yang, Xiaofeng He

Abstract

Pre-trained language models (PLMs) have revolutionized natural language processing, yet they often struggle in specialized domains like medicine where terms are rare and context is highly structured. SMedBERT addresses these challenges by integrating structured knowledge from Knowledge Graphs (KGs) into the BERT architecture. By leveraging neighboring entities and novel pre-training tasks, SMedBERT significantly improves performance on Chinese medical NLP tasks, particularly for long-tail medical terms.

Introduction

In the medical domain, language is characterized by highly specialized terminology and complex relational structures. While standard PLMs like BERT capture general linguistic patterns, they often fail to grasp the deep semantic connections between medical entities. For instance, knowing that a specific virus causes a particular disease is crucial for accurate text mining. Existing Knowledge-Enhanced PLMs (KEPLMs) typically link text mentions to single entities in a KG, but they often ignore the rich "global context" provided by an entity's neighbors.

Furthermore, medical text mining faces the "long-tail problem," where rare medical terms appear infrequently in training corpora, leading to poor representation learning. SMedBERT is designed to overcome these hurdles by injecting structured semantics from neighboring entities and using specialized pre-training objectives to "teach" the model about rare terms through their well-connected KG neighbors.

Methodology: Structured Semantic Integration

SMedBERT employs a dual-encoder architecture consisting of a Text Encoder (T-Encoder) and a Knowledge Encoder (K-Encoder). The T-Encoder processes raw token inputs, while the K-Encoder integrates external knowledge. To ensure that only relevant information is injected, SMedBERT utilizes a Personalized Entity PageRank (PEPR) algorithm to select the top-K most relevant neighboring entities for any given mention.

SMedBERT Architecture and Pre-training Tasks

Mention-neighbor Hybrid Attention

The core of the K-Encoder is the Hybrid Attention Network, which fuses text embeddings with KG data through two specialized layers:

  1. Type Attention: This layer learns to weight different categories of neighbors (e.g., Symptoms vs. Departments) based on their relevance to the current context.
  2. Node Attention: This layer focuses on specific neighbor entities within those categories.

A Gated Position Infusion mechanism then controls the flow of this external knowledge into the final token representations, preventing "knowledge noise" from overwhelming the original textual meaning.

Specialized Pre-training Tasks

To better align textual mentions with structured knowledge, SMedBERT introduces two novel pre-training tasks:

  • Masked Neighbor Modeling (MNeM): The model is tasked with predicting a neighbor entity in the KG given a mention in the text. This forces the model to learn the relational context of medical terms.
  • Masked Mention Modeling (MMeM): In this task, a text mention is masked, and the model must reconstruct it using only its KG neighbors. This is particularly effective for rare terms; even if a word is infrequent in the text, its connections in the KG provide enough signal for the model to learn a robust representation.

Experimental Results

SMedBERT was evaluated on the ChineseBLUE benchmark and several real-world datasets from DXY and CHIP. It consistently outperformed strong baselines, including RoBERTa, BioBERT-zh, and ERNIE-med, across tasks such as Named Entity Recognition (NER), Relation Extraction (RE), and Question Answering (QA). SMedBERT achieved significant boosts in performance, with average F1 improvements ranging from +0.88% to +2.07% on NER and +0.68% to +0.92% on Relation Extraction compared to the best-performing baselines.

Performance comparison across different entity hit ratios

As shown in the evaluation against varying entity hit ratios, SMedBERT maintains a significant performance lead over models like ERNIE, especially when entities are less frequent in the text (low hit ratio). This validates the effectiveness of the MMeM task in addressing the long-tail problem. On specific test sets for low-frequency mentions, SMedBERT showed a +1.01% improvement over the best baselines.

Conclusion

SMedBERT demonstrates that structured semantics from KG neighbors are vital for medical text mining. By treating the KG as a heterogeneous structure rather than a flat list of entities, and by using neighbors to bridge knowledge gaps for rare terms, SMedBERT sets a new standard for Chinese medical NLP. Future work will explore extending this architecture to multi-hop neighbors and other languages, further enhancing the depth of knowledge integration.

Summary updated

BibTeX
@inproceedings{zhang2021smedbert,
  author = {Taolin Zhang and Zerui Cai and Chengyu Wang and Minghui Qiu and Bite Yang and Xiaofeng He},
  title = {{SMedBERT: A Knowledge-Enhanced Pre-trained Language Model with Structured Semantics for Medical Text Mining}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.acl-long.457},
}
Figure