Skip to content

Menu

WorksComputer Science

PedsFM: Learning Pediatric Trajectories at Native Physiological Resolution with a Hybrid Discrete-Continuous Architecture

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_4c37byry. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

Electronic health record (EHR) foundation models leverage self-supervised learning to extract clinically actionable insights without task-specific labeling. However, existing models are primarily developed and validated in adults, often discretize continuous physiological measurements, and exclude dense signals such as vital signs. These limitations are particularly relevant in pediatrics, where numerical variables are strongly age-dependent and children remain underrepresented in machine learning research. We introduce PedsFM, a pediatric-specific, decoder-only generative foundation model that jointly represents discrete clinical events and continuous physiological measurements at their native numerical resolution through dedicated embedding pathways and dual prediction heads. PedsFM was pretrained on 65,228 hospitalizations involving pediatric intensive care unit admissions across three U.S. hospitals, comprising 237 million training tokens. We evaluated generative plausibility, zero-shot probabilistic prediction of clinical outcomes, and representation learning via linear probing. Generated vital sign trajectories were physiologically plausible and outperformed a carry-forward baseline for most vitals, while medication-conditioned generation produced pharmacologically coherent physiological shifts. Zero-shot predictions outperformed a supervised, task-specific XGBoost baseline for four laboratory abnormality tasks. Mean-pooled representations achieved comparable performance for early in-hospital mortality and vasopressor initiation and outperformed last-token representations across all six tasks. These findings suggest that resolution-preserving, hybrid generative modeling can extract clinically meaningful insights from pediatric critical care trajectories without task-specific training, motivating further development of pediatric-specific foundation models.

*Corresponding authors: daniela.chanciar [email protected], [email protected] from pediatric critical care trajectories without task-specific training, and motivate further development of pediatric-specific foundation models.

Introduction

Electronic Health Records (EHR) data capture the clinical trajectory of patients through longitudinal recordings of vital signs, laboratory tests, medications, procedures, and other clinical events [1]. These data present an ideal opportunity to develop data-driven decision support tools that can generate actionable insights from routinely collected clinical information. Consequently, over the last decade, numerous studies have focused on developing machine learning methods for a wide variety of healthcare applications [2]. Traditional machine learning approaches usually rely on carefully engineered features, task-specific cohorts, and expert-defined labels, and they have demonstrated strong discriminative performance for well-specified clinical outcomes. However, task-specific models are developed for a particular prediction task, requiring the corresponding cohort, outcome labels, feature extraction, and model training procedure to be defined for each new outcome [3, 4].

Advances in sequence modeling, such as the transformer architecture, have provided suitable methods for representing longitudinal, structured EHR data [5]. Additionally, transformer-based foundation models offer an alternative to training a separate model for each task and have become central to recent progress in artificial intelligence in healthcare [6]. These models are pretrained on large datasets using self-supervised objectives and can be subsequently adapted to a variety of downstream applications, which may reduce the number of labeled examples required for any individual task [7]. In structured EHR modeling, patient records are commonly represented as sequences of timestamped clinical events, allowing transformer-based models to learn contextual representations of longitudinal clinical trajectories that can be reused across tasks. Early EHR foundation models, such as BEHRT and Med-BERT, leveraged bidirectional transformer architectures to learn complex patient representations through a self-supervised objective, improving performance across downstream prediction tasks [8, 9].

More recently, decoder-only architectures with generative capabilities have emerged as a promising approach for EHR modeling [10]. These models learn the conditional distribution of future clinical events given a prior patient history, allowing autoregressive generation of patient trajectories. Models such as ETHOS and Curiosity have demonstrated that forecasted patient trajectories can support zero-shot clinical predictions without task-specific training or fine-tuning [11, 12]. Similarly, CLMBR-T, released with the EHRSHOT benchmark, demonstrated that pretrained patient representations can improve sample efficiency across different downstream clinical prediction tasks [7]. However, most existing EHR foundation models rely primarily on demographics, laboratory orders, diagnoses, medications, and procedures, while excluding dense physiological signals, such as vital signs, that convey valuable insight into a patient’s state. Also, numerical values are often discretized into categorical tokens using population-level bins, which can facilitate their inclusion into the autoregressive framework, but it can obscure clinically meaningful variation [11, 12, 13]. It has been demonstrated that the inclusion of numerical values in modeling EHR trajectories can improve the prediction of subsequent clinical events [14]. Besides, discretizing such values can be particularly limiting in pediatric patients, where the interpretation of a given value is strongly age-dependent [15].

Children are severely underrepresented in machine learning research in healthcare [16]. However, pediatrics is an area in which foundation models could offer substantial benefit, since labeled pediatric datasets are typically smaller and clinically relevant outcomes are rare [17, 18]. Additionally, there are significant differences between children and adults in physiology, disease prevalence, treatment response, and expected ranges for common clinical measurements, such as heart rate and respiratory rate [19]. These differences limit the applicability of models developed primarily on adult data, which have been shown to degrade when applied to children [20]. Hence, a model trained directly on pediatric trajectories may better capture patterns of physiology and care that are specific to children [17]. However, pediatric-specific EHR foundation models remain largely unexplored. A systematic review on foundation models for structured EHR published recently found that out of the 53 models available in the literature as of 2025, none of them was pretrained specifically on pediatric data [6]. Earlier this year, a decoder-only pediatric foundation model, TEDDY, was developed using EHR data from a single U.S. pediatric institution [21]. This model largely focused on longitudinal diagnostic codes, whereas pediatric critical care is characterized by rapidly evolving physiological measurements, laboratory values, medications, and interventions that are not captured by diagnosis codes alone, limiting its ability to capture subtle changes in patient state and prioritizing long-horizon new diagnoses predictions.

Methods

Study Design and Data Preprocessing

We conducted a retrospective, multicenter study using longitudinal EHR data from three hospitals that provide specialized pediatric care in the United States. The study population consisted of pediatric hospitalizations, patients <18< 18 years old at admission, occurring between 2010 and 2024, that included at least one admission to the PICU. For each hospitalization, we constructed a clinical trajectory from the start of the encounter to discharge. We used chronologically ordered clinical events, including demographics, encounter events, unit transfers, vital signs, laboratory tests, medications, body measurements, imaging procedures, respiratory procedures (e.g., endotracheal intubation and tracheostomy), and mechanical ventilation settings. It is important to note that even though diagnoses are present in the EHR data in the form of ICD-10 codes, they were not included in this study since they can be assigned and revised after the clinical events they represent, and are generally finalized after discharge. Therefore, the inclusion of ICD-10 codes could introduce data leakage when modeling clinical trajectories [22].

The dataset was partitioned into training, validation, and test splits (85/5/10) at the patient level, therefore, all hospital encounters from a single patient were assigned to the same split to avoid data leakage. We applied a minimal preprocessing pipeline consisting of three steps. The first step was to harmonize the data, unifying variable names and variable units across institutions. The second step consisted of removing outliers for numerical events by discarding data below the 0.5{sup}th percentile and above the 99.5{sup}th percentile. The last step was the normalization of numerical events using zz-score standardization. Before normalization, some predefined variables were transformed using the natural logarithm, i.e., log⁡(x+1)\log(x+1). Also, before normalized numerical values were provided as input to the model, they were additionally clipped to the [−10,10][-10,10] interval to prevent extreme values that remained after outlier removal and improve training stability. Outlier bounds and normalization parameters were computed exclusively using the training split.

This study was approved by the Institutional Review Board of Duke University (Pro00116916).

Tokenization Strategy

We represented each hospitalization as a sequence of interleaved discrete tokens and continuous numerical values. The trajectories begin with a fixed block of five demographic tokens (age group, age in years, ethnicity, sex, and race), followed by chronologically ordered clinical events. The overall tokenization strategy is summarized in Supplementary Table S1.

