Specialty-Specific Medical Language Model for Immune-Mediated Diseases
Organizations: John Snow Labs Inc., Delaware, USA
Abstract
Extracting detailed clinical information from free-text medical narratives remains a practical challenge for researchers and healthcare systems. Terminology for immune-mediated and infectious diseases is especially inconsistent across sources, which often limits the ability of general-purpose Natural Language Processing (NLP) systems to capture the relevant biomedical concepts with sufficient granularity. We developed a domain-specific Named Entity Recognition (NER) model tailored to identify disease-related entities occurring in immunology and infectious disease contexts. We assembled and manually annotated a dataset of 371 case reports in collaboration with two clinical specialists, defining twelve entity classes covering immune-mediated and infectious conditions as well as related symptoms and clinical descriptors. We evaluated several modeling strategies, including the MedicalNER architecture with multiple healthcare-specific embeddings, a BERT-based token classification model, and zero-shot NER systems. The strongest performance was obtained with a transformer-based model trained on clinical-domain embeddings, which reached an F1 score of 0.89, consistently outperforming baseline and zero-shot approaches. The combination of specialized embeddings and expert annotation proved particularly valuable for capturing nuanced disease terminology and improving generalization across heterogeneous biomedical text. The prompted LLM baseline achieved substantially lower performance under the same evaluation protocol, reflecting difficulties in producing span-consistent outputs for fine-grained entity boundaries despite detailed prompting. The resulting model provides a structured way to analyze case reports and can support downstream tasks such as cohort identification, disease monitoring, and clinical decision support.
Figures & tables
| Category | Precision | Recall | F1-Score | Support |
| Bacterial_Infection | 0.93 | 0.95 | 0.94 | 439 |
| Biomarker | 0.80 | 0.91 | 0.85 | 183 |
| Fungal_Infection | 0.96 | 0.98 | 0.97 | 109 |
| Geographical_Location | 0.96 | 0.97 | 0.96 | 377 |
| Immune_Mediated_Disease | 0.92 | 0.87 | 0.89 | 330 |
| Other_Disease_Disorder | 0.87 | 0.74 | 0.80 | 627 |
| Embeddings / Model | Precision | Recall | F1-score |
| BERT For Token Classifier | 0.79 | 0.83 | 0.81 |
| embeddings_clinical | 0.88 | 0.90 | 0.89 |
| bert_l2_h256_uncased | 0.82 | 0.82 | 0.82 |
| bert_l2_h512_uncased | 0.82 | 0.84 | 0.83 |
| bert_l6_h256_uncased | 0.81 | 0.84 | 0.82 |
| bert_l10_h768_uncased | 0.80 | 0.87 | 0.83 |
| Category | Precision | Recall | F1-Score | Support |
| Bacterial_Infection | 0.58 | 0.62 | 0.60 | 439 |
| Biomarker | 0.38 | 0.29 | 0.33 | 183 |
| Fungal_Infection | 0.63 | 0.76 | 0.69 | 109 |
| Geographical_Location | 0.89 | 0.83 | 0.86 | 377 |
| Immune_Mediated_Disease | 0.65 | 0.72 | 0.68 | 330 |
| Other_Disease_Disorder | 0.55 | 0.59 | 0.57 | 627 |
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| Batch | Source(s) | Count | Focus / Notes |
| 1 | PubMed | 52 | Initial corpus of IMD-related cases. |
| 2 | Synthetic (perplexity.ai, DeepSeek) | 20 | Generated to augment entity diversity. |
| 3 | PubMed | 22 | Supplementary disease-specific texts. |
| 4 | PubMed, ScienceDirect, MedRxiv | 32 | Mostly PubMed; added variation in style. |
| 5 | PubMed, ScienceDirect, CDC.org | 30 | Broader coverage of infectious comorbidities. |
| 6 | Synthetic (claude.ai, perplexity.ai) | 58 | Short clinical narratives: IMD entity focus. |
| Entity | Definition |
| Bacterial_Infection | An infection caused by pathogenic bacteria, identified by the bacterial organism or the disease it produces. |
| Biomarker | A measurable biological molecule indicating a normal or abnormal process, condition, or disease. |
| Fungal_Infection | An infection caused by pathogenic fungi, identified by the fungal organism or the disease resulting from fungal infection. |
| Geographical_Location | A specific place or area mentioned in the text, such as a country, city, or region. |
| Immune_Mediated_Disease | A condition in which the immune system abnormally targets the body’s own tissues, leading to inflammation and tissue damage. |
| Other_Disease_Disorder | A disease or disorder not caused by infectious agents or immune system dysfunction. |
| Hyperparameter | Optimal Value (Values Tested) |
| Batch Size | 8 (4, 16, 32, 64) |
| Epoch | 16 (16 - 60) |
| Learning Rate | 0.001 (0.01, 0.0001) |
| Dropout Rate | 0.5 (0.3 – 0.7) |
| Optimizer | Adam |
| Embedding Size | 200 |
| Entity | Count |
| Symptom | 4,734 |
| Other_Test | 4,098 |
| Test_Result | 3,548 |
| Treatment | 3,337 |
| Other_Disease_Disorder | 3,058 |
| Bacterial_Infection | 1,433 |
| Annotation Metric | Value |
| Average Task Length (characters) | 2,367 |
| Average Time Annotators Spent on One Task (seconds) | 1,353 |
| Average Edit Time Annotators Spent on One Task (seconds) | 225 |
| Average Number of Edits per Task | 2 |
| Average Number of Tokens for Submitted/Reviewed Tasks | 86.94 |
| Total Number of Tokens Across Submitted/Reviewed Tasks | 31,298 |
| Annotator | Architecture | Embeddings / Backbone / Model |
| MedicalNER | BiLSTM-CNN-Char | embeddings_clinical John Snow Labs (2020c) |
| biobert_pubmed_base_cased John Snow Labs (2020b) | ||
| biobert_v1.1_pubmed John Snow Labs (2023) | ||
| biobert_pubmed_base_cased_v1.2 John Snow Labs (2022) | ||
| biobert_clinical_base_cased John Snow Labs (2020a) | ||
| bert_l2_h256_uncased John Snow Labs (2025b) |
Clinical Information Extraction
Clinical Information Extraction turns clinical notes, reports, and patient narratives into structured, searchable facts and relations.
See all 106 papers