Skip to content

Menu

WorksComputer Science

RASPER: Reward-Aligned Summarization of Clinical Notes for EHR Outcome Prediction

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_349dgs9y. 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

Unstructured discharge notes in Electronic Health Records (EHRs) often carry signal complementary to structured medical codes, holding patient-specific evidence that standardized cohort-level codes alone cannot capture. However, this evidence in notes is frequently buried in lengthy, noisy text that is not intentionally written with any specific clinical prediction in mind. Summarization is an obvious mitigation, but generic summaries, tuned for fluency rather than the outcome, routinely omit decisive evidence while retaining plausible but uninformative detail. To this end, we propose RASPER, a Reward-Aligned Summarizer for Prediction in EHR, that optimizes note summarization directly against the downstream clinical task. RASPER employs a tunable LLM-based summarizer to extract task-relevant evidence from discharge notes and trains it via reinforcement learning from prediction feedback, using a reward derived from the downstream predictor's loss. To ground the summarizer, a longitudinal encoder converts structured codes into soft prompts that incorporate each patient's clinical context into note summarization. By rewarding the quality of the resulting multimodal prediction, RASPER encourages the summarizer to retain patient-specific evidence that complements, rather than duplicates, information captured by structured codes. RASPER consistently outperforms strong baselines on both readmission prediction and medication recommendation across MIMIC-III and MIMIC-IV.

Introduction

Electronic Health Records (EHRs) represent a patient’s health trajectory with multimodal views: structured codes such as diagnoses capture standardized, cohort-level patterns across patients ([2]), while discharge notes record patient-specific symptom severity, treatment response, and clinician observations that codes cannot fully record ((Tayefi et al., 2021)). Although discharge notes contain rich patient-specific information, they are primarily written for clinical documentation rather than predictive modeling. These raw notes are often lengthy, redundant, and sensitive to variation in documentation style ([14]). Directly feeding such notes into a model can therefore dilute the predictive signal and make the model sensitive to documentation artifacts rather than the underlying clinical state ([7]). A natural strategy is to summarize discharge notes with an LLM ([5, 4]), compressing noisy clinical narratives into a fluent, coherent summary before prediction. However, reducing note length and improving readability does not by itself ensure that the retained information is useful for a specific prediction task.

The predictive value of a note summary depends on both the downstream task and the patient-specific context. Although different clinical prediction tasks may rely on overlapping clinical information, the information that is most predictive of each task can differ ((Yoon et al., 2025)). Hence, a summary optimized only for generic coverage and denoising is optimized for the wrong objective ((Yadav et al., 2021)), since it might discard details that a specific prediction depends on while preserving plausible but uninformative clinical information. This mismatch suggests that discharge note summarization should not be treated as a separate preprocessing step, but should instead be aligned with the downstream prediction and patient-specific objective.

Existing EHR-LLM methods do not directly address this problem. Some approaches feed raw or hard-prompted notes into LLMs and inherit the noise of the original documentation ([10, 9]), and others rely on fixed summaries or extracted textual features that are never tuned to the target outcome [7]. Some structured code models discard the note modality altogether [11] (Xu et al. 2024). As a result, prior methods generally do not align the summarization process with the downstream clinical objective.

To close this gap, we propose RASPER, a Reward-Aligned Summarizer for Prediction in EHR. RASPER optimizes the summarization of notes directly against the downstream task: a tunable LLM summarizer is trained with reinforcement learning from prediction feedback (RLPF) (Wu et al., 2025), using the predictor’s loss as the reward signal. A longitudinal EHR encoder maps structured codes into soft prompts that provide patient grounding. Because the reward reflects how well the note summary and the structured codes collaborate, the summarizer is encouraged to preserve note evidence that complements the structured code information and contributes to downstream prediction. The summarizer is first initialized through supervised fine-tuning on teacher-generated summaries, then optimized with this prediction-feedback objective to preserve the task-relevant evidence that improves predictive utility. Our approach makes the following contributions:

  • We propose a reward-aligned note summarization framework that trains a tunable LLM summarizer directly against the downstream prediction objective, using reinforcement learning from prediction feedback rather than treating summaries as a fixed preprocessing step.

  • We design an LLM-based predictor that jointly conditions on structured EHR soft prompts and generated note summaries, enabling prediction feedback to align the summarizer with both cohort-level code patterns and informative textual evidence.

  • We conduct experiments on MIMIC-III and MIMIC-IV, showing consistent improvements over strong deep-learning and LLM-based baselines on two clinical prediction tasks.

Methodology

Problem Formulation

For each patient ii, we use an ordered sequence of historical clinical visits {Vi,t}t=1Ti\{V_{i,t}\}_{t=1}^{T_i} as input, where Vi,tV_{i,t} denotes the tt-th observed visit in chronological order and TiT_i denotes the number of historical visits available before the target visit. Each visit Vi,tV_{i,t} contains a set of medical codes, including diagnoses, medications, and procedures. Formally, the codes recorded at visit tt are defined as

Vi,t={xj,ti}j=1∣Vi,t∣,V_{i,t} = \{x_{j,t}^{i}\}_{j=1}^{|V_{i,t}|},

where ∣Vi,t∣|V_{i,t}| denotes the number of medical codes associated with that visit. In addition to structured medical codes, each visit is accompanied by discharge notes represented as text. We denote the token sequence of the discharge note for patient ii at visit tt as Si,t={sj,ti}j=1∣Si,t∣S_{i,t} = \{s_{j,t}^{i}\}_{j=1}^{|S_{i,t}|}, where each sj,tis_{j,t}^{i} denotes a token and ∣Si,t∣|S_{i,t}| is the length of the note.

The target outcome is task-dependent and is defined as