Clinical Event TypeNumber of TokensTokenization
Demographic
&nbsp;&nbsp;&nbsp;&nbsp;Age1AGE_YEARS_<age_years>
&nbsp;&nbsp;&nbsp;&nbsp;Age Group1AGE_GROUP_<age_group>
&nbsp;&nbsp;&nbsp;&nbsp;Sex1SEX_<sex>
&nbsp;&nbsp;&nbsp;&nbsp;Race1RACE_<race>
&nbsp;&nbsp;&nbsp;&nbsp;Ethnicity1ETHNICITY_<ethnicity>
ED Encounter
&nbsp;&nbsp;&nbsp;&nbsp;Admission1ED_ADMISSION
&nbsp;&nbsp;&nbsp;&nbsp;Discharge1ED_DISCHARGE
Hospital Encounter
&nbsp;&nbsp;&nbsp;&nbsp;Admission2HOSPITAL_ADMISSION<br>INSURANCE_<insurance>
&nbsp;&nbsp;&nbsp;&nbsp;Discharge2HOSPITAL_DISCHARGE<br>DISPOSITION_<disposition>
ICU Encounter
&nbsp;&nbsp;&nbsp;&nbsp;Admission2ICU_ADMISSION<br>TYPE_<icu_type>
&nbsp;&nbsp;&nbsp;&nbsp;Discharge1ICU_DISCHARGE
Unit Transfer
&nbsp;&nbsp;&nbsp;&nbsp;Admission1<UNIT>_ADMISSION
&nbsp;&nbsp;&nbsp;&nbsp;Discharge1<UNIT>_DISCHARGE
Procedure
&nbsp;&nbsp;&nbsp;&nbsp;Respiratory2<PROCEDURE>_placement<br><PROCEDURE>_removal
&nbsp;&nbsp;&nbsp;&nbsp;Imaging2IMG_<modality><br>SITE_<body_part>
Medication5-6MED_<action><br>ROUTE_<administration_route><br>ATC_MAIN_<main_group><br>ATC_THER_<therapeutic_subgroup><br>ATC_PHARM_<pharmacological_subgroup><br>ATC_chem_<chemical_component>
Laboratory Specimen Collection1LAB_TAKEN_<lab_name>
Laboratory Result2LAB_RESULT_<lab_name><br><value>
Vital Sign2VITAL_<vital_name><br><value>
Mechanical Ventilation Setting2SETTING_<setting_name><br><value>
Body Measurement2BODY_MEASUREMENT_<measurement_name><br><value>
Temporal
&nbsp;&nbsp;&nbsp;&nbsp;Sequence Start1TS_START
&nbsp;&nbsp;&nbsp;&nbsp;Interval1DELTA_<interval_bucket>

Table S1. Supplementary Table S1: PedsFM tokenization.

Discrete Clinical Events. Discrete clinical events include demographics, encounter events, unit transfers, laboratory specimen collections, medications, imaging procedures, and respiratory procedures. They were represented by a single token or multiple tokens with a hierarchical structure to keep the vocabulary size small. For example, hospital discharge tokens were always followed by a discharge disposition token. Similarly, imaging procedures were represented by an imaging modality token followed by the corresponding anatomic location token. Finally, medications, which used the Anatomical Therapeutic Chemical (ATC) codes inspired by [11], were the clinical event represented by the largest number of tokens in the following order: medication administration action, administration route, ATC anatomical main group, ATC therapeutic subgroup, ATC pharmacological subgroup, and ATC chemical component if present.

Continuous Clinical Events. Continuous clinical events include vital signs, laboratory results, body measurements, and mechanical ventilation settings. Instead of discretizing the associated numerical values, we represented them as continuous normalized scalars to avoid the loss of clinically meaningful resolution. This is particularly important in pediatrics given the high variability in normal ranges among clinical characteristics across different age groups. As a result, each of the continuous clinical events was represented by two consecutive elements, a discrete token indicating the event type and the corresponding variable name, followed by the normalized continuous value.

Temporal Tokens. There were two different types of temporal tokens: start of the sequence and delta tokens. The first was added after the demographic tokens to indicate the start of the chronologically ordered clinical sequence. Therefore, it appeared only one time per trajectory. The second was assigned when the elapsed time between two consecutive clinical events exceeded five minutes, adapted from [11]. Thus, the appropriate delta token appeared multiple times throughout the trajectory.

Model Architecture

PedsFM leverages the decoder-only transformer architecture to model the conditional distribution of each clinical event given all preceding events in the hospitalization. We used a deterministic routing mechanism to model interleaved discrete and continuous events (see Figure 1). Hybrid autoregressive architectures have been studied for multimodal generation [23] and mixed-type event sequence modeling [14]. PedsFM adapts this dual discrete/continuous prediction heads framework within a single autoregressive sequence for heterogeneous pediatric EHR trajectories, using a language-modeling head for discrete events and a Gaussian mixture model (GMM) head for continuous physiological measurements [23].

PedsFM architecture and evaluation

Figure 1. PedsFM architecture and evaluation. A) Hybrid architecture with different embedding pathways for discrete/continuous input tokens and dual predictions heads for discrete/continuous target tokens. B) Zero-shot evaluation strategies: Monte Carlo rollout-based prediction and query-conditioned GMM scoring. C) Linear probing for representation learning evaluation on downstream tasks.

Problem Formulation. For a hospitalization, let x=(x1,x2,…,xT)\mathbf{x}=(x_1,x_2,\ldots,x_T) denote a chronologically ordered EHR trajectory obtained after applying the proposed tokenization strategy. Each element of the sequence is associated with a routing state ri∈{0,1,2}r_i \in\{0,1,2\}, where ri=0r_i=0 denotes a regular discrete token not associated with a numerical value, ri=1r_i=1 denotes a discrete token that is immediately followed by its associated numerical value, and ri=2r_i=2 denotes the numerical value itself. Let V\mathcal{V} denote the discrete vocabulary. The domain of each trajectory element is determined by the routing state:

