Abstract
Electronic health records (EHRs) are a rich source of clinical data, yet exploiting longitudinal signals for pulmonary nodule diagnosis remains challenging due to the administrative noise and high level of clinical abstraction present in these records. Because of this complexity, classification models are prone to overfitting when labeled data is scarce. This study explores masked representation learning (MRL) as a strategy to improve pulmonary nodule diagnosis by modeling longitudinal EHRs across multiple modalities: clinical conditions, procedures, and medications. We leverage a web-scale text embedding model to encode EHR event streams into semantically embedded sequences. We then pretrain a bidirectional transformer using MRL conditioned on time encodings on a large cohort of general pulmonary conditions from our home institution. Evaluation on a cohort of diagnosed pulmonary nodules demonstrates significant improvement in diagnosis accuracy with a model finetuned from MRL (0.781 AUC, 95% CI: [0.780, 0.782]) compared to a supervised model with the same architecture (0.768 AUC, 95% CI: [0.766, 0.770]) when integrating all three modalities. These findings suggest that language-embedded MRL can facilitate downstream clinical classification, offering potential advancements in the comprehensive analysis of longitudinal EHR modalities.
Introduction
Predicting whether a pulmonary nodule—a small growth on the lung—is malignant is a critical clinical challenge. While Electronic Health Records (EHRs) provide a longitudinal view of a patient's health, they are notoriously "noisy." Medical codes are frequently recorded for administrative or billing purposes rather than pure clinical description, leading to a high level of abstraction that can obscure true disease progression.
Due to this complexity, standard machine learning models often overfit, memorizing administrative noise in small labeled datasets rather than learning meaningful clinical patterns. This research addresses this gap by employing Masked Representation Learning (MRL) to help models understand the "language" of a patient's medical history through self-supervised pretraining before applying specific cancer labels.
Methods
The proposed pipeline treats a patient's medical history as a semantically rich sequence of events. The process involves several key stages:
- Natural Language Templates: Raw numerical codes (e.g., ICD-10, CPT) are converted into descriptive strings following the format:
[Modality] #[Concept ID]: [Concept name]. For example, a code for a lung nodule becomes “Condition #00032: solitary nodule of lung”. - Language Embedding: These strings are processed by a state-of-the-art, web-scale Text Embedding Model (TEM),
stella_en_400M_v5, converting them into 1024-dimensional vectors. This allows the model to capture semantic relationships (e.g., recognizing the similarity between different types of heart failure). - Time-Distance Transformer: Embeddings are paired with time encodings to preserve the longitudinal structure of the patient timeline.
- Masked Representation Learning (MRL): Similar to the training of BERT, the model is tasked with predicting "masked" (hidden) medical events within a patient's timeline. This forces the transformer to learn the intricate relationships between conditions, procedures, and medications over many years.
- Finetuning: The pretrained model is then finetuned to predict a lung cancer diagnosis within three years of detecting a solitary pulmonary nodule.
Data and Experimental Setup
The study utilized data from the Vanderbilt University Medical Center:
- Discovery Set (Pretraining): 109,031 patients with various pulmonary diseases, used for the self-supervised MRL task.
- SPN Set (Evaluation): 13,069 patients with a solitary pulmonary nodule (SPN) and no prior cancer history, split into training (10,530) and testing (2,639) sets.
- Modalities: The data spanned diagnostic codes (SNOMED), procedural codes (CPT), and medications (RxNorm) from 2000 to 2024.
Results and Key Insights
The researchers compared the MRL-finetuned model against a supervised baseline with an identical architecture.
Performance Gains in Multi-Modality
The most significant finding was that MRL provided a substantial performance boost primarily when all three modalities (diagnoses, procedures, and medications) were integrated. In this tri-modality setting, the MRL model achieved an AUC of 0.781, significantly outperforming the supervised baseline of 0.768. Conversely, when using only diagnostic codes, both models performed similarly (approx. 0.773 AUC), suggesting that MRL's primary value lies in managing the complexity and noise of multi-modal data.
MRL as a Regularizer
Incorporating additional data types like medications and procedures typically increases the risk of overfitting due to the massive expansion of the feature space. However, MRL effectively acted as a regularizer, allowing the model to extract value from the extra information rather than being overwhelmed by noise.
Semantic Awareness
By utilizing a TEM, the model gains semantic awareness. It does not treat medical tokens as isolated entities; instead, it understands their proximity in clinical meaning. t-SNE visualizations demonstrate that the model can identify overarching clinical concepts by clustering related events from different modalities.
Discussion and Future Work
While the results are promising, the authors note that structured EHR data remains abstracted. For instance, medication data in this study lacked dosage and duration, which are often found in unstructured clinical notes.
Future research directions include:
- Integrating unstructured clinical notes directly into the MRL framework to capture granular clinical details.
- Investigating the "grammar" of medication prescriptions and their specific relationships to disease progression.
- Evaluating the portability of these language-embedded representations across different healthcare systems.
Summary updated