BioClinical ModernBERT: A State-of-the-Art Long-Context Encoder for Biomedical and Clinical NLP

Thomas Sounack, Joshua Davis, Brigitte N. Durieux, Antoine Chaffin, Tom J. Pollard, Eric Lehman, Alistair E. W. Johnson, Matthew B. A. McDermott, Tristan Naumann, Charlotta LindvallarXiv 2025 · DOI

Introduction

In clinical Natural Language Processing (NLP), encoder models like BERT are essential for tasks such as medical entity extraction and patient phenotype classification. However, existing clinical encoders have largely stagnated, typically limited by a 512-token context window and trained on narrow datasets, such as the MIMIC-III corpus from a single institution. This limitation often forces researchers to truncate long physician notes or use less efficient decoder models.

BioClinical ModernBERT addresses these challenges. It is a new state-of-the-art encoder optimized for biomedical and clinical domains, supporting an 8,192-token context window and trained on a record-breaking 53.5 billion tokens of diverse text.

Methods

The researchers developed BioClinical ModernBERT in two versions: Base (150M) and Large (396M). The training followed a two-phase continued pre-training strategy:

  1. Phase 1 (Biomedical + Clinical): Initialized from ModernBERT and trained on a mixture of PubMed abstracts, PMC full-text articles, and 20 curated clinical datasets (totaling 160.5B tokens in the mix) to preserve general medical knowledge.
  2. Phase 2 (Clinical Specialization): Further refinement exclusively on clinical datasets to optimize performance on real-world hospital documentation.

Architecturally, the model utilizes Rotary Positional Embeddings (RoPE) for long-context handling, "unpadding" to ignore empty tokens during computation, and an alternating attention mechanism for improved efficiency. A expanded vocabulary of over 50,000 tokens allows for more precise representation of complex medical terminology.

Data and Training Diversity

To move beyond the limitations of single-hospital datasets, the authors compiled the largest biomedical/clinical corpus for an encoder to date. This 53.5 billion token corpus includes 20 diverse datasets from various institutions and geographic regions, including MIMIC-IV, CheXpert Plus, and international radiology reports.

Table 1: Summary of the diverse clinical datasets used to train and evaluate the model.

Key Results and Performance

BioClinical ModernBERT achieved State-of-the-Art (SOTA) results on four out of five evaluated benchmarks. The most significant gains were observed in long-context tasks. For example, in Phenotype classification—where clinical notes often span thousands of tokens—the Large model achieved a 60.8% F1 score, more than doubling the 26.6% F1 score of the original BioBERT.

Table 2: Performance comparison showing BioClinical ModernBERT outperforming existing models across classification and NER tasks.

Beyond accuracy, the model is highly efficient. The Base model processes 76.2 thousand tokens per second (kTok/s), significantly outperforming other long-context architectures like BigBird and Longformer. Furthermore, the two-phase training successfully preserved biomedical knowledge, as evidenced by superior performance on PubMed-based tasks like ChemProt.

Discussion and Future Work

The success of BioClinical ModernBERT highlights that context length is a critical factor in clinical NLP; the ability to process entire patient notes without truncation leads to massive improvements in downstream accuracy. Additionally, the use of diverse datasets—including those with synthetic surrogates for private information—helps the model learn more robust representations than those trained on masked data alone.

Despite these advances, limitations remain. Approximately 95% of the clinical tokens still originate from the MIMIC ecosystem, reflecting a bias toward US-based data. The current model is also limited to English. Future research will focus on incorporating more non-US and non-English sources and evaluating the model on additional benchmarks like i2b2.

Summary updated

BibTeX
@misc{sounack2025bioclinical,
  author = {Thomas Sounack and Joshua Davis and Brigitte N. Durieux and Antoine Chaffin and Tom J. Pollard and Eric Lehman and Alistair E. W. Johnson and Matthew B. A. McDermott and Tristan Naumann and Charlotta Lindvall},
  title = {{BioClinical ModernBERT: A State-of-the-Art Long-Context Encoder for Biomedical and Clinical NLP}},
  year = {2025},
  eprint = {2506.10896},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.10896},
}
Figure