xi∈{V,ri∈{0,1},R,ri=2.x_i \in\begin{cases} \mathcal{V}, & r_i \in\{0,1\},\\ \mathbb{R}, & r_i=2. \end{cases}

Therefore, continuous numerical values are elements of the trajectory but are not included in the discrete token vocabulary V\mathcal{V}. PedsFM is trained using next-token prediction to model each element of the trajectory using preceding elements P(x1,…,xT)=∏i=1TP(xi∣x<i)\mathcal{P}(x_1,\ldots,x_T)=\prod_{i=1}^{T}P(x_i\mid x_{<i}).

Input Embedding Pathways. Let dd denote the model dimension and E∈R∣V∣×d\mathbf{E}\in\mathbb{R}^{|\mathcal{V}|\times d} the learned embedding matrix for the discrete vocabulary. For a discrete token xix_i, the input representation is obtained through a learned embedding lookup:

eidisc=E[xi],eidisc∈Rd\mathbf{e}^{\mathrm{disc}}_i=\mathbf{E}[x_i], \qquad\mathbf{e}^{\mathrm{disc}}_i\in\mathbb{R}^{d}

where E[xi]\mathbf{E}[x_i] denotes its corresponding learned embedding vector.

For a continuous value xix_i, the value is first projected into the model dimension:

vi=Wvalxi+bval,vi∈Rd\mathbf{v}_i=\mathbf{W}_{\mathrm{val}}x_i+\mathbf{b}_{\mathrm{val}}, \qquad\mathbf{v}_i\in\mathbb{R}^{d}

where Wval∈Rd×1\mathbf{W}_{\mathrm{val}}\in\mathbb{R}^{d\times1} is a learned projection matrix, and bval∈Rd\mathbf{b}_{\mathrm{val}}\in\mathbb{R}^{d} is a learned bias vector. This transformation maps the numerical value into the model dimension space. The resulting vector is then concatenated with the embedding of the immediately preceding discrete token, ei−1disc\mathbf{e}^{\mathrm{disc}}_{i-1}, and projected again into the model dimension:

einum=Wconcat[vi∥ei−1disc],einum∈Rd\mathbf{e}^{\mathrm{num}}_i=\mathbf{W}_{\mathrm{concat}}\left[\mathbf{v}_i\mathbin{\|}\mathbf{e}^{\mathrm{disc}}_{i-1}\right], \qquad\mathbf{e}^{\mathrm{num}}_i\in\mathbb{R}^{d}

where ∥\mathbin{\|} denotes concatenation and Wconcat∈Rd×2d\mathbf{W}_{\mathrm{concat}}\in\mathbb{R}^{d\times2d}. The concatenated vector belongs to R2d\mathbb{R}^{2d}, and Wconcat\mathbf{W}_{\mathrm{concat}} projects it back into the model dimension.

The final interleaved input embedding is therefore a sequence of eie_i, where

ei={eidisc,if xi is discrete,einum,if xi is continuouse_i = \begin{cases} e_i^{\mathrm{disc}}, & \text{if } x_i \text{ is discrete}, \\ e_i^{\mathrm{num}}, & \text{if } x_i \text{ is continuous} \end{cases}

The inclusion of the embedding of the immediately preceding token into the calculation of the embedding of the corresponding numerical value allows the model to interpret the same normalized value differently depending on the associate clinical variable. Therefore, the same numerical value will have a different representation for heart rate than for blood pressure or a laboratory result.

Transformer Backbone. The sequence of interleaved embeddings is processed by a decoder-only transformer that consists of layers with pre-layer-normalization, multi-head causal self-attention, and a GELU-activated feed forward network (FFN).

Let fTf_T denote the transformer backbone. The contextualized representation at each position ii of the trajectory is given by

hi=fT(e≤i),hi∈Rd\mathbf{h}_i = f_T(\mathbf{e}_{\leq i}), \qquad\mathbf{h}_i \in\mathbb{R}^{d}

where e≤i=(e1,…,ei)\mathbf{e}_{\leq i} = (\mathbf{e}_1, \ldots, \mathbf{e}_i) represents the sequence of input embeddings up to position ii. This causal structure of the model, in which hi\mathbf{h}_i depends only on the preceding trajectory is achieved via the causal attention mask. Additionally, positional information is injected via Rotary Position Embeddings (RoPE) within the attention mechanism.

Dual Prediction Heads. The model uses two complementary output heads, a language modeling head and a GMM head, depending on whether the target is discrete or continuous, respectively. Let hi∈Rd\mathbf{h}_i \in\mathbb{R}^{d} denote the representation produced by the transformer at position ii.

For a discrete target, the language modeling (LM) head projects the hidden representation to logits over the discrete vocabulary:

zi=WLMhi,zi∈R∣V∣\mathbf{z}_i = \mathbf{W}_{\mathrm{LM}}\mathbf{h}_i, \qquad\mathbf{z}_i \in\mathbb{R}^{|\mathcal{V}|}

where WLM∈R∣V∣×d\mathbf{W}_{\mathrm{LM}} \in\mathbb{R}^{|\mathcal{V}| \times d} is the output projection matrix. The corresponding categorical distribution is

qi=softmax⁡(zi),qi∈R∣V∣\mathbf{q}_i = \operatorname{softmax}(\mathbf{z}_i), \qquad\mathbf{q}_i \in\mathbb{R}^{|\mathcal{V}|}

where qi,vq_{i,v} represents the predicted probability of discrete token v∈Vv \in\mathcal{V}.

For a continuous target, the GMM head maps the hidden representation to the parameters of a Gaussian mixture distribution with KK components. Therefore, there are 3K3K outputs in total

[μiσ~iαi]=WGMMhi+bGMM,\begin{bmatrix} \boldsymbol{\mu}_i \\ \widetilde{\boldsymbol{\sigma}}_i \\ \boldsymbol{\alpha}_i \end{bmatrix} = \mathbf{W}_{\mathrm{GMM}}\mathbf{h}_i + \mathbf{b}_{\mathrm{GMM}},

where WGMM∈R3K×d\mathbf{W}_{\mathrm{GMM}} \in\mathbb{R}^{3K \times d} and bGMM∈R3K\mathbf{b}_{\mathrm{GMM}} \in\mathbb{R}^{3K} are learned parameters and μi,σ~i,αi∈RK\boldsymbol{\mu}_i, \widetilde{\boldsymbol{\sigma}}_i, \boldsymbol{\alpha}_i \in\mathbb{R}^{K}. The component standard deviations and mixture weights are then obtained as

σi=softplus⁡(σ~i)+ϵ,\sigma_i = \operatorname{softplus}(\widetilde{\sigma}_i) + \epsilon,
πi=softmax⁡(αi).\boldsymbol{\pi}_i = \operatorname{softmax}(\boldsymbol{\alpha}_i).

The predictive distribution for the next element xi+1x_{i+1} is selected deterministically according to the routing state of the current element xix_i, as explained above. When ri=1r_i = 1, xix_i is a discrete token associated with a numerical value, therefore, xi+1∈Rx_{i+1} \in\mathbb{R} is obtained through the GMM head. Otherwise, if ri∈{0,2}r_i \in\{0, 2\}, the target is a discrete token obtained through the language modeling head:

p(xi+1∣x≤i)={∑k=1Kπi,kN(xi+1;μi,k,σi,k2),ri=1,qi,xi+1,ri∈{0,2}.p(x_{i+1} \mid x_{\leq i}) = \begin{cases} \sum_{k=1}^{K} \pi_{i,k}\mathcal{N}(x_{i+1};\mu_{i,k},\sigma_{i,k}^{2}), & r_i=1,\\ q_{i,x_{i+1}}, & r_i\in\{0,2\}. \end{cases}

Model Training

The autoregressive model was trained end-to-end with next-token prediction as its self-supervised objective, jointly optimizing discrete event prediction and continuous value density estimation.

Let D={i:xi+1∈V}\mathcal{D}=\{i:x_{i+1}\in\mathcal{V}\} denote the trajectory positions for which the target is discrete, and let C={i:ri=1}\mathcal{C}=\{i:r_i=1\} denote the positions for which the target is continuous. For discrete targets, we computed the focal loss LFL\mathcal{L}_{\mathrm{FL}} defined as

LFL=−1∣D∣∑i∈D(1−qi,xi+1)γlog⁡qi,xi+1.\mathcal{L}_{\mathrm{FL}}=-\frac{1}{|\mathcal{D}|}\sum_{i\in\mathcal{D}}(1-q_{i,x_{i+1}})^{\gamma}\log q_{i,x_{i+1}}.

where γ\gamma is the modulating factor used to reduce the dominance of frequent and easily predicted clinical events.

For continuous targets, we computed the negative log-likelihood LNLL\mathcal{L}_{\mathrm{NLL}}, defined as

LNLL=−1∣C∣∑i∈Clog⁡[∑k=1Kπi,k12πσi,kexp⁡(−(xi+1−μi,k)22σi,k2)]\mathcal{L}_{\mathrm{NLL}}=-\frac{1}{|\mathcal{C}|}\sum_{i\in\mathcal{C}}\log\left[\sum_{k=1}^{K}\pi_{i,k}\frac{1}{\sqrt{2\pi}\sigma_{i,k}}\exp\left(-\frac{(x_{i+1}-\mu_{i,k})^2}{2\sigma_{i,k}^2}\right)\right]

Overall, the total loss at each training step is

L=LFL+λLNLL\mathcal{L}=\mathcal{L}_{\mathrm{FL}}+\lambda\mathcal{L}_{\mathrm{NLL}}

where LFL\mathcal{L}_{\mathrm{FL}} is the focal loss applied to the language modeling head logits at discrete targets, and LNLL\mathcal{L}_{\mathrm{NLL}} is the negative log-likelihood of the ground-truth continuous value under the predicted GMM density weighted by λ\lambda.

Inference and Trajectory Generation

At inference time, PedsFM generates trajectories autoregressively. For discrete targets, the next token is sampled using multinomial sampling from the temperature-scaled categorical distribution produced by the language modeling head. For continuous targets, the next trajectory element is sampled from the predicted Gaussian mixture distribution. The sampled value is mapped to the original clinical scale, reverting the normalization. Additionally, we implemented a repetition penalty mechanism to prevent the model from becoming trapped in repetitive cycles during long rollouts (see Supplementary Methods).

Inference Stopping Criteria. The autoregressive generation ends when one of the stopping criteria is met: 1) maximum number of tokens generated, 2) predefined stopping token encountered, 3) end of sequence token encountered, and 4) time horizon exceeded. For the last criterion, the time progression is calculated using the lower (t1t_1) and upper (t2t_2) bounds of the delta tokens as follows,

Δt=t1×t2.\Delta t=\sqrt{t_1\times t_2}.

This corresponds to the geometric midpoint of the interval represented by the temporal tokens [12].

Model Evaluation

We evaluate the pretrained PedsFM along three complementary axes on the test split: generative plausibility, zero-shot probabilistic prediction of clinically relevant outcomes, and representation learning via linear probing on frozen embeddings. The temperature was set to 0.5 for all evaluation tasks.

Zero-shot Prediction

Monte Carlo Rollout-Based Prediction. From a fixed anchor point in a patient’s trajectory, PedsFM autoregressively generates NN continuations by sampling from its predicted token and GMM distributions at each step. The evaluated outcome probability is estimated as the fraction of NN simulated rollouts in which the event of interest, represented by a discrete token, occurs. This approach is used for outcomes that unfold over a prediction window and depend on the joint trajectory of many variables, such as early mortality and vasopressor initiation.

Query-Conditioned GMM Scoring. Instead of generating multiple future tokens, the patient trajectory is extended with task-specific query tokens, and a single forward pass through PedsFM yields the GMM head parameters for the next trajectory element at that query position. Because the GMM head models a full continuous distribution rather than a point estimate, this single pass is sufficient to compute the expected value, or an upper or lower tail probability for any clinically defined threshold τ\tau, without sampling. It is important to note that this approach is exclusively used for continuous outcomes tied to a single measurement, such as a specific collection of laboratory samples.

Given the predicted Gaussian mixture distribution, the expected standardized value is

E[X∣h]=∑k=1Kπkμk.\mathbb{E}[X\mid\mathbf{h}]=\sum_{k=1}^{K}\pi_k\mu_k.

For an upper tail probability prediction, using a defined clinical threshold τ\tau normalized like the numerical values, an upper-tail probability is

P(X≥τ∣h)=∑k=1Kπk[1−Φ(τ−μkσk)],P(X \ge\tau\mid\mathbf{h}) = \sum_{k=1}^{K} \pi_k \left[1-\Phi\left(\frac{\tau-\mu_k}{\sigma_k}\right)\right],

while a lower-tail probability is

