[Paper Review] EHRMamba: Towards Generalizable and Scalable Foundation Models for Electronic Health Records
EHRMamba introduces a scalable, long-context foundation model for EHRs based on the Mamba architecture, with Multitask Prompted Finetuning (MPF) enabling joint learning of multiple clinical tasks and EHR forecasting, achieving state-of-the-art results on MIMIC-IV tasks.
Transformers have significantly advanced the modeling of Electronic Health Records (EHR), yet their deployment in real-world healthcare is limited by several key challenges. Firstly, the quadratic computational cost and insufficient context length of these models hinder hospitals' ability in processing the extensive medical histories typical in EHR data. Additionally, existing models employ separate finetuning for each clinical task, complicating maintenance in healthcare environments. Moreover, these models focus exclusively on either clinical prediction or EHR forecasting, lacking proficiency in both tasks. To overcome these limitations, we introduce EHRMamba, a robust foundation model built on the Mamba architecture. EHRMamba can process sequences up to 300% longer than previous models due to its linear computational cost. We also introduce a novel approach to Multitask Prompted Finetuning (MPF) for EHR data, which enables EHRMamba to simultaneously learn multiple clinical tasks in a single finetuning phase, significantly enhancing deployment and cross-task generalization. Furthermore, our model leverages the HL7 FHIR data standard to simplify integration into existing hospital systems. Alongside EHRMamba, we open-source Odyssey, a toolkit designed to support the development and deployment of EHR foundation models, with an emphasis on data standardization and interpretability. Our evaluations on the MIMIC-IV dataset demonstrate that EHRMamba advances state-of-the-art performance across 6 major clinical tasks and excels in EHR forecasting, marking a significant leap forward in the field.
Motivation & Objective
- Address computational and context-length limitations of Transformer-based EHR models in real-world hospitals.
- Enable scalable deployment by reducing finetuning overhead and enabling cross-task generalization.
- Support both EHR forecasting and clinical predictive modeling within a single framework.
- Leverage HL7 FHIR for easier integration into hospital systems.
- Provide tooling (Odyssey) to standardize data and improve interpretability.
Proposed method
- Adopts Mamba-based State Space Model architecture to achieve linear-time inference and extended context length.
- Introduces EarMamba embedding layer that fuses event tokens with time, age, visit, and positional attributes.
- Pretrains with Next Token Prediction (NTP) or Masked Language Modeling (MLM) on unlabeled EHR sequences.
- Finetunes via Multitask Prompted Finetuning (MPF), replacing [CLS] and [REG] with task-specific prompts to enable multi-task learning in one phase.
- Forecasting head (causal language modeling) used during pretraining to predict future tokens.
- Clinical prediction head (binary classification) used during MPF finetuning to predict multiple clinical outcomes.

Experimental results
Research questions
- RQ1Can EhrMamba process longer EHR sequences with linear rather than quadratic cost, enabling practical deployment in hospitals?
- RQ2Does Multitask Prompted Finetuning (MPF) improve cross-task generalization and reduce maintenance overhead for multiple clinical tasks?
- RQ3Can a single model perform both EHR forecasting and clinical predictive modeling effectively?
- RQ4How well does EhrMamba integrate with HL7 FHIR-based hospital workflows, and what are the interpretability capabilities?
- RQ5What performance gains are achieved on standard EHR tasks using MIMIC-IV compared to strong baselines?
Key findings
- EHRMamba achieves state-of-the-art performance on six clinical prediction tasks in MIMIC-IV.
- The model exhibits improved memory and computational efficiency relative to baselines.
- MPF enables cross-task knowledge sharing and simplifies deployment to new tasks without architectural changes.
- EhrMamba extends context length fourfold over prior transformers, while maintaining linear inference cost.
- A case study with interpretability using integrated gradients demonstrates token-level attribution for mortality predictions.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.