CancerBERT: A cancer domain-specific language model for extracting breast cancer phenotypes from electronic health records

Sicheng Zhou, Nan Wang, Liwei Wang, Hongfang Liu, Rui Zhang

Research output: Contribution to journalArticlepeer-review

27 Scopus citations


Objective: Accurate extraction of breast cancer patients' phenotypes is important for clinical decision support and clinical research. This study developed and evaluated cancer domain pretrained CancerBERT models for extracting breast cancer phenotypes from clinical texts. We also investigated the effect of customized cancer-related vocabulary on the performance of CancerBERT models. Materials and Methods: A cancer-related corpus of breast cancer patients was extracted from the electronic health records of a local hospital. We annotated named entities in 200 pathology reports and 50 clinical notes for 8 cancer phenotypes for fine-Tuning and evaluation. We kept pretraining the BlueBERT model on the cancer corpus with expanded vocabularies (using both term frequency-based and manually reviewed methods) to obtain CancerBERT models. The CancerBERT models were evaluated and compared with other baseline models on the cancer phenotype extraction task. Results: All CancerBERT models outperformed all other models on the cancer phenotyping NER task. Both CancerBERT models with customized vocabularies outperformed the CancerBERT with the original BERT vocabulary. The CancerBERT model with manually reviewed customized vocabulary achieved the best performance with macro F1 scores equal to 0.876 (95% CI, 0.873-0.879) and 0.904 (95% CI, 0.902-0.906) for exact match and lenient match, respectively. Conclusions: The CancerBERT models were developed to extract the cancer phenotypes in clinical notes and pathology reports. The results validated that using customized vocabulary may further improve the performances of domain specific BERT models in clinical NLP tasks. The CancerBERT models developed in the study would further help clinical decision support.

Original languageEnglish (US)
Pages (from-to)1208-1216
Number of pages9
JournalJournal of the American Medical Informatics Association
Issue number7
StatePublished - Jul 1 2022

Bibliographical note

Publisher Copyright:
© 2022 The Author(s) 2022. Published by Oxford University Press on behalf of the American Medical Informatics Association.


  • CancerBERT
  • cancer phenotyping
  • electronic health record
  • name entity recognition
  • natural language processing


Dive into the research topics of 'CancerBERT: A cancer domain-specific language model for extracting breast cancer phenotypes from electronic health records'. Together they form a unique fingerprint.

Cite this