P(X<τ∗∣h)=∑k=1KπkΦ(τ∗−μkσk),P(X < \tau^* \mid\mathbf{h}) = \sum_{k=1}^{K} \pi_k \Phi\left(\frac{\tau^*-\mu_k}{\sigma_k}\right),

where Φ\Phi denotes the standard normal cumulative distribution function.

Representation Learning

In addition to the generative capabilities evaluated with the zero-shot approach, we assessed the representations learned with PedsFM and whether they were clinically informative. We evaluated two alternative representations: 1) the average of the last hidden state, applying mean-pooling across all sequence positions, and 2) the last hidden state at the final sequence position. The second is the commonly chosen approach in generative EHR foundation models [7, 24].

For a trajectory of length LL, represented by LL hidden states, these representations are

z=1L∑i=1Lhi\mathbf{z} = \frac{1}{L}\sum_{i=1}^{L}\mathbf{h}_i

and

z=hL,\mathbf{z} = \mathbf{h}_L,

where z∈Rd\mathbf{z} \in\mathbb{R}^{d}.

These representations were extracted from the frozen pretrained PedsFM, and served as the input to a logistic regression classifier that was trained for each downstream task. Besides a fully supervised linear probe, we assessed sample efficiency by training the logistic regression using progressively larger subsets of the training split.

Vital Signs Plausibility Analysis

The plausibility analysis of the vital signs was conducted by comparing the generated vital signs to the actual observed measurements, computing the Pearson correlation rr and the mean absolute error (MAE). This assessment used the Monte Carlo rollout-based prediction with N=10N = 10, using the first 12 hours of hospital admission to generate the following 12 hours and calculate the average for each vital sign. As a reference baseline, we used the last-seen-value carry forward, method commonly used for handling missing data in EHR modeling [25].

Additionally, we conducted an analysis to assess the learned associations of well characterized and represented medication-vital pairs for a subset of 1,000 hospitalizations from the test split that did not have any medication administrations within the first 12 hours of admission. Specifically, we studied epinephrine-heart rate, and fentanyl-respiratory rate. For each pair, we used the query-conditioned GMM scoring anchored to the first 12 hours of admission to generate the corresponding unconditioned and conditioned vital sign measurement. More specifically, for the unconditioned generation, we appended two query tokens, DELTA_5min-15min, VITAL_<<vital>> to the trajectory seed, and calculated the expected value of the evaluated vital, E[vital]\mathbb{E}[vital], from the generated distribution. Similarly, for the conditioned generation, we followed the same process, but we artificially appended the selected medication tokens, either one or multiple times, before the two query tokens.

It is important to note that this analysis is intended as an internal consistency check of the model, evaluating whether PedsFM learned pharmacologically expected directional shifts, e.g., increased heart rate following epinephrine administration and decreased respiratory rate following fentanyl administration. It does not constitute a study or claim of causal drug effect.

Downstream Tasks

We selected tasks representative of three complementary task types: outcome tasks, which predict a terminal or adverse clinical endpoint; intervention tasks, which predict the initiation of a clinical intervention; and physiological tasks, which predict the value of a physiological measurement. More specifically, we evaluated early in-hospital mortality, early vasopressor initiation, and laboratory abnormalities: lactate ≥5\ge5 mmol/L, platelets <100×103/μL< 100 \times10^{3}/\mu\mathrm{L}, glucose >150> 150 mg/dL, and total bilirubin ≥4\ge4 mg/dL. All downstream tasks required a hospital admission of at least 24 hours and only considered events that occurred within the first seven days of admission.

Early In-Hospital Mortality. Early in-hospital mortality was defined as death occurring within the first seven days of admission. Such encounters constituted the cases; and the rest, mortality after day seven, short and long stays, were the controls. We used the Monte Carlo rollout-based prediction, estimating mortality probability as the fraction of the generated continuations in which the death token appears, i.e., Nexpired/NtotalN_{\mathit{expired}}/N_{\mathit{total}} with Ntotal=20N_{\mathit{total}} = 20. The prediction time was 24 hours after admission, and trajectories were generated until they exceeded a time limit of seven days or a death token was generated. To avoid noisy labels, encounters with a discharge disposition of end-of-life care or unknown were excluded from this task.

Early Vasopressor Initiation. Early vasopressor initiation was defined as an initial administration of epinephrine, norepinephrine, dopamine, phenylephrine, or vasopressin during the first 24 hours of admission. We used the Monte Carlo rollout-based prediction, estimating the probability of early vasopressor initiation as the fraction of Ntotal=20N_{\mathit{total}} = 20 generated continuations in which the vasopressors hierarchical tokens appear. The prediction time was six hours after hospital admission and trajectories were generated until they exceeded a time limit of 18 hours. Additionally, hospitalizations with a vasopressor initiation within the first six hours of admission were excluded from this task.

Lab Abnormalities. Lab abnormalities were selected using clinically relevant organ dysfunction thresholds from the Phoenix criteria and expanded Phoenix-8 criteria [26]. Lactate ≥5\ge5 mmol/L, platelets <100×103/μL< 100 \times10^{3}/\mu\mathrm{L}, glucose >150> 150 mg/dL, and total bilirubin ≥4\ge4 mg/dL were evaluated in this task. The glucose threshold corresponds specifically to the upper abnormality threshold of the endocrine component, for which glucose <50< 50 mg/dL or >150> 150 mg/dL is considered abnormal. We used query-conditioned GMM scoring, computing the upper or lower tail probability directly from the GMM head parameters at the specimen collection timestamp. The query tokens were the delta token DELTA_15min-1h and a laboratory-specific result token LAB_RESULT_<lab> appended. All laboratory tests within the first seven days of admission were treated as separate prediction instances anchored to their specimen collection timestamp, which preceded the recorded result by a median of 29 minutes.

Baseline Model

A fully supervised task-specific XGBoost was selected as the baseline model for performance comparison with PedsFM zero-shot performance and learned representations. In previous studies, XGBoost has been demonstrated to be the strongest baseline model for EHR-based tasks [27, 11, 12]. Since the selected baseline is not suitable for sequential data, we extracted summary features from the clinical trajectories available before the task-specific prediction time. We aggregated the discrete events using counts, following a bag-of-words (BoW) approach, and the numerical values using the mean, median, minimum, maximum, and standard deviation.

Statistical Analysis

We evaluated the performance of all the studied models using the Area Under the Receiver Operating Characteristic Curve (AUROC) and the Area Under the Precision-Recall Curve (AUPRC). For the plausibility analysis, we used the Pearson correlation (rr) and the mean absolute error (MAE). Additionally, for all reported results, 95% confidence intervals were computed via bootstrap resampling. Finally, non-parametric paired comparisons were conducted using the Wilcoxon signed-rank test, with p<0.05p < 0.05 considered statistically significant.

Results

Cohort Characteristics

The multicenter cohort included 76,652 hospitalizations from 56,655 unique pediatric patients across three hospitals. For patients with multiple hospitalizations, each of them was included as an independent observation. The demographic characteristics are summarized in Table 1, grouped by train, test, and validation splits. The median age at admission was 4 years (IQR, 1–11), and 55.1% of hospitalizations were male patients. Additionally, all pediatric age groups were represented, with adolescents contributing the largest group (23.7%) of hospitalizations and neonates the smallest (3.6%).

CharacteristicCategoryOverallTrainValidationTest
Age, yearsMedian (IQR)4 (1–11)4 (1–11)4 (1–11)4 (1–11)
Age groupNeonate2,773 (3.6%)2,366 (3.6%)139 (3.7%)268 (3.5%)
Age groupInfant15,159 (19.8%)12,870 (19.7%)753 (20.1%)1,536 (20.0%)
Age groupToddler14,809 (19.3%)12,575 (19.3%)753 (20.1%)1,481 (19.3%)
Age groupPreschooler10,625 (13.9%)9,085 (13.9%)533 (14.2%)1,007 (13.1%)
Age groupSchool age15,127 (19.7%)12,871 (19.7%)710 (19.0%)1,546 (20.1%)
Age groupAdolescent18,159 (23.7%)15,461 (23.7%)854 (22.8%)1,844 (24.0%)
SexFemale34,397 (44.9%)29,216 (44.8%)1,714 (45.8%)3,467 (45.1%)
SexMale42,252 (55.1%)36,010 (55.2%)2,028 (54.2%)4,214 (54.9%)
SexUnknown3 (<0.1%)2 (<0.1%)0 (0.0%)1 (<0.1%)
RaceAmerican Indian336 (0.4%)283 (0.4%)14 (0.4%)39 (0.5%)
RaceAsian2,259 (2.9%)1,929 (3.0%)102 (2.7%)228 (3.0%)
RaceBlack29,391 (38.3%)24,884 (38.1%)1,518 (40.6%)2,989 (38.9%)
RacePacific Islander104 (0.1%)80 (0.1%)7 (0.2%)17 (0.2%)
RaceWhite30,822 (40.2%)26,239 (40.2%)1,489 (39.8%)3,094 (40.3%)
RaceOther6,223 (8.1%)5,331 (8.2%)300 (8.0%)592 (7.7%)
RaceUnknown7,517 (9.8%)6,482 (9.9%)312 (8.3%)723 (9.4%)
EthnicityHispanic10,398 (13.6%)8,927 (13.7%)452 (12.1%)1,019 (13.3%)
EthnicityNon-Hispanic62,116 (81.0%)52,770 (80.9%)3,092 (82.6%)6,254 (81.4%)
EthnicityUnknown4,138 (5.4%)3,531 (5.4%)198 (5.3%)409 (5.3%)
Total76,65265,2283,7427,682

