Abstract
Electronic Health Records (EHRs) are a cornerstone of modern precision medicine, yet much of the critical clinical information remains trapped in unstructured narrative text. We introduce CancerBERT, a domain-specific language model designed to extract breast cancer phenotypes from clinical notes and pathology reports. By performing continued pre-training on a massive oncology-specific corpus and implementing a custom vocabulary tailored to specialized medical terminology, CancerBERT overcomes the limitations of general-purpose models. Our evaluation shows that CancerBERT achieves superior performance in Named Entity Recognition (NER) tasks, providing a robust tool for automated clinical data extraction.
Introduction
The transition to Electronic Health Records has generated vast amounts of data, but high-fidelity clinical research often requires structured phenotypes—such as tumor size, histological grade, and receptor status—that are typically buried in free-text reports. While Transformer-based models like BERT have revolutionized Natural Language Processing (NLP), they frequently encounter the Out-of-Vocabulary (OOV) problem when applied to specialized domains like oncology. For instance, a standard tokenizer might fragment "HER2" into "HER" and "2," losing the semantic integrity of the biomarker. CancerBERT addresses this by integrating domain-specific pre-training with vocabulary expansion.
Methodology
The development of CancerBERT followed a "continued pre-training" paradigm. The researchers initialized the model with BlueBERT (pre-trained on PubMed and MIMIC-III) and further trained it on a large-scale breast cancer dataset.
A key innovation was the evaluation of three vocabulary strategies to mitigate OOV issues:
- CancerBERT$_{OrigVoc}$: Retained the standard BERT vocabulary.
- CancerBERT$_{CustVoc_997}$: Added 997 high-frequency words from the cancer corpus not present in the original dictionary.
- CancerBERT$_{CustVoc_397}$: Added 397 cancer-specific terms and abbreviations manually curated by clinical experts.
The models were fine-tuned for NER to identify eight specific phenotypes essential for breast cancer characterization.
Datasets
The pre-training corpus consisted of approximately 4.5 million clinical notes and 1.2 million pathology reports from 21,291 breast cancer patients at the University of Minnesota (UMN), totaling roughly 1 billion tokens.
For evaluation, a "gold standard" dataset was manually annotated by experts. This evaluation set included nearly 10,000 sentences and over 221,000 tokens, providing a rigorous benchmark for model performance across various entity types. The distribution of these entities is detailed in the statistics below.
Results and Discussion
CancerBERT variants consistently outperformed baseline models, including BioBERT, CharBERT, and standard BERT-large. The CancerBERT$_{CustVoc_397}$ model emerged as the top performer, achieving a Macro-F1 score of 0.876 for exact matches and 0.904 for lenient matches.
Key Findings:
- Domain Knowledge vs. Frequency: The model utilizing 397 manually selected words outperformed the one using 997 frequent words. This indicates that expert-guided vocabulary selection is more effective than purely statistical approaches for specialized NLP.
- Reduced Fragmentation: Custom tokens increased the coverage of unique annotated tokens from 41.8% to 64.3%, significantly reducing word fragmentation and improving semantic capture.
- Phenotype-Specific Success: The model was exceptionally accurate in identifying "Hormone Receptor Type" (0.982 F1) and "Tumor Laterality" (0.953 F1).
Conclusion
CancerBERT demonstrates the power of domain-specific pre-training and vocabulary customization in clinical NLP. By "teaching" the model the specific language of oncology, researchers have created a tool capable of unlocking structured data from EHRs with high precision. Future work will focus on multi-institutional validation and expanding the model's capabilities to relation extraction and broader clinical classification tasks.
Summary updated