EntityBERT: Entity-centric Masking Strategy for Model Pretraining for the Clinical Domain

Chen Lin, Timothy Miller, Dmitriy Dligach, Steven Bethard, Guergana Savova

Abstract

EntityBERT introduces a specialized pretraining strategy for the clinical domain by focusing the model's attention on medical entities, such as diseases and medications, rather than random tokens. By combining the robust biomedical vocabulary of PubMedBERT with an entity-centric masking approach applied to clinical notes from the MIMIC-III corpus, the researchers achieved state-of-the-art results on complex tasks including temporal relation extraction and negation detection. The model demonstrates significant improvements in cross-domain robustness, proving more effective at generalizing medical logic than standard language models.

Introduction

Standard language models like BERT are typically pretrained on general-domain text such as Wikipedia. When applied to Electronic Medical Records (EMRs), these models encounter significant hurdles. Clinical notes are characterized by nonstandard abbreviations, jargon, and unique shorthand. A primary challenge is tokenization; general models often decompose complex medical terms into meaningless sub-word fragments (e.g., "tachypnea" becoming "tachy" + "##pnea").

Furthermore, standard "Random Masking" pretraining strategies often force models to predict common words like "the" or "patient," which provides little value for clinical decision-making. While models like PubMedBERT improved tokenization using biomedical literature, they were not optimized for the informal "physician-speak" found in actual clinical notes.

Methods

The authors propose EntityBERT, which leverages two primary strategies to bridge the gap between general biomedical knowledge and clinical practice:

  1. Continued Pretraining with Clinical Vocabulary: The model uses PubMedBERT as a foundation, benefiting from its superior biomedical vocabulary, and continues training on the MIMIC-III clinical corpus.
  2. Entity-centric Masking: Using the clinical NLP tool cTAKES, the researchers identify entities (diseases, symptoms, medications, procedures) and time expressions. These are marked with special XML tags (e.g., <e> and <t>) to define boundaries.
  3. Optimized Masking Ratios: Through empirical testing, the authors determined that masking 40% of identified entities and 12% of random words yielded the best performance. This strategy forces the model to learn the deep contextual characteristics of critical medical terms.
The EntityBERT pretraining pipeline, showing the process from raw input to entity-centric masking and prediction.

Experimental Setup and Datasets

The model was pretrained on the MIMIC-III dataset, using two scales: MIMIC-SMALL (4.6M sentences) and MIMIC-BIG (15.6M sentences). Evaluation was conducted across several specialized tasks:

  • Temporal Relation Discovery (THYME Corpus): Determining the chronological order of medical events (DocTimeRel and TLINK).
  • Cross-domain Negation: Detecting the presence or absence of conditions (e.g., "denies fever") across datasets from i2b2, MiPACQ, and SHARP.
  • Biomedical QA: Using PubMedQA to ensure the model maintains general biomedical reasoning capabilities.

Key Results and Insights

EntityBERT achieved state-of-the-art performance across clinical benchmarks:

  • Temporal Relations (TLINK): Achieved an F1 score of 0.651, surpassing PubMedBERT (0.638) and BART-large (0.628).
  • Negation Detection: Improved average F1 to 0.781 in cross-domain settings.
  • Cross-Domain Robustness: In the difficult task of training on colon cancer notes and testing on brain cancer notes, EntityBERT improved the DocTimeRel F1 score from 0.69 to 0.72 ($p=0.0007$).
Comparison of tokenization efficiency, showing PubMedBERT's ability to represent more medical terms as single tokens compared to BERT and Roberta.

A critical finding was the importance of vocabulary; PubMedBERT keeps approximately 30% more in-domain words as single units compared to standard BERT. Additionally, attention visualization using BertViz revealed that EntityBERT’s [CLS] token focuses more effectively on actual medical entities rather than auxiliary markers.

Conclusion and Future Work

EntityBERT demonstrates that focusing pretraining on domain-specific entities significantly enhances a model's utility for clinical tasks. While the current model is limited by a 100-token sequence length and a dependency on the accuracy of initial entity recognition tools like cTAKES, it provides a powerful framework for clinical NLP. Future work will explore combining entity-centric masking with advanced architectures like DeBERTa to better represent relative distances between entities and extending the model to document-level reasoning.

Summary updated

BibTeX
@inproceedings{lin2021entitybert,
  author = {Chen Lin and Timothy Miller and Dmitriy Dligach and Steven Bethard and Guergana Savova},
  title = {{EntityBERT: Entity-centric Masking Strategy for Model Pretraining for the Clinical Domain}},
  booktitle = {BioNLP @ NAACL},
  year = {2021},
  doi = {10.18653/v1/2021.bionlp-1.21},
}
Figure