Table 1. Demographic characteristics of the study cohort across the training, validation, and test splits at the hospital encounter level.

Patient-level partitioning yielded 65,228 training, 3,742 validation, and 7,682 test hospitalizations. Additionally, harmonizing and tokenizing the EHR data to obtain the clinical trajectories resulted in a total of 280.65 million tokens, of which 237.41 million were used to train the model, and a vocabulary of 510 unique discrete tokens.

PedsFM Training and Inference

The selected PedsFM configuration consisted of 12 transformer decoder layers, 12 attention heads, a hidden dimension of 768, and a context size of 8,192, for a total of 86.57 million parameters (see architecture details and training specifications in Supplementary Table S2). Additionally, FlashAttention was used to improve efficiency. The model was trained for approximately 48 hours on two NVIDIA H200 GPUs using distributed data parallelism (DDP). At inference time, autoregressive generation required approximately 4 seconds per 1,000 generated tokens on a single NVIDIA H200 GPU.

To assess whether the model learned clinical structure in its discrete token vocabulary, we visualized the learned embedding vectors for all discrete tokens using UMAP (see Supplemental Figure S1). Despite being trained only on self-supervised next-token prediction, the model learned token representations that clustered by clinical category, with medication tokens forming the largest and most distinct cluster, and laboratory-related tokens (lab results, specimen collection) forming a separate, adjacent cluster alongside vital signs. Additionally, for some categories like demographics and imaging procedures, distinct clusters formed within the category based on semantic similarity, e.g., clusters for the different types of demographic data and age groups. This separation suggests that the model organizes its discrete vocabulary along clinically meaningful axes without any explicit category supervision.

Vital Signs Plausibility and Pharmacological Associations

We assessed the physiological plausibility of the generated trajectories by generating the next 12 hours of the clinical trajectory, anchored at hour 12 after hospital admission. In general, the generated vital signs are consistent with the observed measurements. Compared to the last-seen-value carry-forward baseline, PedsFM generations showed comparable or higher correlation and lower MAE for heart rate (r=0.88r = 0.88 vs. 0.850.85; MAE =9.73= 9.73 vs. 11.9011.90 bpm), respiratory rate (r=0.83r = 0.83 vs. 0.810.81; MAE =4.34= 4.34 vs. 4.964.96 breaths/min), systolic blood pressure, diastolic blood pressure, mean arterial pressure (MAP), and temperature (see Supplementary Table S3). SpO2\mathrm{SpO}_2 was the only vital sign for which the carry-forward baseline showed better agreement with observed values, likely reflecting the narrow, ceiling-skewed distribution of this variable, which favors a naive approach such as carry-forward. In general, these results support the physiological plausibility of the generated measurements.

The medication-conditioning analysis also produced directionally expected shifts in the predicted vitals distributions (see Figure 2). Conditioning generation on epinephrine administration increased the predicted heart rate by an average of 2.14 bpm (95% CI 1.95, 2.34 bpm). Repeated epinephrine conditioning, assessed by adding four consecutive administration token sets, increased it by 7.86 bpm (7.46, 8.30 bpm). For the respiratory rate, conditioning on fentanyl shifted the predictions downward, with an average decrease of 0.72 breaths/min (−0.80-0.80, −0.64-0.64 breaths/min) and 1.15 breaths/min (−1.28-1.28, −1.02-1.02 breaths/min) under repeated conditioning. Because the medication dose was not represented in the trajectories, these results should be interpreted as sensitivity to repeated medication conditioning rather than as a pharmacologic dose response relationship.

Vital sign generation analysis and learned associations assessment results

Figure 2. Vital sign generation analysis and learned associations assessment results. A) Scatter plots of generated vital signs vs. actual observed measurements for heart rate (top) and respiratory rate (bottom), comparing Monte Carlo rollout (left, red) to the last-seen-value carry-forward baseline (right, blue). Dashed line indicates perfect agreement (y=xy = x). Pearson correlation (r) and mean absolute error (MAE) are reported. B) Generated heart rate (top) and respiratory rate (bottom) distributions under unconditioned generation (red) vs. generation conditioned on a medication (blue) or four-fold conditioning (green) of the corresponding medication. Δ\Delta indicates the shift in mean vital sign value relative to the unconditioned distribution.

Interestingly, the epinephrine-associated shift was more pronounced at lower baseline heart rate values, whereas the fentanyl-associated shift was greater at higher baseline respiratory rates. These baseline-dependent responses are physiologically plausible, as patients with lower heart rates have greater capacity for a detectable response, while fentanyl-induced respiratory suppression may be more evident among patients with initially elevated respiratory rates. This evaluation was statistically significant with p<0.01p < 0.01 for both vitals.

Downstream Tasks Performance

Zero-shot results demonstrated performance above chance across all evaluated tasks for both AUROC and AUPRC. For early in-hospital mortality and vasopressor initiation, zero-shot Monte Carlo rollout achieved an AUROC of 0.868 and an AUPRC of 0.260, and an AUROC of 0.814 and an AUPRC of 0.643, respectively. The fully supervised XGBoost models achieved higher performance for both tasks, with AUROC and AUPRC values of 0.952 and 0.627 for mortality, and 0.949 and 0.807 for vasopressor initiation (see Table 2). Nevertheless, the zero-shot results showed that PedsFM could identify patients at increased risk without task-specific training (see Supplementary Figure S2). For the four laboratory abnormality tasks, evaluated using query-conditioned GMM scoring, zero-shot outperformed a fully supervised XGBoost with AUROC/AUPRC values of 0.954/0.912 for lactate, 0.976/0.907 for platelets, 0.988/0.935 for total bilirubin, and 0.877/0.664 for glucose. The strongest discrimination was observed for bilirubin and platelets, while glucose remained the most challenging laboratory outcome. The differences between the rollout-based outcome tasks and the query-conditioned laboratory tasks reflect some methodological differences. Extended autoregressive rollouts introduce sampling variability, and the prediction errors propagate and accumulate through the generated trajectories. On the other hand, query-conditioned GMM scoring obtain the required conditional distribution in a single forward pass. However, it is not possible to attribute the performance differences exclusively to the inference strategy because the evaluated tasks also differ in prevalence, prediction horizon, target type, and alignment with the pretraining objective.

Prediction TaskZero-shot PedsFM AUROCZero-shot PedsFM AUPRCXGBoost AUROCXGBoost AUPRC
Early In-hospital Mortality Prevalence: 1.0%0.868 [0.812–0.919]0.260 [0.167–0.370]0.960 [0.937–0.980]0.594 [0.470–0.709]
Early Vasopressor Initiation Prevalence: 5.7%0.814 [0.786–0.841]0.643 [0.598–0.687]0.947 [0.933–0.957]0.790 [0.754–0.823]
Abnormal Lactate Prevalence: 30.3%0.954 [0.945–0.962]0.912 [0.895–0.926]0.930 [0.916–0.940]0.874 [0.849–0.896]
Abnormal Platelets Prevalence: 17.1%0.976 [0.973–0.979]0.907 [0.896–0.917]0.959 [0.956–0.963]0.852 [0.840–0.865]
Abnormal Bilirubin Prevalence: 10.0%0.988 [0.984–0.991]0.935 [0.922–0.947]0.979 [0.974–0.984]0.902 [0.886–0.916]
Abnormal Glucose Prevalence: 18.4%0.877 [0.871–0.883]0.664 [0.647–0.680]0.835 [0.828–0.842]0.591 [0.574–0.608]

Table 2. Comparison of zero-shot PedsFM performance and a fully supervised task-specific XGBoost baseline on downstream prediction tasks.

