Natural Language Processing in Clinical Text
Clinical notes are the richest source of patient information and the hardest to use computationally. From rule-based systems to transformer models fine-tuned on medical corpora, clinical NLP has evolved rapidly — but the fundamental tension between structured data extraction and preserving clinical nuance remains.
Roughly 80% of the information in electronic health records is locked in unstructured text: physician notes, nursing assessments, radiology reports, pathology findings, discharge summaries. This text is written under time pressure, laden with abbreviations, riddled with implicit clinical reasoning, and governed by conventions that vary between specialties, institutions, and individual physicians. “SOB” means shortness of breath, not what you think. “Unremarkable” is high praise. “Interesting” means the radiologist found something alarming. Clinical natural language processing is the project of making this text computationally accessible, and it is substantially harder than general-domain NLP for reasons that go beyond vocabulary.1
Why Clinical Text Is Different
Clinical text violates many assumptions that general NLP systems rely on. The writing is telegraphic — “72M w/ h/o HTN, DM2, CKD3, p/w CP x 2hrs, trop neg, EKG nsr” is a perfectly normal sentence in an emergency department note. It compresses a patient’s history, demographics, presentation, and initial workup into a string that would baffle any model trained on Wikipedia. Negation is pervasive and structurally complex: “no evidence of pneumonia” and “cannot rule out pneumonia” have opposite clinical implications despite both containing the word “pneumonia.” Temporality is critical but poorly marked: “patient had MI in 2019” and “patient having MI” require different clinical responses but similar language.2
There is also the problem of copy-paste. Physicians routinely copy forward previous notes, appending updates at the bottom. A hospitalized patient’s day-5 note may contain the full text of their admission note, their day-1 note, their day-2 note, and so on, with incremental changes buried in the repetition. Wang et al. (2017) found that over 50% of clinical note text was duplicated, severely complicating any NLP task that treats notes as independent documents.
The Evolution of Clinical NLP
The field has passed through several distinct eras. Early clinical NLP was dominated by rule-based systems, the most influential being cTAKES (clinical Text Analysis and Knowledge Extraction System), an Apache open-source NLP system developed at the Mayo Clinic. cTAKES used a pipeline of rule-based components: sentence boundary detection, tokenization, part-of-speech tagging, named entity recognition against medical ontologies like UMLS (Unified Medical Language System) and SNOMED CT, negation detection via the NegEx algorithm, and temporal relation extraction.3
NegEx deserves special mention because it was, for years, the single most important algorithm in clinical NLP. Chapman et al. (200125ya) proposed a simple regular-expression approach: maintain a list of negation triggers (“no,” “denies,” “without,” “negative for”) and a list of termination terms (“but,” “however,” “which”), then mark any medical concept between a trigger and a terminator as negated. Despite its simplicity, NegEx achieved ~95% accuracy on negation detection in discharge summaries and remained the default approach for over a decade. Its longevity says something about clinical NLP: simple rules, tailored to the domain’s specific linguistic patterns, can be remarkably effective.
The machine learning era brought statistical methods — CRFs for named entity recognition, SVMs for text classification, word2vec embeddings trained on clinical corpora. But the real transformation came with the Transformer architecture and pretrained language models.
Clinical Transformers
BERT (Devlin et al., 2019) changed NLP by demonstrating that pretraining a large language model on unlabeled text and then fine-tuning on downstream tasks dramatically improved performance across the board. The clinical NLP community quickly recognized that BERT pretrained on general text was suboptimal for clinical tasks — the vocabulary, writing style, and domain knowledge were too different.
ClinicalBERT (Huang et al., 2019) was one of the first clinical adaptations, continuing BERT’s pretraining on ~2 million clinical notes from MIMIC-III. BioBERT (Lee et al., 2020) took a different approach, pretraining on biomedical literature from PubMed and PMC. PubMedBERT (Gu et al., 2021) went further, training from scratch on PubMed abstracts rather than continuing from a general-domain checkpoint, and showed that domain-specific pretraining from scratch often outperformed continued pretraining.
The proliferation of clinical BERT variants revealed a general pattern: domain-specific pretraining helps, but the gains vary by task. For named entity recognition (extracting drug names, diseases, procedures from text), domain-specific pretraining provides large improvements. For simpler classification tasks (is this note describing a positive or negative finding?), the gains are smaller. For tasks requiring deep clinical reasoning (predicting patient outcomes from note text), the pretraining corpus matters less than the fine-tuning data quality.
More recently, large language models like GPT-4 and Med-PaLM 2 have shown remarkable zero-shot and few-shot capabilities on clinical NLP tasks. Nori et al. (2023) demonstrated that GPT-4 could pass the USMLE medical licensing exam without any medical-specific fine-tuning, and subsequent work has shown strong performance on clinical text extraction tasks. The question is no longer whether LLMs can process clinical text — they clearly can — but whether they can be deployed safely in clinical workflows given concerns about hallucination, consistency, and data privacy.4
Key Applications
Clinical coding and billing. Every hospital encounter must be mapped to ICD-10 diagnosis codes and CPT procedure codes for billing. This is done by professional medical coders who read clinical notes and assign codes — a labor-intensive process with its own error rate. Automated coding from clinical text has been a target of NLP research for decades. Mullenbach et al. (2018) introduced attention-based models for ICD coding that provided both predictions and explanations (which words triggered which codes). More recent transformer-based approaches achieve macro-F1 scores above 0.70 on the full ICD-10 code set (~70,000 codes), but clinical adoption remains limited due to the financial stakes — incorrect codes can trigger audits, payment denials, or fraud investigations.5
Phenotyping. Identifying patients with specific conditions from EHR data (for clinical trials, quality reporting, or research cohorts) often requires information locked in notes. A patient with heart failure might have a diagnosis code in their problem list, or they might not — but the cardiologist’s note saying “EF 25%, volume overloaded, started on Entresto” captures the diagnosis unambiguously. NLP-based phenotyping extracts these structured facts from unstructured text. The PheKB repository collects validated phenotyping algorithms, many of which now incorporate NLP components.
De-identification. Before clinical text can be shared for research, all protected health information (PHI) must be removed — patient names, dates, locations, medical record numbers. This is a named entity recognition task, and it is one of the rare clinical NLP applications where performance is genuinely good enough for production use. Modern de-identification systems based on transformer models achieve >98% recall on PHI detection, though the remaining <2% of misses can still represent privacy risks at scale.6
Radiology report processing. Extracting structured findings from radiology reports is perhaps the most mature clinical NLP application. Systems like CheXpert’s labeler and NegBio convert free-text reports into structured labels (pneumonia: positive, pleural effusion: uncertain, etc.). These labelers are themselves critical infrastructure — they generate the training labels for medical imaging AI systems.
Evaluation Challenges
Evaluating clinical NLP is harder than evaluating general NLP because ground truth is expensive and often ambiguous. A board-certified physician might spend 5–10 minutes annotating a single clinical note for entity recognition, and inter-annotator agreement is often surprisingly low — physicians disagree about what counts as a “problem,” how to handle hedged language, and where entity boundaries fall. Stubbs et al. (201511ya) found inter-annotator agreement rates of 0.70–0.85 (F1) for clinical entity annotation tasks, which puts an effective ceiling on model performance.7
The shared task and benchmark ecosystem is also limited by data access constraints. Unlike general NLP, where benchmarks use publicly available text, clinical NLP benchmarks require access to clinical data under data use agreements. MIMIC-III and n2c2 (formerly i2b2) challenges have been the primary shared evaluation platforms. The n2c2 challenges cover a range of tasks — medication extraction, temporal relations, adverse drug event detection, clinical trial criteria matching — and represent the most rigorous evaluation framework in clinical NLP. But they use data from a small number of institutions, and performance on n2c2 tasks does not guarantee performance on clinical text from other hospitals.
The LLM Transition
The field is at an inflection point. The traditional clinical NLP pipeline — tokenize, tag, extract entities, resolve negation, normalize to ontology — is being challenged by end-to-end LLM approaches that can perform all of these steps in a single prompt. GPT-4 can extract medication lists, detect negation, resolve abbreviations, and map to standard terminologies in a single pass, often with accuracy comparable to purpose-built systems.
But the deployment constraints are severe. Clinical text contains PHI that cannot be sent to external API endpoints under most institutional policies. Running large models on-premises requires infrastructure that most hospitals lack. And the stochastic nature of LLM outputs — the same prompt can produce different results on different runs — is deeply uncomfortable in a clinical context where reproducibility matters.
The likely near-term trajectory is hybrid: smaller, fine-tuned models (in the 7–13B parameter range) running on-premises for routine extraction tasks, with larger models used for complex reasoning tasks under appropriate data governance. The rule-based systems won’t disappear either — for tasks like negation detection and section parsing, where rules work well and interpretability matters, simpler is still better.8