Abstract
Temporal distribution shift—changes in medical practices and patient populations over time—frequently degrades the performance of clinical prediction models. This study evaluates whether pretraining foundation models on large-scale electronic health records (EHR) using self-supervised learning can mitigate this decay. We compared Transformer- and Gated Recurrent Unit (GRU)-based foundation models (CLMBR) against traditional count-based logistic regression (count-LR) across four clinical tasks. Our results demonstrate that foundation models significantly improve both in-distribution and out-of-distribution performance, reducing average AUROC decay by more than half (3% vs. 7%) over a 5-9 year period.
The Challenge of Temporal Distribution Shift
In clinical AI, models often suffer from "performance drift." A model trained on data from 2010 may fail in 2020 due to evolving coding practices, new hospital policies, or shifting demographics. This phenomenon, known as temporal distribution shift, can lead to unreliable predictions and "spurious alerts" in live clinical settings. While typical solutions involve frequent manual retraining, this research explores whether foundation models can capture more stable, time-invariant medical patterns.
Methods: From Count-Based to Foundation Models
The core of this study is the comparison between traditional feature engineering and deep learning-based patient representations.
The researchers utilized the CLMBR (Clinical Language Model-based Representations) framework. Similar to how Large Language Models predict the next word in a sequence, CLMBR treats a patient's medical history as a sequence of clinical codes (diagnoses, procedures, medications) and learns to predict future codes. Two architectures were tested: Transformers and Gated Recurrent Units (GRUs). Once pretrained on unlabeled data, these models serve as "frozen" feature extractors for simple logistic regression heads trained on specific clinical tasks.
Experimental Design and Datasets
The study leveraged data from the Stanford Medicine Research data Repository (STARR), standardized to the OMOP Common Data Model.
The experimental design focused on two key areas:
- Robustness (Experiment 1): Models were pretrained and trained on data from 2009–2012 (In-Distribution) and then evaluated on subsequent years up to 2021 (Out-of-Distribution).
- Scaling (Experiment 2): The pretraining set size was scaled from 36,000 to 1.8 million patients (382 million coded events) to observe how data volume affects performance and robustness.
Key Results and Insights
- Superior Robustness: In tasks prone to performance decay, such as predicting long hospital stays, the Transformer-based CLMBR showed an average AUROC decay of only 3%, compared to 7% for the count-LR baseline after 5–9 years.
- Scaling Laws: While GRUs performed well on smaller datasets, the Transformer architecture demonstrated superior scaling, continuing to improve in both discrimination and robustness as the pretraining data increased to 1.8 million patients.
- Stable Representations: Foundation models appear to learn more "holistic" views of patient health that are less sensitive to the "spurious" correlations found in simple count-based models, which often latch onto transient coding artifacts.
Discussion and Limitations
While EHR foundation models show great promise in building "future-proof" clinical tools, some challenges remain. This was a single-center study at Stanford; multi-institutional validation is necessary to ensure these global patterns generalize across different healthcare systems. Additionally, while the models excel at ranking patients (discrimination), their ability to provide precise probability estimates (calibration) requires further refinement. Future work will explore larger model parameters and alternative self-supervised objectives to further enhance clinical utility.
Summary updated