Additionally, we evaluated whether representations learned by PedsFM were clinically uninformative when used as input to a linear probe (see Supplementary Figure S3). For some of the evaluated tasks, linear probes trained on frozen PedsFM embeddings approached the performance of the corresponding fully supervised XGBoost baseline. Interestingly, mean-pooled representations consistently outperformed the last-token representation across all tasks, which suggests that information relevant to downstream prediction was distributed throughout the dense clinical sequence rather than being fully summarized by its final token despite the causal attention architecture. For early in-hospital mortality and vasopressors initiation prediction, linear probes on PedsFM representations achieved performance comparable to the fully supervised XGBoost baseline and substantially higher than zero-shot rollout prediction, particularly in AUPRC. Additionally, linear probes outperformed XGBoost on limited training samples, suggesting sample efficiency gains introduced by the pretrained model. In contrast, the linear probes improved more gradually for the laboratory tasks, and remained below both query-conditioned GMM scoring and XGBoost, even with all labeled training samples. These results suggest that aggregated representations effectively summarize the broader patient state associated with clinical outcomes and interventions, whereas laboratory abnormalities are more directly captured by the generative continuous-value pathway. Therefore, the GMM head was better suited to representing the measurement-specific and threshold-dependent variation that was not easily separable by the logistic regression classifier applied to the latent trajectory representation.

Discussion

This study introduces PedsFM, a pediatric-specific generative foundation model that jointly generates discrete clinical events and continuous physiological measurements. Using a single transformer decoder architecture that leverages deterministic pathways, the model learned from critical care clinical trajectories, which are dense and heterogeneous, while preserving continuous physiological measurements at their original numerical resolution. Therefore, there are two main differences between PedsFM and most existing EHR foundation models. First, the numerical values in our trajectories do not require discretization, which is particularly important in pediatrics, where the interpretation of a numerical value can vary substantially with age [28]. Second, unlike existing models that heavily rely on diagnoses, procedures, medication orders, and other relatively sparse events, we preserved dense physiological information by including the vital signs [6, 7]. We trained and evaluated the model on data from three hospitals with pediatric-specific facilities, and we centered our evaluation around the prediction of relevant clinical events that could potentially provide actionable insights to clinicians. Despite focusing on the generative capabilities of the model, we also assessed the representations learned during the pretraining for multiple downstream tasks. Additionally, we evaluated the model using complementary approaches, such as plausibility of vital signs and medication–physiology associations, that allowed us to have a broader assessment than discrimination metrics alone.

The physiological evaluation showed that PedsFM learned clinically meaningful conditional relationships rather than simply memorizing common vital sign values present in the data. Generated heart rate, respiratory rate, blood pressure, and temperature measurements were overall more consistent with subsequently observed values than a last-seen-value carry-forward baseline. The exception was SpO2\mathrm{SpO}_2, for which the narrow and ceiling-skewed distribution may have favored the carry-forward baseline. The inclusion of additional, complementary distributions in the mixture density will be studied in future work as it may be useful to model some of the skewed or physiologically bounded continuous variables. Conditioning the model on epinephrine shifted the predicted heart rate distribution upward, whereas conditioning it on fentanyl shifted the predicted respiratory rate distribution slightly downward [29, 30]. The larger shifts observed under repeated medication conditioning, together with their dependence on the baseline physiological state, suggest that the model captured contextual and nonlinear associations between medications and physiology. Hence, these experiments constitute an important model consistency and plausibility check that could be adopted as a complementary evaluation to standard discriminatory metrics. However, it is important to note that this is not a counterfactual analysis and does not imply a causal effect since the model was trained on observational data and multiple confounding factors may exist.

Additionally, in evaluating our model, we identified a contrast between how zero-shot generations and linear-probing performed across downstream tasks. Linear probes on frozen PedsFM representations achieved comparable performance to XGBoost for early mortality and vasopressors initiation prediction, but remained below zero-shot query-conditioned GMM scoring for all four laboratory abnormality tasks, even with the full training set available. We interpret this not as a weakness of the representation but as an indication that clinical tasks of different nature may demand different encoding mechanisms and clinical context for dense and heterogeneous trajectories like the ones observed in the PICU. In this case, mortality and vasopressors initiation are macro, cumulative endpoints that reflect an accumulation of information across physiological systems, interventions, and time, besides having a longer prediction horizon. These outcomes may be effectively represented by vector embeddings that summarize the patient state, and are separable by a linear boundary. On the other hand, laboratory values are dynamic, continuous variables, and the associated prediction task, i.e., prediction of abnormal laboratory results, is threshold-dependent, has a shorter and more uniform prediction horizon, and it is more aligned with the pretraining objective. Query-conditioned GMM scoring preserves the measurement-specific context and the full conditional distribution at the relevant position in the sequence, resulting in a strong performance for the four laboratory tasks. Similarly, the measurement-specific context is explicitly included in the features extracted to train the XGBoost baseline, which results in increased performance in these tasks when compared to the representations. Nonetheless, the zero-shot rollout strategy achieved a substantial fold improvement over the prevalence baseline without additional training for early in-hospital mortality and vasopressors initiation. The model assigned progressively higher predicted risk across clinically meaningful outcome groups, with the highest risk observed among patients who died within the first seven days of admission, followed by those who died after seven days, patients with prolonged hospital stays, and finally patients with short hospital stays.

An interesting finding derived from our downstream task evaluations was that mean-pooled representations consistently outperformed last-token representations. This is an important difference from previous work. Existing decoder-only clinical foundation models generally extract the final hidden state as the patient-level representation [7, 31]. Because causal attention allows the final position to attend to all preceding tokens, it is assumed that it effectively summarizes the clinical trajectory. However, our results suggest that, for dense longitudinal EHR trajectories, aggregating information across the entire sequence preserves relevant information for the downstream tasks that was not captured as effectively by the last token representation. Alternative strategies such as learned attention-pooling, temporally weighted aggregation, or hierarchical trajectory representations may further improve the extraction of the patient state in future work.

It is important to interpret these results in light of the dataset scale. Recent large-scale EHR foundation models, such as Curiosity [12], trained on Epic Cosmos data that contains over 150 billion tokens across multiple healthcare institutions, demonstrated that increasing model and training dataset size yielded better results for different downstream tasks, consistent with scaling behavior first characterized in general-purpose language models [32]. The dataset created in this work is several orders of magnitude below Cosmos, with 237 million training tokens drawn from approximately 65,000 hospitalizations. PICU admissions in particular are rarer and more heterogeneous across developmental stages than adult hospitalizations, concentrated in a smaller number of specialized centers, and overall, children are severely underrepresented in publicly available datasets [18]. Given the previously studied scaling relationships, it is possible that our zero-shot rollout performance on long horizon, low prevalence outcomes, such as in-hospital mortality reflects this data ceiling. However, with our pediatric-specific dataset, we demonstrated the potential and strengths of the proposed architecture for different critical care applications. Currently, we are working on the creation of an extensive pediatric corpora that helps close this data gap. Nonetheless, pediatric resources will remain constrained in terms of size relative to adult datasets.

This work has some limitations. The cohort, while multisite, remains limited to three hospitals, and independent external validation is required to assess generalizability to institutions with different populations, workflows, and intervention practices. In addition, as mentioned above, our dataset is size-constrained relative to existing EHR foundation model studies. We expect to mitigate these limitations with data from additional pediatric sites, which is an ongoing effort. Also, we exclusively included structured EHR data in our trajectories; however, leveraging the routing mechanism combined with alternative tokenization strategies, additional modalities could be included in the clinical trajectories to have a more complete representation of the patient. Finally, although PedsFM preserves the native resolution of physiologic measurements, it discretizes the temporal component. In future work, we will explore alternative approaches to encode the clinical event times in the trajectories to achieve more granularity and precision.

Conclusion

PedsFM presents a unified approach to jointly model discrete and continuous clinical events, enabling the extraction of clinically useful information from critical care trajectories without requiring task-specific training. This work could help the advance the progress of EHR modeling in pediatrics, and encourage the development of adaptable and scalable decision support tools. External validation and prospective evaluation are necessary to evaluate the performance of the model in providing clinically actionable insights.

Data Availability

The studied dataset is not publicly available due to patient privacy restrictions.

Author Contributions

R.K. and D.C. conceived the study. D.C. designed the methodology, processed the data, developed the foundation model, conducted the experiments, analyzed the results, drafted and edited the manuscript. B.A., M.A., T.I., and K.N. assisted with the evaluation framework, interpretation of the results, and edited the manuscript. H.F and N.S assisted with the clinical interpretation and edited the manuscript. A.R., C.H., I.K., J.M., M.W., A.K., S.C., J.L., C.R., S.B., and R.K. assisted with interpreting the data and edited the manuscript. All authors approved the final version of this manuscript.

Supplementary Methods

Tokenization Details

Our tokenization strategy, combined with our data harmonization pipeline, attempted to minimize the number of unique tokens required to represent clinical events and patient trajectories, and to facilitate cross-institution adoption. This strategy resulted in a discrete vocabulary size of 510 unique tokens, and infinite numeric values. See Supplementary Table S1 for event-specific tokenization structure.

Inference Repetition Penalty

