Sequence Composition in EHR Foundation Model Pretraining
Organizations: Department of Computing, Imperial College London
Abstract
Autoregressive electronic health record (EHR) foundation models predict the next event token in patient trajectories: sequences of structured medical events. A typical pretraining strategy is to concatenate all trajectories into a global stream and sample token windows from it. This gives patients with longer sequences more training exposure and allows tokens to attend across patient boundaries. We argue that these choices create a misalignment between pretraining and downstream clinical tasks. To explore this, we investigate how the composition of pretraining sequences affects clinical prediction performance. Using the global-stream approach as a baseline, we propose alternative sequence composition methods that control how patient trajectories contribute to pretraining sequences. Across four MIMIC-IV v2.2 tasks, our best method improves macro AUROC, AUPRC, F1, and balanced accuracy, with relative gains of 9.3% in F1 and 2.7% in AUPRC under a fixed training recipe. We find that these gains generalize across four additional evaluation settings, including the INSPIRE and eICU-CRD datasets, with improvements in macro AUROC, AUPRC, and F1 score. Our results show that simply changing how EHR data are presented to the model during pretraining can improve downstream performance, without changing the model or collecting additional data.
Figures & tables
| Dataset | Tokenization | Patients | Tokens | Vocab. size | Median length (tokens) | Length (% of patients) |
| MIMIC-IV v2.2 | ETHOS | 285,606 | 362,697,213 | 4,509 | 338 | 14.2% |
| MIMIC-IV v3.1 | ETHOS | 346,262 | 500,700,081 | 4,598 | 365 | 16.1% |
| MIMIC-IV v2.2 | Ours | 287,511 | 576,657,770 | 6,431 | 512 | 22.2% |
| INSPIRE | Ours | 99,900 | 176,560,774 | 1,313 | 840 | 18.3% |
| eICU-CRD | Ours | 138,963 | 461,065,895 | 8,000 | 1,719 | 43.1% |
Appendix figures & tables13 assets
Supplementary material from the paper’s appendix.
Appendix
| Parameter | Value |
| Architecture | GPT-2-style decoder ( Radford et al., 2019 ) |
| Parameters | 49,454,592 |
| Transformer layers | 6 |
| Hidden dimension | 768 |
| Attention heads | 12 |
| Feed-forward dimension | 3,072 |
| Method | Best validation loss | Macro AUROC | Macro AUPRC | Macro F1 | Macro BAcc | |
| PS | ||||||
| Method | Best validation loss | Macro AUROC | Macro AUPRC | Macro F1 | Macro BAcc | |
| PS | ||||||
| RPS |
| Method | Macro F1 | Macro AUROC | Macro AUPRC | Macro BAcc | |
| GS | – | ||||
| GS+M | – | ||||
| PS | |||||
| RPS | |||||
| OGS |
| MIMIC-IV table | ETHOS | Unified |
| Demographics and encounters | ||
| patients | ✓ | ✓ |
| admissions | ✓ | ✓ |
| transfers | ✓ | ✓ |
| triage | ✓ | ✓ |
| Diagnoses and billing procedures | ||
| Benchmark | Prediction point | Positive / negative outcome | Horizon |
| Hospital mortality | HOSPITAL_ADMISSION | MEDS_DEATH (+) HOSPITAL_DISCHARGE ( ) | – |
| ICU mortality | ICU_ADMISSION | MEDS_DEATH (+) ICU_DISCHARGE ( ) | – |
| ICU readmission | ICU_DISCHARGE | ICU_ADMISSION (+) HOSPITAL_DISCHARGE ( ) | – |
| ICU admission | HOSPITAL_ADMISSION | ICU_ADMISSION (+) HOSPITAL_DISCHARGE ( ) | – |
| Hospital readmission | HOSPITAL_DISCHARGE | HOSPITAL_ADMISSION (+) MEDS_DEATH or horizon ( ) | 30 days |
| Postoperative ICU admission | OPERATION_END | ICU_ADMISSION (+) HOSPITAL_DISCHARGE ( ) | – |
| Dataset | Tokenization | Maximum tokens |
| MIMIC-IV v2.2 | ETHOS | 4,096 |
| MIMIC-IV v2.2 | Unified | 8,192 |
| MIMIC-IV v3.1 | ETHOS | 4,096 |
| INSPIRE | Unified | 4,096 |
| eICU-CRD | Unified | 8,192 |
| Task | Instances | Positive | Prevalence |
| MIMIC-IV v2.2, ETHOS tokenization | |||
| Hospital mortality | 42,973 | 836 | 1.95% |
| ICU admission | 42,974 | 6,636 | 15.44% |
| ICU mortality | 7,365 | 532 | 7.22% |
| ICU readmission | 6,469 | 850 | 13.14% |
| MIMIC-IV v2.2, unified tokenization | |||
| AUROC | AUPRC | F1 | BAcc | |||||
| Task | GS+M | OGS | GS+M | OGS | GS+M | OGS | GS+M | OGS |
| MIMIC-IV v2.2 ETHOS tokenization | ||||||||
| Hospital mortality | ||||||||
| ICU admission | ||||||||
| ICU mortality | ||||||||
| ICU readmission | ||||||||