Yi∈{{0,1},readmission prediction{0,1}K,medication recommendation(1)Y_i \in \begin{cases} \{0,1\}, & \text{readmission prediction} \\ \{0,1\}^{K}, & \text{medication recommendation} \end{cases} \tag*{(1)}

where KK denotes the size of the medication vocabulary. For medication recommendation, Yi,k=1Y_{i,k}=1 indicates that medication kk is prescribed at the target visit Ti+1T_i+1.

Model Overview

Figure 1 illustrates the overall architecture of RASPER. The model is designed around the idea that clinical-note summarization should not be optimized independently from the prediction task. The framework contains two interacting modules: an LLM-aware outcome predictor and a tunable LLM summarizer. The predictor combines structured EHR soft prompts with generated note summaries to model both cohort-level code patterns and patient-specific textual evidence. After supervised fine-tuning, the summarizer is further optimized through prediction feedback, so that its generated summaries preserve information that improves downstream clinical prediction.

Overview of the proposed RASPER framework

Figure 1. Overview of the proposed RASPER framework. A tunable LLM summarizer transforms discharge notes into standardized visit-level summaries, which are concatenated into a patient-level summary. An LLM-aware predictor combines this patient-level summary with soft prompt embeddings from structured EHR codes for outcome prediction. The summarizer is first initialized with supervised fine-tuning and then optimized with RLPF using prediction-loss-derived reward within the PPO objective.

LLM-Aware Outcome Predictor

Clinical prediction from EHR requires modeling both discharge notes and structured medical codes [7]. Discharge notes describe patient condition, treatment, and clinical progression [13]. In contrast, diagnoses, procedures, and medications provide standardized cohort-level signals [2, 6] (Shang et al. 2019). Using only notes may expose the model to non-standardized textual evidence, and using only structured codes may miss important patient-specific clinical context. Therefore, we integrate both in a unified representation space.

Large language models can encode clinical text into contextualized representations (Yenduri et al., 2024), but many healthcare LLM approaches rely mainly on hard prompting over linearized patient records [16] (Zaghir et al. 2024). We therefore use prompt tuning [7], where the summarized discharge note embeddings are augmented with soft prompts from a structured EHR encoder. This allows the two modalities to complement each other in a lightweight and modular prediction framework.

Mathematically, the input to the LLM for patient ii is defined as

Ii=[Ei;Embed⁡(S^i)]∈R(P+Ci)×D.(2)I_i = [E_i; \operatorname{Embed}(\hat{S}_i)] \in\mathbb{R}^{(P+C_i)\times D}. \tag*{(2)}

The structured code sequence is first encoded by an encoder to obtain a patient-level representation hiehrh_i^{\mathrm{ehr}}. For the EHR encoder, we use RETAIN [2], a lightweight longitudinal model that captures visit-level and code-level patterns through attention (Further details on RETAIN are provided in Appendix § 9.§ 1). We then project this representation into PP continuous soft prompt embeddings:

Ei=Proj⁡ehr(hiehr),Ei∈RP×D.(3)E_i = \operatorname{Proj}_{\mathrm{ehr}}(h_i^{\mathrm{ehr}}), \qquad E_i \in\mathbb{R}^{P\times D}. \tag*{(3)}

where PP is the number of soft prompt tokens and DD is the hidden dimension of the LLM predictor.

Embed⁡(S^i)∈RCi×D\operatorname{Embed}(\hat{S}_i) \in\mathbb{R}^{C_i\times D} denotes the token embeddings corresponding to the patient summary in the LLM-Aware Outcome Predictor, where CiC_i is the number of summary tokens for patient ii. As defined in Equation (4), the representation IiI_i is then provided to the predictor LLM, which outputs the final hidden representation Hi∈R(P+Ci)×DH_i \in\mathbb{R}^{(P+C_i)\times D}:

Hi=LLM⁡pred(Ii).(4)H_i = \operatorname{LLM}_{\mathrm{pred}}(I_i). \tag*{(4)}

As defined in Equation (5), we first apply average pooling over the final hidden representations HiH_i and then use a linear prediction head to obtain task-specific logits:

yi=Linear⁡pool(Hi).(5)y_i = \operatorname{Linear}_{\mathrm{pool}}(H_i). \tag*{(5)}

The prediction loss is binary cross-entropy:

LPred=BCE⁡(Y^i,Yi),(6)\mathcal{L}_{\mathrm{Pred}} = \operatorname{BCE}(\hat{Y}_i, Y_i), \tag*{(6)}

where Y^i=σ(yi)\hat{Y}_i = \sigma(y_i) denotes the predicted probability for patient ii. The trainable components of the predictor include the EHR-to-soft-prompt layer, the prediction head, and the LoRA adapters of the LLM predictor. The backbone LLM parameters remain frozen.

Tunable LLM Summarizer

The predictive value of clinical information depends on the downstream task and the patient-level prediction context. Hence, a generic summarization objective may not preserve the evidence most useful for outcome modeling (Wu et al., 2025). This motivates using a summarizer that is not only a fixed preprocessing component, but can utilize prediction feedback from the downstream task.

The tunable LLM summarizer converts each raw discharge note into a shorter visit-level summary. It has two main goals: first, to reduce documentation noise and standardize the note format; second, to preserve patient-specific evidence that is useful for downstream prediction. After supervised initialization, the LLM-aware predictor provides a prediction-feedback reward by converting its per-sample prediction loss into a scalar reward, while the LLM summarizer is the policy model.

Given the discharge note Si,tS_{i,t} for patient ii at time step tt, the summarizer generates a standardized clinical summary S^i,t\hat{S}_{i,t} using the prompt shown in Figure 2. We then construct the patient-level document as S^i=S^i,Ti∥S^i,Ti−1∥⋯∥S^i,1\hat{S}_i = \hat{S}_{i,T_i} \mathbin\Vert\hat{S}_{i,T_i-1} \mathbin\Vert\cdots\mathbin\Vert\hat{S}_{i,1}, where ∥\Vert denotes concatenation. This ordering places the most recent visit first because recent clinical status is often more directly related to near-future outcomes, while earlier visits provide additional historical context.

Prompt used by the tunable LLM summarizer to extract relevant information from discharge notes

Figure 2. Prompt used by the tunable LLM summarizer to extract relevant information from discharge notes.

Summarizer Supervised Fine-Tuning

Before applying reinforcement learning, we first perform supervised fine-tuning (SFT) to teach the local summarizer how to extract clinically relevant information from noisy discharge notes. Reinforcement-based alignment alone can be unstable when starting from an unadapted language model [19], especially in long-form clinical summarization settings where the output space is large, and rewards may be sparse or noisy (Rafailov et al., 2023). Therefore, SFT first trains the model to produce summaries that follow a structured clinical style before the summarizer is optimized for downstream predictive utility.

Formally, for each visit-level discharge note Si,tS_{i,t}, we first use the GPT-5.4 mini model to generate a target summary Gi,tG_{i,t}, due to the lack of annotated visit-level summaries. This creates a supervised fine-tuning dataset DSFT={(Si,t,Gi,t)}\mathcal{D}_{\mathrm{SFT}} = \{(S_{i,t}, G_{i,t})\}, where Si,tS_{i,t} is the input note and Gi,tG_{i,t} is the teacher-generated target summary used for supervised fine-tuning. We denote the summarizer policy as πθ\pi_\theta, where θ\theta represents the trainable LoRA adapter parameters [8], while the backbone LLM weights remain frozen. The teacher-generated summary is written as

Gi,t=[gi,t1,gi,t2,…,gi,tLi,t],(7)G_{i,t} = [g_{i,t}^{1}, g_{i,t}^{2}, \ldots, g_{i,t}^{L_{i,t}}], \tag*{(7)}

where Li,tL_{i,t} denotes the length of the target summary for patient ii at visit tt. At decoding step ℓ\ell, the summarizer predicts the next token gi,tℓg_{i,t}^{\ell} conditioned on the discharge note Si,tS_{i,t} and the previously generated target tokens gi,t<ℓg_{i,t}^{<\ell}. Therefore, the supervised fine-tuning objective is defined as the negative log-likelihood of the GPT-generated target summary:

LSFT(θ)=−E(Si,t,Gi,t)∼DSFT[∑ℓ=1Li,tlog⁡πθ(gi,tℓ∣Si,t,gi,t<ℓ)].(8)\mathcal{L}_{\mathrm{SFT}}(\theta) = -\mathbb{E}_{(S_{i,t},G_{i,t})\sim\mathcal{D}_{\mathrm{SFT}}}\left[\sum_{\ell=1}^{L_{i,t}} \log\pi_\theta\left(g_{i,t}^{\ell}\mid S_{i,t},g_{i,t}^{<\ell}\right)\right]. \tag*{(8)}

By minimizing LSFT(θ)\mathcal{L}_{\mathrm{SFT}}(\theta) for several epochs, denoted by QSFT\mathcal{Q}_{\mathrm{SFT}}, the summarizer learns to generate clinically meaningful summaries before being further optimized with the reinforcement learning objective.

RLPF Optimization with PPO

After supervised fine-tuning, we further optimize the summarizer using Reinforcement Learning from Predictor Feedback (RLPF) (Wu et al., 2025). In this stage, the goal is to move beyond generic clinical summarization and encourage the model to retain information that improves downstream outcome prediction. The tunable summarizer is treated as a policy model πθ\pi_\theta initialized from the SFT-trained checkpoint. Given the discharge note Si,tS_{i,t} for patient ii at visit tt, the policy generates a summary token-by-token:

S^i,t=[s^i,t1,s^i,t2,…,s^i,tMi,t]∼πθ(⋅∣Si,t),(9)\hat{S}_{i,t} = [\hat{s}_{i,t}^{1}, \hat{s}_{i,t}^{2}, \ldots, \hat{s}_{i,t}^{M_{i,t}}] \sim\pi_\theta(\cdot\mid S_{i,t}), \tag*{(9)}

where Mi,tM_{i,t} denotes the length of the generated summary. The generated visit-level summaries are then concatenated to form the patient-level summary S^i\hat{S}_i, following the same construction described in the previous subsection.

The LLM-aware predictor acts as the feedback model. Specifically, the generated patient-level summary S^i\hat{S}_i is passed to the LLM-aware outcome predictor defined in Equation (2), together with the structured EHR soft prompts. The predictor then produces the downstream prediction score following Equations (4) and (5). We use the resulting prediction loss to define the reward for optimizing the summarizer. This feedback helps the summarizer to produce clinical summaries that are more useful for prediction. We optimize the summarizer using Proximal Policy Optimization (PPO) (Schulman et al., 2017).

Let ℓi(u)\ell_i^{(u)} denote the per-sample binary cross-entropy loss for patient ii at epoch uu:

ℓi(u)=BCE⁡(Yi(u),Yi).(10)\ell_i^{(u)} = \operatorname{BCE}\left(Y_i^{(u)}, Y_i\right). \tag*{(10)}

For each patient, we maintain a history of previous losses during warm-up in each epoch and define a strong reference loss as the average of the five lowest losses observed so far:

ℓˉi,5(u)=15∑m=15ℓi,lowest(u,m).(11)\bar{\ell}_{i,5}^{(u)} = \frac{1}{5}\sum_{m=1}^{5}\ell_{i,\mathrm{lowest}}^{(u,m)}. \tag*{(11)}

where ℓi,lowest(u,m)\ell_{i,\mathrm{lowest}}^{(u,m)} denotes the mm-th smallest historical loss for patient ii observed during the LLM predictor warm-up stage, before the summarizer is optimized. Using the average of the lowest historical losses provides a reference of the strongest prediction performance observed for that patient during warm-up, and it makes the reward less sensitive to differences across patients. The raw reward is computed as the improvement over this reference:

ri(u)=ℓˉi,5(u)−ℓi(u).(12)r_i^{(u)} = \bar{\ell}_{i,5}^{(u)} - \ell_i^{(u)}. \tag*{(12)}

This reward is used as the prediction-feedback signal for PPO optimization of the summarizer policy; a higher reward indicates that the generated summary improves downstream prediction relative to the patient’s warm-up best historical baselines.

To stabilize PPO training, the patient-level rewards are normalized within each mini-batch B\mathcal{B}. Let μB\mu_{\mathcal{B}} and σB\sigma_{\mathcal{B}} denote the mean and standard deviation of rewards in the mini-batch. The normalized reward is

r~i(u)=ri(u)−μBσB+ϵ,(13)\tilde{r}_i^{(u)} = \frac{r_i^{(u)} - \mu_{\mathcal{B}}}{\sigma_{\mathcal{B}} + \epsilon}, \tag*{(13)}

where ϵ\epsilon is a small constant for numerical stability. The normalized reward is then clipped to avoid unstable updates:

r^i(u)=clip⁡(r~i(u),−rmax⁡,rmax⁡).(14)\hat{r}_i^{(u)} = \operatorname{clip}\left(\tilde{r}_i^{(u)}, -r_{\max}, r_{\max}\right). \tag*{(14)}

Because the reward is computed at the patient level, the same reward is assigned to all generated visit summaries belonging to that patient. For each generated summary token, we compute the log-probability under the current policy and under the old policy that produced the sampled summary. Let πθold\pi_{\theta_{\mathrm{old}}} denote the policy before the PPO update. The PPO probability ratio for token s^i,tℓ\hat{s}_{i,t}^{\ell} is

ρi,tℓ(θ)=πθ(s^i,tℓ∣Si,t,s^i,t<ℓ)πθold(s^i,tℓ∣Si,t,s^i,t<ℓ).(15)\rho_{i,t}^{\ell}(\theta) = \frac{\pi_{\theta}\left(\hat{s}_{i,t}^{\ell} \mid S_{i,t}, \hat{s}_{i,t}^{<\ell}\right)}{\pi_{\theta_{\mathrm{old}}}\left(\hat{s}_{i,t}^{\ell} \mid S_{i,t}, \hat{s}_{i,t}^{<\ell}\right)}. \tag*{(15)}

In addition to the policy model, we use a value head VϕV_{\phi} on top of the summarizer hidden states to estimate the expected reward for each generated token. The token-level advantage is computed as

Ai,tℓ=r^i(u)−Vϕ(hi,tℓ),(16)A_{i,t}^{\ell} = \hat{r}_i^{(u)} - V_{\phi}\left(h_{i,t}^{\ell}\right), \tag*{(16)}

where hi,tℓh_{i,t}^{\ell} is the hidden state corresponding to token s^i,tℓ\hat{s}_{i,t}^{\ell}. The PPO clipped policy loss is then defined as

Lpolicy=−E[min⁡(ρi,tℓ(θ)Ai,tℓ,clip⁡(ρi,tℓ(θ),1−ϵPPO,1+ϵPPO)Ai,tℓ)].(17)\mathcal{L}_{\mathrm{policy}} = -\mathbb{E}\left[\min\left(\rho_{i,t}^{\ell}(\theta)A_{i,t}^{\ell}, \operatorname{clip}\left(\rho_{i,t}^{\ell}(\theta), 1-\epsilon_{\mathrm{PPO}}, 1+\epsilon_{\mathrm{PPO}}\right)A_{i,t}^{\ell}\right)\right]. \tag*{(17)}

where ϵPPO\epsilon_{\mathrm{PPO}} is the PPO clipping threshold.

The value head is trained to regress to the normalized and clipped reward:

Lvalue=E[(Vϕ(hi,tℓ)−r^i(u))2].(18)\mathcal{L}_{\mathrm{value}} = \mathbb{E}\left[\left(V_{\phi}\left(h_{i,t}^{\ell}\right)-\hat{r}_i^{(u)}\right)^2\right]. \tag*{(18)}

To prevent the policy from drifting too far from the SFT-initialized behavior, we use a frozen reference policy πref\pi_{\mathrm{ref}}. We use a sampled KL penalty over the generated tokens to discourage the current policy from drifting too far from the frozen SFT reference policy [19]:

LKL=E[log⁡πθ(s^i,tℓ∣Si,t,s^i,t<ℓ)−log⁡πref(s^i,tℓ∣Si,t,s^i,t<ℓ)].(19)\mathcal{L}_{\mathrm{KL}} = \mathbb{E}\left[\log\pi_{\theta}\left(\hat{s}_{i,t}^{\ell} \mid S_{i,t}, \hat{s}_{i,t}^{<\ell}\right) - \log\pi_{\mathrm{ref}}\left(\hat{s}_{i,t}^{\ell} \mid S_{i,t}, \hat{s}_{i,t}^{<\ell}\right)\right]. \tag*{(19)}

We also include an entropy bonus to encourage sufficient exploration during summary generation (Zheng et al., 2023):

Hi,tℓ=−∑v∈Vπθ(v∣Si,t,s^i,t<ℓ)log⁡πθ(v∣Si,t,s^i,t<ℓ).(20)\mathcal{H}_{i,t}^{\ell} = -\sum_{v\in\mathcal{V}}\pi_{\theta}\left(v \mid S_{i,t}, \hat{s}_{i,t}^{<\ell}\right)\log\pi_{\theta}\left(v \mid S_{i,t}, \hat{s}_{i,t}^{<\ell}\right). \tag*{(20)}

where V\mathcal{V} is the vocabulary.

The final PPO objective combines the clipped policy loss, value loss, entropy regularization, and KL regularization:

LPPO=Lpolicy+λvLvalue−λHE[Hi,tℓ]+λKLLKL,(21)\mathcal{L}_{\mathrm{PPO}}=\mathcal{L}_{\mathrm{policy}}+\lambda_{\mathrm{v}}\mathcal{L}_{\mathrm{value}}-\lambda_{\mathrm{H}}\mathbb{E}[\mathcal{H}^{\ell}_{i,t}]+\lambda_{\mathrm{KL}}\mathcal{L}_{\mathrm{KL}}, \tag*{(21)}

where λv\lambda_{\mathrm{v}}, λH\lambda_{\mathrm{H}}, and λKL\lambda_{\mathrm{KL}} control the contributions of the value loss, entropy bonus, and KL penalty, respectively.

Staged Predictor–Summarizer Optimization

The RL optimization stage requires a reliable downstream predictor to provide meaningful feedback for the summarizer. When the predictor is under-trained, the reward signal can be noisy and may lead to unstable policy updates. To address this, we first train the predictor for QwarmQ_{\mathrm{warm}} epochs using LPred\mathcal{L}_{\mathrm{Pred}}, and then optimize the summarizer using LPPO\mathcal{L}_{\mathrm{PPO}}, while the backbone of the predictor LLM is frozen. The two modules use separate optimizers, OPred\mathcal{O}_{\mathrm{Pred}} and OPPO\mathcal{O}_{\mathrm{PPO}}:

{OPred(LPred),e<QwarmOPred(LPred),e≥QwarmOPPO(LPPO)(22)\begin{cases} \mathcal{O}_{\mathrm{Pred}}(\mathcal{L}_{\mathrm{Pred}}), & e < Q_{\mathrm{warm}} \\ \mathcal{O}_{\mathrm{Pred}}(\mathcal{L}_{\mathrm{Pred}}), & e \ge Q_{\mathrm{warm}} \\ \mathcal{O}_{\mathrm{PPO}}(\mathcal{L}_{\mathrm{PPO}}) \tag*{(22)} \end{cases}

After the warm-up stage, the predictor and summarizer are optimized with separate objectives and optimizers. The predictor continues minimizing LPred\mathcal{L}_{\mathrm{Pred}}, while the summarizer is updated using LPPO\mathcal{L}_{\mathrm{PPO}} based on the prediction-feedback reward. This staged training provides a more reliable reward signal before the summarizer policy is updated, and reduces the risk of optimizing the summarizer against under-trained predictor feedback.

Evaluation

Datasets and Setups

In this study, we use two real-world datasets to evaluate model performance on medication and readmission prediction tasks.

  • MIMIC-III (Johnson et al., [13]) is an open-access database containing health records for over 40,000 patients admitted to critical care units between 2001 and 2012. In this study, we focus on patients with multiple visits and aim to predict binary outcomes.

  • MIMIC-IV (Johnson et al., [12]) is a publicly available EHR dataset containing records from over 380,000 patients admitted to Beth Israel Deaconess Medical Center between 2008 and 2019. It extends MIMIC-III with a clearer modular structure, richer clinical detail, and improved data provenance.

Both MIMIC-III and MIMIC-IV are publicly available through PhysioNet under controlled-access terms for credentialed researchers. The dataset statistics are summarized in Table 1. In this study, we consider two key healthcare prediction tasks: hospital readmission prediction (binary classification) and medication recommendation (multi-label classification). Given patient information up to visit TiT_i, the model predicts the outcome at visit Ti+1T_{i+1} for patient ii based on TiT_i prior visits. Since these tasks require longitudinal data, we excluded patients with only a single recorded visit. We randomly split the data into 70% training and 30% testing sets and report the mean over 4 seeds. The source code is released.2

MetricMIMIC-IIIMIMIC-IV
# of patients753715874
# of medications per patient79.30113.55
# of diagnoses per patient28.9865.99
# of procedures per patient7.379.08
# of history visits per patient1.653.11
Positive rate for readmission53.7%53.5%

Table 1. Dataset statistics.

For both the LLM summarizer and the LLM-aware predictor, we utilize the Gemma-2-2B model. All experiments are implemented in Python, using PyTorch (Paszke et al., [20]) as the main deep learning framework. RASPER is also fully compatible with the PyHealth framework (Yang et al., 2023), which we use for implementing EHR baselines. For LLM tuning, we use the Hugging Face framework (Wolf et al., 2019). Experiments are conducted on a high-performance server with three NVIDIA A6000 GPUs.

The hyperparameters used in our experiments are shown in Table 2. These values were selected through a greedy search for the best performance.

ComponentHyperparameter / SymbolValue
Soft prompt encoderPP8
LLM hidden sizeDD2304
Max Summary lengthCiC_i512
Reward normalizationϵ\epsilon1×10−81 \times10^{-8}
Reward clippingrmax⁡r_{\max}2.0
PPO clippingϵPPO\epsilon_{\mathrm{PPO}}0.2
Value loss weightλv\lambda_{\mathrm{v}}0.5
Entropy weightλH\lambda_{\mathrm{H}}0.01
KL weightλKL\lambda_{\mathrm{KL}}0.02
Max PPO generationMi,tM_{i,t}128
SFT epochsQSFTQ_{\mathrm{SFT}}10
Predictor warm-upQwarmQ_{\mathrm{warm}}20
OptimizersOPred,OPPO\mathcal{O}_{\mathrm{Pred}}, \mathcal{O}_{\mathrm{PPO}}AdamW

Table 2. Hyperparameters used in the proposed framework.

Baselines

We compare RASPER with representative deep EHR models, including Deepr (Nguyen et al., [18]), RETAIN (Choi et al., [2]), GRASP (Zhang et al., 2021), AdaCare (Ma et al., [15]), StageNet (Gao et al., [3]), ADORE (Cheong et al., [1]), and ARCI (H Moghaddam et al., [6]). We also compare against recent LLM-based healthcare prediction methods, including GraphCare (Jiang et al., [11]), LINKO (Nayebi Kerdabadi et al., [17]), and RePrompT (H Moghaddam et al., [7]). These baselines cover sequential EHR modeling, ontology-enhanced prediction, patient-similarity learning, knowledge-graph augmentation, and LLM-based EHR representation learning. More information about baselines is available in Appendix § 9.§ 2.

Discussion

Performance Comparison on Baselines

As shown in Table 3, the proposed method achieves the best performance across the baselines. RePrompT is the closest competing method, which is expected since it also uses a multimodal LLM-based design. The improvement over RePrompT demonstrates the effectiveness of the overall RASPER framework for jointly leveraging structured EHR representations and prediction-aligned clinical summaries. The gap between RETAIN, RePrompT, and our method also shows the value of using clinical notes in EHR modeling. Compared with models that rely only on structured codes, adding note information clearly improves the learned patient representations. In general, the LLM-based methods perform better than traditional deep learning baselines. Even when prior methods do not directly use clinical-note summarization, they suggest that LLM-based feature extraction [11, 17] and multimodal learning [7] are useful for prediction.

ModelMIMIC-III Readmission AUROCMIMIC-III Readmission PRAUCMIMIC-III Medication F1MIMIC-III Medication JaccardMIMIC-IV Readmission AUROCMIMIC-IV Readmission PRAUCMIMIC-IV Medication F1MIMIC-IV Medication Jaccard
DL-based Methods
Deepr (Nguyen et al., [18])0.6710.7020.2550.1600.6210.6510.2280.189
RETAIN (Choi et al., [2])0.6570.6780.2530.1560.6730.6980.3490.255
GRASP (Zhang et al., 2021)0.6180.6350.1530.0960.5350.5780.2670.195
AdaCare (Ma et al., [15])0.6450.6870.2350.1330.6150.6440.2510.184
StageNet (Gao et al., [3])0.6780.7050.2390.1390.6590.6900.2780.202
Adore (Cheong et al., [1])0.6650.6980.1520.1250.6150.6430.2060.165
ARCI (H Moghaddam et al., [6])0.6480.6690.2830.1840.6680.6980.3030.246
LLM-based Methods
GraphCare (Jiang et al., [11])0.6650.7050.2940.1950.6880.7110.3550.259
LINKO (Nayebi Kerdabadi et al., [17])0.6740.7110.3040.2020.6950.7150.3670.264
RePrompT (H Moghaddam et al., [7])<u>0.682</u><u>0.718</u><u>0.312</u><u>0.206</u><u>0.702</u><u>0.723</u><u>0.375</u><u>0.273</u>
RASPER0.7040.7380.3260.2180.7250.7420.3880.282

Table 3. Baseline performance comparison on MIMIC-III and MIMIC-IV. Best results are in bold, and underlined results denote the second-best results that are statistically lower at the 95% confidence level.

Ablation Studies on Modules

As shown in Table 4, removing the EHR encoder leads to the largest performance drop, indicating that cohort-level structured information is essential for complementing patient-specific clinical notes. In addition, directly using noisy clinical notes as input leads to worse performance than the proposed method, supporting the main motivation of our paper: raw discharge notes contain redundant and noisy information that can distract the predictor. The GPT-based summarizer improves over raw-note input by reducing this noise, but it still relies on generic summarization objectives and is not explicitly optimized for the clinical prediction task. In contrast, our proposed method further improves performance by aligning the summaries with downstream prediction loss through RL-based optimization. This gap shows that prediction-aligned summarization adds value beyond generic note compression and helps preserve useful information for the final prediction.

Model VariantMIMIC-III Readmission AUROCMIMIC-III Readmission PRAUCMIMIC-III Medication F1MIMIC-III Medication JaccardMIMIC-IV Readmission AUROCMIMIC-IV Readmission PRAUCMIMIC-IV Medication F1MIMIC-IV Medication Jaccard
RASPER w/o EHR encoder0.6610.6980.2880.1870.6850.7040.3530.258
RASPER w/o Summarization0.6740.7120.2980.1910.6910.7130.3630.262
RASPER w/o RL (GPT only)<u>0.689</u><u>0.725</u><u>0.309</u><u>0.201</u><u>0.708</u><u>0.723</u><u>0.371</u><u>0.272</u>
RASPER w/o RL (SFT only)0.6840.7210.3050.1980.7010.7180.3670.269
RASPER0.7040.7380.3260.2180.7250.7420.3880.282

Table 4. Ablation studies on MIMIC-III and MIMIC-IV. Best results are in bold, and underlined results denote the second-best results that are statistically lower at the 95% confidence level.

Ablation Studies on Encoder Selection

The EHR encoder plays a central role in converting the structured medical codes in a patient’s longitudinal history into cohort-level representations. To study this effect, we replace the structured encoder with different EHR modeling backbones and report the results in Figure 3. Among the compared encoders, RETAIN achieves the best overall performance. This is likely because RETAIN captures patient history at multiple levels. As a result, the generated soft tokens provide more informative structured signals to the LLM predictor. The gains are consistent across datasets and evaluation metrics, suggesting that the benefit is not limited to a single task setting. These results also indicate that the proposed framework can benefit from stronger structured EHR encoders.

Performance comparison across different EHR models on MIMIC-III and MIMIC-IV

Figure 3. Performance comparison across different EHR models on MIMIC-III and MIMIC-IV.

LLM Model Selection

To examine the sensitivity of RASPER to the choice of LLM backbone, we conduct additional experiments using different LLMs, as shown in Table 5. Since RASPER relies on LLMs for both clinical note summarization and prediction, changing the backbone can affect the final performance. Overall, Gemma-2-2B achieves the best performance across all metrics, suggesting that a stronger backbone can provide better clinical representations and improve downstream prediction. However, the performance gaps between Gemma2-2B, Llama-3.2-1B, and Qwen2.5-0.5B are relatively small in most settings. This indicates that RASPER is not highly dependent on a specific LLM architecture, and the main performance gain comes from the proposed framework.

BackboneMIMIC-IIIMIMIC-IIIMIMIC-IIIMIMIC-IIIMIMIC-IVMIMIC-IVMIMIC-IVMIMIC-IV
Readmission AUROCReadmission PRAUCMedication F1Medication JaccardReadmission AUROCReadmission PRAUCMedication F1Medication Jaccard
Llama-3.2-1B0.7010.7340.3210.2140.7220.7370.3840.278
Qwen2.5-0.5B0.6970.7300.3150.2090.7160.7310.3790.276
Gemma-2-2B0.7040.7380.3260.2180.7250.7420.3880.282

Table 5. Comparison of LLM backbones on MIMIC-III and MIMIC-IV across two tasks.

Related Work

A large body of work has studied how to learn predictive representations from Electronic Health Records for clinical decision support. Early neural models such as RETAIN [2] improve interpretability by applying reverse-time attention over visits and medical variables, allowing the model to emphasize clinically important parts of a patient’s history. Other methods incorporate medical ontologies to reduce sparsity and improve the use of domain knowledge. For example, Hierarchical Attention Propagation (HAP) (Zhang et al., 2020) propagates attention through ontology structures to capture relationships between ancestor and descendant concepts. Temporal disease progression and patient heterogeneity have also been widely studied. AdaCare [15] models both short- and long-term variations in clinical signals using multi-scale convolutional modules, while StageNet [3] introduces stage-aware modeling to capture disease progression over time. These methods improve clinical prediction by better modeling structured EHR sequences, attention patterns, or disease stages. However, they mainly rely on structured medical codes or numerical features, and therefore do not fully exploit the rich information in unstructured clinical notes.

Recent advances in Large Language Models (LLMs) have motivated their use for EHR representation learning and clinical prediction. GraphCare [11] constructs patient-specific knowledge graphs by combining structured knowledge bases with LLM-generated knowledge, and applies a bi-attention-augmented GNN for prediction. RAM-EHR (Xu et al., 2024) augments patient representations through LLM-powered dense retrieval from multiple knowledge sources, together with consistency regularization to improve robustness. Prompting-based studies (Zhu et al., 2024) further show that carefully designed prompts incorporating EHR-specific information can enable LLMs to perform clinical prediction in few-shot or zero-shot settings. LINKO [17] uses LLM-initialized medical concept embeddings and performs dual-axis knowledge propagation, both within individual ontologies and across different ontology systems, and RePrompT [7] incorporates structured EHR encoders into LLMs through prompt tuning, using recurrent visit-level states and cohort-trained soft prompts.

Conclusion

We proposed RASPER, a reward-aligned framework that integrates structured EHR codes and discharge notes for clinical prediction. RASPER uses EHR soft prompts to capture cohort-level patterns and prediction-aligned summaries to retain useful patient-specific context. By optimizing the summarizer with downstream prediction feedback, RASPER produces summaries that are more directly useful for the target task. Experiments on MIMIC-III and MIMIC-IV show consistent improvements over strong baselines.

Limitations

Although RASPER shows strong performance, this study has two limitations. First, the experiments are conducted only on MIMIC-III and MIMIC-IV, so additional evaluation on datasets from other hospitals would better show its generalizability. Second, the current framework focuses on prediction performance and does not deeply analyze how different summary lengths or prompt formats affect the final results.

Ethical Considerations

This study uses publicly available, de-identified EHR datasets and does not involve direct interaction with patients. The proposed framework is intended to support clinical prediction research rather than replace clinical judgment. Because generated summaries may omit clinically relevant information or introduce inaccuracies, the proposed framework should not be used as an autonomous clinical decision-making system. We used AI-assisted tools to support language editing, grammar correction, and clarity improvement during manuscript preparation.

Acknowledgments

This work was supported by the National Science Foundation under Grant No. IIS-2544634.

Appendix

RETAIN Encoder

For the structured EHR encoder, we use RETAIN [2], which maps longitudinal medical code sequences into dense patient representations through a two-level attention mechanism: Visit-level and variable-level attention. The visit-level attention captures the relative importance of the visit embeddings {vi,j}j=1t\{v_{i,j}\}_{j=1}^{t}:

{qi,j}j=1t=GRU⁡α({vi,j}j=1t)(23)\{q_{i,j}\}_{j=1}^{t} = \operatorname{GRU}_{\alpha}(\{v_{i,j}\}_{j=1}^{t}) \tag*{(23)}
{αi,j}j=1t=Softmax⁡(wα{qi,j}j=1t)(24)\{\alpha_{i,j}\}_{j=1}^{t} = \operatorname{Softmax}(w_{\alpha}\{q_{i,j}\}_{j=1}^{t}) \tag*{(24)}

The variable-level attention assigns featurewise weights to the visit representation:

{zi,j}j=1t=GRU⁡β({vi,j}j=1t)(25)\{z_{i,j}\}_{j=1}^{t} = \operatorname{GRU}_{\beta}(\{v_{i,j}\}_{j=1}^{t}) \tag*{(25)}
{βi,j}j=1t=tanh⁡(wβ{zi,j}j=1t)(26)\{\beta_{i,j}\}_{j=1}^{t} = \tanh(w_{\beta}\{z_{i,j}\}_{j=1}^{t}) \tag*{(26)}

The final patient representation is computed by combining the two attention-weighted signals:

ki,t=∑j=1tαi,jβi,j⊙vi,j(27)k_{i,t} = \sum_{j=1}^{t} \alpha_{i,j}\beta_{i,j} \odot v_{i,j} \tag*{(27)}
hi,t=wencki,t+benc(28)h_{i,t} = w_{\mathrm{enc}}k_{i,t} + b_{\mathrm{enc}} \tag*{(28)}

The model outputs a sequence of visit-level embeddings hi,th_{i,t}, where the final embedding at visit TiT_i is used as the patient-level EHR representation, denoted by hiehr=hi,Tih_i^{\mathrm{ehr}} = h_{i,T_i}.

Baselines

In this research, we compare RASPER with both established healthcare deep learning methods and LLM-based approaches. The deep learning baselines include Deepr [18], which represents patient records as sequences of coded events with time gaps and hospital transfers and applies a CNN for prediction; RETAIN [2], which uses a dual-RNN attention mechanism to capture the interpretable influence of visits and medical features; GRASP (Zhang et al., 2021), which improves EMR-based prediction by identifying clinically similar patients; AdaCare [15], which captures both short- and long-term biomarker variations and adaptively emphasizes patient-specific risk factors; StageNet [3], a stage-aware neural network that models disease progression using LSTM and stage-adaptive convolution; ADORE [1], which uses attention to adapt medical ontology category embeddings to EHR data for clinical prediction; and ARCI [6], which disentangles coexisting temporal medical intents across sequential visits. We also compare RASPER with three recent LLM-based healthcare prediction methods: GraphCare [11], which extracts knowledge from LLMs and external biomedical knowledge graphs to construct patient-specific KGs and train a Bi-attention Augmented GNN for clinical prediction; LINKO [17], which uses LLM-augmented initialization and dual-axis knowledge propagation to jointly learn medical concept representations across multiple ontology graphs; and RePrompT [7], which integrates structured EHR encoders with LLMs through time-aware prompt tuning, preserving longitudinal visit information and injecting cohort-level representations via trainable prompt tokens.

Inference Time Comparison

Table 6: Inference time comparison for a batch of 12 patients.

In Table 6, we compare the proposed method with existing baselines to provide an inference time analysis. While our model is more complex than RePrompT, the observed performance gains suggest that this additional complexity is justified and contributes meaningful predictive benefit.

ModelTime (s)
Deepr0.09
RETAIN0.06
GRASP0.17
AdaCare0.05
StageNet0.11
Adore0.21
ARCI0.92
GraphCare0.34
LINKO0.24
RePrompT1.38
RASPER1.87

Table 6.

References

  1. [1]Chin Wang Cheong, Kejing Yin, William K Cheung, Benjamin CM Fung, and Jonathan Poon. 2023. Adaptive integration of categorical and multi-relational ontologies with ehr data for medical concept embedding. ACM Transactions on Intelligent Systems and Technology, 14(6):1–20.DOI
  2. [2]Edward Choi, Mohammad Taha Bahadori, Jimeng Sun, Joshua Kulas, Andy Schuetz, and Walter Stewart. 2016. Retain: An interpretable predictive model for healthcare using reverse time attention mechanism. Advances in neural information processing systems, 29.arxiv.org/abs/1608.05745
  3. [3]Junyi Gao, Cao Xiao, Yasha Wang, Wen Tang, Lucas M Glass, and Jimeng Sun. 2020. Stagenet: Stage-aware neural networks for health risk prediction. In Proceedings of the web conference 2020, pages 530–540.DOI
  4. [4]Senay A Gebreab, Khaled Salah, Raja Jayaraman, Muhammad Habib ur Rehman, and Samer Ellaham. 2024. Llm-based framework for administrative task automation in healthcare. In 2024 12th International Symposium on Digital Forensics and Security (ISDFS), pages 1–7. IEEE.DOI
  5. [5]Sagar Goyal, Eti Rastogi, Sree Prasanna Rajagopal, Dong Yuan, Fen Zhao, Jai Chintagunta, Gautam Naik, and Jeff Ward. 2024. Healai: A healthcare llm for effective medical documentation. In Proceedings of the 17th ACM International Conference on Web Search and Data Mining, pages 1167–1168.DOI
  6. [6]Arya H Moghaddam, Mohsen Nayebi Kerdabadi, Mei Liu, and Zijun Yao. 2024. Contrastive learning on medical intents for sequential prescription recommendation. In Proceedings of the 33rd ACM International Conference on Information and Knowledge Management, pages 748–757.DOI
  7. [7]Arya H Moghaddam, Drew Ross, Mohsen Nayebi Kerdabadi, Dongjie Wang, and Zijun Yao. 2026. Reprompt: Recurrent prompt tuning for integrating structured ehr encoders with large language models. In Findings of the Association for Computational Linguistics: ACL 2026, pages 26766–26778.
  8. [8]Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. 2021. Lora: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685.arxiv.org/abs/2106.09685
  9. [9]Kexin Huang, Jaan Altosaar, and Rajesh Ranganath. 2019. Clinicalbert: Modeling clinical notes and predicting hospital readmission. arXiv preprint arXiv:1904.05342.arxiv.org/abs/1904.05342
  10. [10]Lavender Yao Jiang, Xujin Chris Liu, Nima Pour Nejatian, Mustafa Nasir-Moin, Duo Wang, Anas Abidin, Kevin Eaton, Howard Antony Riina, Ilya Laufer, Paawan Punjabi, et al. 2023. Health system-scale language models are all-purpose prediction engines. Nature, 619(7969):357–362.DOI
  11. [11]Pengcheng Jiang, Cao Danica Xiao, Adam Cross, and Jimeng Sun. 2024. Graphcare: Enhancing healthcare predictions with personalized knowledge graphs. In International Conference on Learning Representations, volume 2024, pages 16839–16866.arxiv.org/abs/2305.12788
  12. [12]Alistair Johnson, Lucas Bulgarelli, Tom Pollard, Steven Horng, Leo Anthony Celi, and Roger Mark. 2021. MIMIC-IV. PhysioNet.
  13. [13]Alistair EW Johnson, Tom J Pollard, Lu Shen, Li-wei H Lehman, Mengling Feng, Mohammad Ghassemi, Benjamin Moody, Peter Szolovits, Leo Anthony Celi, and Roger G Mark. 2016. Mimic-iii, a freely accessible critical care database. Scientific data, 3(1):160035.DOI
  14. [14]Jinghui Liu, Daniel Capurro, Anthony Nguyen, and Karin Verspoor. 2022. “note bloat” impacts deep learning-based nlp models for clinical prediction tasks. Journal of biomedical informatics, 133:104149.DOI
  15. [15]Liantao Ma, Junyi Gao, Yasha Wang, Chaohe Zhang, Jiangtao Wang, Wenjie Ruan, Xin Gao, and Xinyu Ma. 2020. Adacare: Explainable clinical health status representation learning via scale-adaptive feature extraction and recalibration. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 825–832.arxiv.org/abs/1911.12205
  16. [16]Bertalan Meskó. 2023. Prompt engineering as an important emerging skill for medical professionals: tutorial. Journal of medical Internet research, 25:e50638.DOI
  17. [17]Mohsen Nayebi Kerdabadi, Arya H Moghaddam, Dongjie Wang, and Zijun Yao. 2025. Multi-ontology integration with dual-axis propagation for medical concept representation. In Proceedings of the 34th ACM International Conference on Information and Knowledge Management, pages 2201–2211.arxiv.org/abs/2508.21320
  18. [18]Phuoc Nguyen, Truyen Tran, Nilmini Wickramasinghe, and Svyetha Venkatesh. 2017. DeepR: a convolutional net for medical records. IEEE journal of biomedical and health informatics, 21(1):22–30.arxiv.org/abs/1607.07519
  19. [19]Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. 2022. Training language models to follow instructions with human feedback. Advances in neural information processing systems, 35:27730–27744.arxiv.org/abs/2203.02155
  20. [20]Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Köpf, Edward Yang, Zach DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, and 2 others. 2019. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32.arxiv.org/abs/1912.01703

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

Code, data, proofs and workflows the authors linked for testing, review and reproduction. These links are part of this work’s metadata and are released under the same license as the rest of that metadata. Valency doesn’t host the files; each keeps the license set where it’s hosted.

Pick where to look, or just type