During inference, at each generation step, the logits of discrete tokens that recently appeared within a selected window, i.e., the most recent xx positions, were down-weighted by a selected factor >0> 0, reducing their sampling probability. Temporal tokens were excluded from the penalty since their recurrence is required to represent the intervals between consecutive clinical events. This repetition penalty discouraged the model from repeatedly sampling the same non-temporal discrete tokens, mitigating degenerate loops.

Supplementary Results

PedsFM Specifications

Architecture configuration and training specifications are included in Supplementary Table S2.

SpecificationValue
Transformer layers12
Attention heads12
Hidden dimension768
Feed-forward dimension3,072
GMM components12
Dropout0.20
Maximum context length8,192 tokens
Total parameters86.57 million
Discrete-token lossFocal loss (γ=2.0\gamma= 2.0)
Continuous-value lossNLL
OptimizerAdamW
Initial learning rate5×10−55 \times10^{-5}
Batch size32
Learning-rate schedulerReduce on Plateau
Gradient clipping norm1.0

Table S2. PedsFM architecture and training configuration.

Discrete Token Embedding Space

UMAP visualization of the discrete embedding vectors for 25 neighbors, minimum distance between points of 0.1, and cosine as the distance metric are depicted in Supplementary Figure S1. Clusters were consistent across different UMAP configurations.

UMAP projection of learned discrete token embedding vectors and visualizations of demographic and imaging procedure subgroups

Figure S1. A) UMAP projection of the learned embedding vectors for all discrete vocabulary tokens, colored by token category, e.g., vital sign, lab result, medication, demographic, encounter type). B) Individual visualization of two token subgroups, demographic tokens (top) and imaging procedures (bottom).

Vital Signs Plausibility Analysis

Pearson correlation (rr) and mean absolute error (MAE) for all generated vs. observed vitals are included in Supplementary Table S3.

Vital Sign (Units)Generated rrGenerated MAELast-Seen-Value rrLast-Seen-Value MAE
Heart Rate (bpm)0.88 [0.87–0.88]9.73 [9.55–9.92]0.85 [0.84–0.86]11.90 [11.66–12.17]
Respiratory Rate (breaths/min)0.83 [0.82–0.84]4.34 [4.23–4.44]0.81 [0.80–0.82]4.96 [4.84–5.09]
Systolic Blood Pressure (mmHg)0.76 [0.75–0.77]6.66 [6.52–6.81]0.70 [0.69–0.72]8.74 [8.56–8.92]
Diastolic Blood Pressure (mmHg)0.65 [0.63–0.67]6.80 [6.67–6.94]0.56 [0.54–0.58]9.46 [9.25–9.66]
MAP (mmHg)0.69 [0.67–0.70]6.39 [6.26–6.51]0.60 [0.59–0.62]8.50 [8.32–8.68]
SpO2\mathrm{SpO}_2 (%)0.38 [0.33–0.43]2.01 [1.95–2.08]0.60 [0.57–0.64]1.43 [1.40–1.47]
Temperature (°C)0.54 [0.51–0.56]0.32 [0.31–0.33]0.54 [0.52–0.57]0.39 [0.38–0.40]

Table S3. Correlation analysis results of generated vital sign predictions and last-seen-value baseline comparison. Values are reported with 95% CI.

Downstream Tasks

Zero-shot results for mortality risk prediction, per risk category, are shown in Supplementary Figure S2. AUROC and AUPRC results for PedsFM representation learning evaluation are shown in Supplementary Figure S3.

Stratified zero-shot risk prediction results

Figure S2. Stratified zero-shot risk prediction results. Early death is defined as in-hospital mortality within the first 7 days of admission, late death as in-hospital mortality after the first 7 days of admission. Similarly, long length-of-stay (LOS) is defined as stays longer than 7 days, and short LOS as stays of 7 days or less.

Representation learning results for downstream tasks across different sample sizes

Figure S3. Representation learning results for downstream tasks across different sample sizes. A) AUROC results, B) AUPRC results.

References

  1. [1]Cao Xiao, Edward Choi, and Jimeng Sun. Opportunities and challenges in developing deep learning models using electronic health records data: a systematic review. Journal of the American Medical Informatics Association, 25(10):1419–1428, October 2018.
  2. [2]Benjamin Shickel, Patrick James Tighe, Azra Bihorac, and Parisa Rashidi. Deep EHR: A Survey of Recent Advances in Deep Learning Techniques for Electronic Health Record (EHR) Analysis. IEEE Journal of Biomedical and Health Informatics, 22(5):1589–1604, September 2018.DOI
  3. [3]Michael Moor, Oishi Banerjee, Zahra Shakeri Hossain Abad, Harlan M. Krumholz, Jure Leskovec, Eric J. Topol, and Pranav Rajpurkar. Foundation models for generalist medical artificial intelligence. Nature, 616(7956):259–265, April 2023.DOI
  4. [4]Rishi Bommasani, Drew A. Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S. Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, Erik Brynjolfsson, Shyamal Buch, Dallas Card, Rodrigo Castellon, Niladri Chatterji, Annie Chen, Kathleen Creel, Jared Quincy Davis, Dora Demszky, Chris Donahue, Moussa Doumbouya, Esin Durmus, Stefano Ermon, John Etchemendy, Kawin Ethayarajh, Li Fei-Fei, Chelsea Finn, Trevor Gale, Lauren Gillespie, Karan Goel, Noah Goodman, Shelby Grossman, Neel Guha, Tatsunori Hashimoto, Peter Henderson, John Hewitt, Daniel E. Ho, Jenny Hong, Kyle Hsu, Jing Huang, Thomas Icard, Saahil Jain, Dan Jurafsky, Pratyusha Kalluri, Siddharth Karamcheti, Geoff Keeling, Fereshte Khani, Omar Khattab, Pang Wei Koh, Mark Krass, Ranjay Krishna, Rohit Kudithipudi, Ananya Kumar, Faisal Ladhak, Mina Lee, Tony Lee, Jure Leskovec, Isabelle Levent, Xiang Lisa Li, Xuechen Li, Tengyu Ma, Ali Malik, Christopher D. Manning, Suvir Mirchandani, Eric Mitchell, Zanele Munyikwa, Suraj Nair, Avanika Narayan, Deepak Narayanan, Ben Newman, Allen Nie, Juan Carlos Niebles, Hamed Nilforoshan, Julian Nyarko, Giray Ogut, Laurel Orr, Isabel Papadimitriou, Joon Sung Park, Chris Piech, Eva Portelance, Christopher Potts, Aditi Raghunathan, Rob Reich, Hongyu Ren, Frieda Rong, Yusuf Roohani, Camilo Ruiz, Jack Ryan, Christopher Ré, Dorsa Sadigh, Shiori Sagawa, Keshav Santhanam, Andy Shih, Krishnan Srinivasan, Alex Tamkin, Rohan Taori, Armin W. Thomas, Florian Tramèr, Rose E. Wang, William Wang, Bohan Wu, Jiajun Wu, Yuhuai Wu, Sang Michael Xie, Michihiro Yasunaga, Jiaxuan You, Matei Zaharia, Michael Zhang, Tianyi Zhang, Xikun Zhang, Yuhui Zhang, Lucia Zheng, Kaitlyn Zhou, and Percy Liang. On the Opportunities and Risks of Foundation Models, 2021. Version Number: 3.arxiv.org/abs/2108.07258
  5. [5]Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention Is All You Need, 2017. Version Number: 7.arxiv.org/abs/1706.03762
  6. [6]Lin Lawrence Guo, Santiago Eduardo Arciniegas, Adam Paul Yan, Jason Fries, George A. Tomlinson, and Lillian Sung. Systematic review of foundation models for structured electronic health records. Journal of the American Medical Informatics Association: JAMIA, 33(6):1190–1198, June 2026.DOI
  7. [7]Michael Wornow, Rahul Thapa, Ethan Steinberg, Jason A. Fries, and Nigam H. Shah. EHRSHOT: An EHR Benchmark for Few-Shot Evaluation of Foundation Models, 2023. Version Number: 3.arxiv.org/abs/2307.02028
  8. [8]Yikuan Li, Shishir Rao, José Roberto Ayala Solares, Abdelaali Hassaine, Rema Ramakrishnan, Dexter Canoy, Yajie Zhu, Kazem Rahimi, and Cholmangehra Salimi-Khorshidi. BEHRT: Transformer for Electronic Health Records. Scientific Reports, 10(1):7155, April 2020.
  9. [9]Laila Rasmy, Yang Xiang, Ziqian Xie, Cui Tao, and Degui Zhi. Med-BERT: pretrained contextualized embeddings on large-scale structured electronic health records for disease prediction. npj Digital Medicine, 4(1):86, May 2021.DOI
  10. [10]Boran Hao, Yang Hu, William G. Adams, Sabrina A. Assoumou, Heather E. Hsu, Nahid Bhadelia, and Ioannis Ch. Paschalidis. A GPT-based EHR modeling system for unsupervised novel disease detection. Journal of Biomedical Informatics, 157:104706, September 2024.DOI
  11. [11]Pawel Renc, Yugang Jia, Anthony E. Samir, Jaroslaw Was, Quanzheng Li, David W. Bates, and Arkadiusz Sitek. Zero shot health trajectory prediction using transformer. npj Digital Medicine, 7(1):256, September 2024.DOI
  12. [12]Shane Waxler, Paul Blazek, Davis White, Daniel Sneider, Kevin Chung, Mani Nagarathnam, Patrick Williams, Hank Voeller, Karen Wong, Matthew Swanhorst, Sheng Zhang, Naoto Usuyama, Cliff Wong, Tristan Naumann, Hoifung Poon, Andrew Loza, Daniella Meeker, Seth Hain, and Rahul Shah. Generative Medical Event Models Improve with Scale, 2025. Version Number: 3.arxiv.org/abs/2508.12104
  13. [13]Michael Wornow, Yizhe Xu, Rahul Thapa, Birju Patel, Ethan Steinberg, Scott Fleming, Michael A. Pfeffer, Jason Fries, and Nigam H. Shah. The shaky foundations of large language models and foundation models for electronic health records. npj Digital Medicine, 6(1):135, July 2023.DOI
  14. [14]Felix Draxler, Yang Meng, Kai Nelson, Lukas Laskowski, Yibo Yang, Theofanis Karaletsos, and Stephan Mandt. Transformers for Mixed-type Event Sequences. In Advances in Neural Information Processing Systems 38, pages 127441–127473, San Diego, California, USA and Mexico City, Mexico, 2025. Neural Information Processing Systems Foundation, Inc. (NeurIPS).DOI
  15. [15]Kevin R. Dufendach, Christoph U. Lehmann, S. Andrew Spooner, COUNCIL ON CLINICAL INFORMATION TECHNOLOGY, Srinivasan Suresh, Juan D. Chaparro, Kathryn Cheek, Marvin B. Harper, Brandan P. Kennedy, Eli M. Lourie, Heather C. O’Donnell, Lindsay Stevens, Melissa S. Van Cain, Andrew M. Wiesenthal, David Chartash, Francis Chan, and Lisa Krams. Special Requirements of Electronic Health Record Systems in Pediatrics: Clinical Report. Pediatrics, 154(4):e2024068509, October 2024.DOI
  16. [16]Felix Richter, Emma Holmes, Florian Richter, Katherine Guttmann, Son Q. Duong, Sandeep Gangadharan, Eric E. Schadt, Hojjat Salmasian, Bruce D. Gelb, and Benjamin S. Glicksberg. Toward governance of artificial intelligence in pediatric healthcare. npj Digital Medicine, 8(1):636, October 2025.DOI
  17. [17]V. Muralidharan, A. Burgart, R. Daneshjou, and S. Rose. Recommendations for the use of pediatric data in artificial intelligence and machine learning ACCEPT-AI. npj Digital Medicine, 6(1):166, September 2023.DOI
  18. [18]Stanley Bryan Zamora Hua, Nicholas Heller, Ping He, Alexander J. Towbin, Irene Y. Chen, Alex X. Lu, and Lauren Erdman. Underrepresentation of children in public medical imaging datasets. Nature Health, 1(8):888–897, April 2026.DOI
  19. [19]Susannah Fleming, Matthew Thompson, Richard Stevens, Carl Heneghan, Annette Plüddemann, Ian Maconochie, Lionel Tarassenko, and David Mant. Normal ranges of heart rate and respiratory rate in children from birth to 18 years of age: a systematic review of observational studies. Lancet, 377(9770):1011–1018, March 2011.DOI
  20. [20]Ji-Young Yeo, Eun Sun So, and Sungk wan Youm. The pediatric transfer gap: How adult-ICU-trained machine-learning models degrade on pediatric intensive care patients. International Journal of Medical Informatics, 202:106597, November 2026.DOI
  21. [21]Matthew Brady Neeley, Jorge Botas, Johnathan Jia, Lin Yao, Daniel Palacios, Benjamin Choi, Zhandong Liu, and Hyun-Hwan Jeong. TEDDY: A Pediatric Foundation Model for Risk Forewarning from ICD-Coded Diagnostic Histories, July 2026. Version Number: 1.arxiv.org/abs/2607.14191
  22. [22]Bashar Ramadan, Ming-Chieh Liu, Michael C. Burkhart, William F. Parker, and Brett K. Beaulieu-Jones. Diagnostic Codes in AI Prediction Models and Label Leakage of Same-Admission Clinical Outcomes. JAMA Network Open, 8(12):e2550454, December 2025.DOI
  23. [23]Michael Tschannen, André Susano Pinto, and Alexander Kolesnikov. JetFormer: An Autoregressive Generative Model of Raw Images and Text, May 2025. arXiv:2411.19722 [cs.LG].arxiv.org/abs/2411.19722
  24. [24]Lin Lawrence Guo, Santiago Eduardo Arciniegas, Joseph Jihyung Lee, Adam Paul Yan, George Tomlinson, Jason Fries, and Lillian Sung. Tokenization Tradeoffs in Structured EHR Foundation Models, March 2026. arXiv:2603.15644 [cs.LG].arxiv.org/abs/2603.15644
  25. [25]Hrayer Harutyunyan, Hrant Khachatrian, David C. Kale, Greg Ver Steeg, and Aram Galstyan. Multitask learning and benchmarking with clinical time series data. Scientific Data, 6(1):96, June 2019.
  26. [26]L. Nelson Sanchez-Pinto, Tellen D. Bennett, Peter E. DeWitt, Seth Russell, Margaret N. Rebull, Blake Martin, Samuel Akech, David J. Albers, Elizabeth R. Alpern, Fran Balamuth, Melania Bembea, Mohammad Jobayer Chisti, Idris Evans, Christopher M. Horvat, Juan Camilo Jaramillo-Bustamante, Niranjan Kissoon, Kusum Menon, Halden F. Scott, Scott L. Weiss, Matthew O. Wiens, Jerry J. Zimmerman, Andrew C. Argent, Lauren R. Sorce, Luregn J. Schlapbach, R. Scott Watson, Society of Critical Care Medicine Pediatric Sepsis Definition Task Force, Paolo Biban, Enitan Carroll, Kathleen Chiotos, Claudio Flauzino De Oliveira, Mark W. Hall, David Inwald, Paul Ishimine, Michael Levin, Rakesh Lodha, Simon Nadel, Satoshi Nakagawa, Mark J. Peters, Adrienne G. Randolph, Suchitra Ranjit, Daniela Carla Souza, Pierre Tissieres, and James L. Wynn. Development and Validation of the Phoenix Criteria for Pediatric Sepsis and Septic Shock. JAMA, 331(8):675, February 2024.DOI
  27. [27]Jifan Gao, Michael Rosenthal, Brian Wolpin, and Simona Cristea. Count-based approaches remain strong: A benchmark against transformer and LLM pipelines on structured EHR. In The Second Workshop on GenAI for Health: Potential, Trust, and Policy Compliance, 2025.arxiv.org/abs/2511.00782
  28. [28]Alicia N. Lyle, Fidelia Pokuah, Dennis J. Dietzen, Edward C. C. Wong, Amy L. Pyle-Filola, John S. Fuqua, Alison Woodworth, Patricia M. Jones, Lara J. Akinbami, Luigi R. Garibaldi, and Hubert W. Vesper. Current State of Pediatric Reference Intervals and the Importance of Correctly Describing the Biochemistry of Child Development: A Review. JAMA Pediatrics, 176(7):699, July 2022.DOI
  29. [29]Justina Motiejunaite, Laurence Amar, and Emmanuelle Vidal-Petiot. Adrenergic receptors and cardiovascular effects of catecholamines. Annales d’Endocrinologie, 82(3-4):193–197, June 2021.DOI
  30. [30]Sandy E. Saunders and Erica S. Levitt. Kölliker-Fuse/Parabrachial complex mu opioid receptors contribute to fentanyl-induced apnea and respiratory rate depression. Respiratory Physiology & Neurobiology, 275:103388, April 2020.DOI
  31. [31]Adibvafa Fallahpour, Mahshid Alinoori, Wenqian Ye, Xu Cao, Arash Afkanpour, and Amrit Krishnan. EHR Mamba: Towards Generalizable and Scalable Foundation Models for Electronic Health Records, 2024. Version Number: 3.arxiv.org/abs/2405.14567
  32. [32]Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling Laws for Neural Language Models, 2020. Version Number: 1.arxiv.org/abs/2001.08361

AI tools statement

No AI-use declaration is available for this version in Valency.

The available record does not establish whether AI systems or models contributed to this work.

How AI tools are recorded

Paper details

Cite this paper

Publication

Published
Version
Latest

Data & code

No code, data or supplementary files were declared for this version.

Pick where to look, or just type