Papers › EHRMamba: Towards Generalizable and Scalable Foundation Models for Electronic Health Records

EHRMamba: Towards Generalizable and Scalable Foundation Models for Electronic Health Records

23 May 2024arXiv:2405.14567archive 2025-07-28

Adibvafa Fallahpour, Mahshid Alinoori, Wenqian Ye, Xu Cao, Arash Afkanpour, Amrit Krishnan

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.

PaperPDFCodeCode Syntology ran

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 14 code samples harvested from 1 repository linked to this paper: 14 ran (of which 0 constructed an object rather than computing a result; 9 with no instrument failure: 3 honoured, 0 violated, 6 with no contract checked; 5 where Syntology's instrument failed) · 0 unverified. Where Syntology's instrument failed: 5 where our contract draft was wrong; failures of Syntology's instrument, not of the code.

By repository: official repository: 14 samples from 1 repository, 14 ran (9 with no instrument failure; 5 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written on 2026-09-24 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

VectorInstitute/odyssey officialmentioned in paperpytorchApache-2.0Syntology: 14 samples, 14 ran (5 instrument-failed) · 0 unverified report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

14 samples harvested: 14 ran (of which 0 constructed an object rather than computing a result; 9 with no instrument failure: 3 honoured, 0 violated, 6 with no contract checked; 5 where Syntology's instrument failed) · 0 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

3ran · honoured contract
5ran · our draft was wrong
6ran

Licence: 0 of the 14 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from VectorInstitute/odyssey. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

VectorInstitute/odyssey official repository 14 samples, 14 ran (5 instrument-failed) · 0 unverified
annealed_alpha odyssey/models/concept_bottleneck.py ran · honoured contract Apache-2.0 (permissive) · 652cb2ddc9a741b5 · report fixture: signature step:int/0/int, anneal_steps:int/0/int, start:float/0/float, end:float/0/float, cosine:bool/0/bool · returned float · level recorded 2026-09-24
best_scorer_per_cell odyssey/inference/model_comparison.py ran · our draft was wrong Apache-2.0 (permissive) · 9cc15076d0a08f28 · report fixture: signature rows:list/1/ScorerAUROC, stratum:str/0/str · returned dict · level recorded 2026-09-24
censored_hazard_log_likelihood odyssey/models/time_to_event.py ran Apache-2.0 (permissive) · 2407e51f7377ab2c · report fixture: signature hazard_logits:Tensor/2/float, target_bin:Tensor/1/int, observed:Tensor/1/bool · returned Tensor · level recorded 2026-09-24
concept_loss odyssey/models/concept_bottleneck.py ran Apache-2.0 (permissive) · b040d3186985f9cd · report fixture: signature concept_logits:Tensor/2/float, concept_labels:Tensor/2/int, concept_mask:Tensor/2/int, pos_weight:Tensor/1/float · returned Tensor · level recorded 2026-09-24
gap_to_bin odyssey/models/time_to_event.py ran · our draft was wrong Apache-2.0 (permissive) · 20e5b21ec781dd3a · report fixture: signature gap_hours:Tensor/1/float, edges:list/1/float · returned Tensor · level recorded 2026-09-24
hazard_log_likelihood odyssey/models/time_to_event.py ran · our draft was wrong Apache-2.0 (permissive) · fa134ddfdde7b9ed · report fixture: signature hazard_logits:Tensor/2/float, target_bin:Tensor/1/int · returned Tensor · level recorded 2026-09-24
intervention_apply_mask odyssey/models/concept_bottleneck.py ran Apache-2.0 (permissive) · 1257aeb0e0ca5e64 · report fixture: signature intervention:BottleneckIntervention/0/?, own_probs:Tensor/2/float · returned Tensor · level recorded 2026-09-24
middle_layer odyssey/models/injection.py ran · honoured contract Apache-2.0 (permissive) · 37d5d57f4239c77d · report fixture: signature backbone:callable/0/? · returned int · level recorded 2026-09-24
pinball_loss odyssey/models/value_head.py ran Apache-2.0 (permissive) · ab16e79712613f58 · report fixture: signature quantiles:Tensor/2/float, target:Tensor/1/float, levels:list/1/float · returned Tensor · level recorded 2026-09-24
select_diverse_cases odyssey/inference/case_study.py ran · honoured contract Apache-2.0 (permissive) · 20f21b3aa186f2d8 · report fixture: signature events:DataFrame/0/?, concept_labels:dict/0/?, n_cases:int/0/int, min_events:int/0/int, seed:int/0/int · returned list · level recorded 2026-09-24
stream_injection odyssey/models/injection.py ran Apache-2.0 (permissive) · 04ebfb65c3483398 · report fixture: signature backbone:callable/0/?, layer_index:int/0/int, vector:Tensor/1/float · returned _GeneratorContextManager · level recorded 2026-09-24
value_features odyssey/models/embeddings.py ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 816376e6520ac858 · report fixture: signature values:Tensor/3/float · returned Tensor · level recorded 2026-09-24
value_quantile_loss odyssey/models/value_head.py ran Apache-2.0 (permissive) · 0a2999efd7fc3d1b · report fixture: signature quantiles:Tensor/3/float, target:Tensor/2/float, valid:Tensor/2/bool, levels:list/1/float · returned Tensor · level recorded 2026-09-24
value_target_valid_mask odyssey/models/value_head.py ran · our draft was wrong Apache-2.0 (permissive) · ab2ebe14caf34af0 · report fixture: signature values:Tensor/2/float, real_mask:Tensor/2/bool · returned tuple · level recorded 2026-09-24

Tasks

Mamba

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Focus

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections