Skip to content

Menu

WorksComputer Science

RES-MR: Risk-Aware Reasoning for Explainable and Safe Medication Recommendation

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

Medication recommendations seek to deliver personalized drug combinations based on patients' clinical information, where ensuring transparent decision-making and personalized safety are of paramount importance. However, existing approaches predominantly operate as ``black boxes'', offering limited interpretability and hindering clinician trust. Furthermore, they typically rely on fixed, patient-agnostic safety constraints, neglecting the heterogeneity of risk tolerance across individuals, which poses significant risks to vulnerable populations. To address these gaps, we propose RES-MR, a novel Risk-aware Reasoning framework for Explainable and Safe Medication Recommendation using LLMs. RES-MR follows a two-stage training paradigm: (1) an explainable clinical reasoning distillation stage to elicit diagnostic capabilities by fine-tuning on synthesized reasoning trajectories, grounded in patient-specific knowledge from graph retrieval; and (2) a risk-aware policy optimization stage to dynamically balance therapeutic efficacy with personalized safety. This stage employs disentangled drug factors to construct patient-specific reference prototypes that capture desired therapeutic drug features and risk features to avoid. These prototypes enable risk boundary calibration and guide the model toward safe recommendations via reward shaping and clipping. Extensive experiments on benchmark datasets demonstrate that RES-MR significantly outperforms state-of-the-art baselines in terms of accuracy, safety, and explainability. Our code and data are available at: https://github.com/wangcong2001/RES-MR.

Unpublished working draft. Not for distribution. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

SIGIR ’26, Melbourne, VIC, Australia.

© 2026 Copyright held by the owner/author(s). Publication rights licensed to ACM.

ACM ISBN 979-8-4007-2599-9/2026/07

https://doi.org/10.1145/3805712.3809604 CCS Concepts

• Information systems → Recommender systems; • Social and professional topics → Medical records.

Keywords

Medication recommendation, Electronic health record, Large language models, Explainability, Medication safety

ACM Reference Format:

Cong Wang, Jin Li, Shoujin Wang, Yishuo Li, Huilin Gu, and Wenpeng Lu. 2026. RES-MR: Risk-Aware Reasoning for Explainable and Safe Medication Recommendation. In Proceedings of the 49th International ACM SIGIR Conference on Research and Development in Information Retrieval (SIGIR ’26), July 20–24, 2026, Melbourne, VIC, Australia. ACM, New York, NY, USA, 12 pages. https://doi.org/10.1145/3805712.3809604

Introduction

Medication recommendation is a pivotal task in clinical decision support systems, aiming to assist physicians in tailoring effective and safe drug combinations for individual patients [1, 25, 53, 59, 60, 62, 64, 81]. Reliable medication recommender systems hold immense potential to not only mitigate preventable medication errors and reduce adverse patient outcomes but also significantly alleviate the cognitive load on clinicians [33, 36, 82]. However, in real-world clinical practice, this task is substantially more complex than following general recommendations, as accurate and safe medication decisions require jointly considering therapeutic benefit, potential drug-drug interactions, contraindications, and patient-specific context [14]. To address this, there is a growing paradigm shift towards utilizing data-driven approaches based on large-scale Electronic Health Records (EHRs) [43, 69, 72] that capture the rich longitudinal patient data necessary to model these intricate dependencies, aiming to automate this complex decision-making process.

A substantial body of work has investigated deep learning approaches for EHR-based medication recommendation, aiming to infer personalized drug combinations from patients’ structured clinical codes and longitudinal histories. While early instance-based methods [19, 82] focused on extracting features from single visits, the field has largely shifted towards longitudinal modeling. Specifically, longitudinal approaches [3, 41] primarily utilize Recurrent Neural Networks (RNNs) [21, 77] to model long-term disease progression and treatment trajectories by aggregating temporal dependencies from patients’ historical records. Concurrently, graph-based models have emerged to reinforce medication safety and structural understanding. These methods employ Graph Neural Networks (GNNs) [4, 55] to incorporate external knowledge, ranging from drug-drug interaction (DDI) graphs [77, 78, 88] to molecular structural information, thereby explicitly capturing the complex relational associations among diagnoses, procedures, and medications. More recently, Large Language Models (LLMs) [15, 42, 74, 89] have introduced a new generative paradigm, leveraging their exceptional natural language understanding and extensive medical knowledge for more comprehensive patient modeling.

Despite these advances, existing methods remain limited by opaque decision processes and reliance on fixed, patient-agnostic safety constraints without considering specific patient conditions. This oversimplified formulation fails to reflect the complexity of real-world clinical practice, as illustrated in Figure 1, leaving two critical challenges (CHs) unaddressed:

Figure 1. Examples illustrating two limitations of existing methods. (a) Most RNN/GNN/LLM methods follow a “direct-mapping” paradigm and usually output drugs (e.g., a beta-blocker for asthma) without providing an explicit rationale, leading to trust issues. (b) Safety-oriented methods use static global constraints, imposing a one-size-fits-all risk tolerance and thus risking vulnerable patients or over-restricting robust ones. (c) RES-MR leverages retrieval-augmented reasoning and personalized boundaries to generate verifiable explanations and safe medication recommendations.

• CH1: How to generate a transparent, step-by-step reasoning path that doctors can verify easily? As illustrated in Figure 1 (a), the prevalent “direct mapping” paradigm, seen in both discriminative GNNs [45] and generative LLM-based methods [74, 85], bypasses the explicit reasoning path that should connect symptoms, pathology, and treatment rationale. Although some efforts have attempted to mitigate this opacity via attention mechanisms or aspect-based alignment [45], they primarily provide post-hoc feature attribution, rather than generating explicit diagnostic logic. They highlight which clinical features contributed to the prediction, but fail to articulate how the conclusion was logically deduced. Such a lack of transparency leads to the dilemma of unverifiable errors. For instance, if a model erroneously recommends a beta-blocker to an asthmatic patient, an opaque system cannot clarify whether the error stems from a misinterpretation of the disease status or neglect of pharmacological contraindications. Without a verifiable reasoning path, clinicians often struggle to validate or trust the system’s recommendations in high-stakes scenarios.

• CH2: How to balance risks and benefits under an adaptive, patient-specific risk boundary informed by individual clinical conditions? As shown in Figure 1 (b), most methods [19, 21, 70] enforce safety through static, global constraints such as DDI penalties in the loss function [77] or molecular-structure-informed representations [8, 83], without accounting for heterogeneity in patient-specific risk tolerance. In practice, acceptable risk is highly dependent on individual clinical status. Consider hypertension treatment as an example: a physiologically robust young patient may tolerate a more aggressive strategy to maximize long-term control, whereas a frail older patient with multiple comorbidities requires conservative management to avoid adverse events (e.g., hypotension), even at the cost of less stringent blood pressure control. Due to the overlook of such patient-specific tolerance differences, existing models struggle to optimize utility under the patient-specific risk boundary. As a result, their provided recommendations are either overly conservative for robust patients or potentially risky for vulnerable ones.

To bridge these gaps, we propose RES-MR, a novel Risk-aware Reasoning framework for Explainable and Safe Medication Recommendation using LLMs, as shown in Figure 2. RES-MR adopts a two-stage training paradigm integrating Supervised Fine-Tuning (SFT) [23] and Reinforcement Learning (RL) [16, 87] to respectively address the aforementioned two challenges. Stage 1: Explainable Clinical Reasoning Distillation (ECRD). To address CH1 and provide transparent, verifiable decision paths, we apply SFT to endow the LLM with generative reasoning capabilities. First, to ensure the reasoning is grounded in clinical facts rather than hallucinations, we introduce a knowledge graph retrieval module to extract patient-specific evidence. Then, we employ a reasoning distillation strategy, fine-tuning the LLM on high-quality reasoning trajectories to explicitly articulate logical chains as explanations (an example is shown in Figure 2). By connecting symptoms to pharmacological mechanisms based on retrieved evidence, this stage effectively ensures the decision process is explainable and clinically verifiable. Stage 2: Risk-Aware Policy Optimization (RAPO). To address CH2 and achieve personalized risk-benefit trade-offs, we align the model with patient-specific safety constraints via RL. The core idea is to guide the model using adaptive reward shaping to explore effective treatments without exceeding patient’s risk tolerance. To quantify this tolerance, we first design a dual-factor disentanglement module to decompose drug representations into efficacy and risk factors. These factors are then aggregated into patient prototypes, representing desired medication and avoided medication. Leveraging the patient’s historical records and constructed prototypes, we can calibrate a personalized risk boundary. Furthermore, we present a reward clipping strategy to prevent potentially imbalanced rewards. Based on this two-stage training process, RES-MR generates explicit reasoning trajectories as explanations while providing personalized safe medication recommendations.

Overall framework and training/inference pipeline of RES-MR

Figure 2. Overall framework and training/inference pipeline of RES-MR. Stage 1: Given patient EHRs, hybrid retrieval retrieves patient-specific evidence from the knowledge graph; a teacher LLM synthesizes reasoning trajectories to perform Supervise Fine-tuning (SFT) of the LLM, endowing it with strong reasoning capabilities to provide explicit explanations. Stage 2: We further optimize the LLM with Reinforcement Learning (RL). A pretrained dual-factor disentanglement extracts drug efficacy and risk factors to construct patient-specific prototypes, which guide the policy update during RL training via reward shaping and clipping to ensure safety. Inference: The fully trained LLM uses the hybrid retrieval to augment generation with retrieved knowledge and outputs verifiable explanations and safe medication recommendations.

In summary, the main contributions of this paper are as follows:

  • We propose RES-MR, a novel framework for explainable and safe medication recommendation using LLMs. It integrates reasoning generation and safety alignment into a two-stage paradigm, effectively addressing the challenges of opaque decision processes and patient-agnostic safety constraints.

  • In Stage 1, we propose explainable clinical reasoning distillation to ensure transparent decision-making. By integrating the knowledge graph retrieval module with a reasoning distillation strategy, we endow the model with the capability of generating explainable reasoning trajectories grounded in clinical evidence.

  • In Stage 2, we devise risk-aware policy optimization to achieve personalized risk-benefit trade-offs. We introduce a dual-factor disentanglement module and patient prototypes to quantify personalized risk boundaries, which guide an RL policy via adaptive reward shaping and clipping to ensure safe exploration tailored to individual patient tolerance.

  • Extensive experiments on benchmark datasets demonstrate that RES-MR consistently outperforms state-of-the-art baselines across recommendation accuracy, safety, and explainability metrics, validating its potential for reliable clinical decision support.

Related Works

Medication Recommendation. Based on the utilization of clinical data, existing studies can be categorized into instance-based and longitudinal methods. Instance-based methods [19, 82], such as LEAP [82], primarily rely on the current visit information to encode diagnoses through multi-instance multi-label learning, often overlooking the long-term progression of diseases. In contrast, longitudinal methods incorporate patient history to model health trajectories [30, 31, 54, 63, 67, 80, 84]. For instance, COGNet [71] introduces a copy-or-predict mechanism to reuse historical medications, while ARMR [66] utilizes segmented temporal learning components to capture evolving patient statuses. Regarding transparency, ExpDrug [45] attempts to map patient features into explainable aspect features to improve model interpretability. Recently, Large Language Models (LLMs) have introduced a generative paradigm to this field [15, 42, 74, 85]. LAMO [85] integrates structured codes with unstructured clinical text for the first time.

Safe Medication Recommendation. Mitigating adverse drug events and ensuring safe medication recommendations are paramount objectives in clinical applications [21, 56]. Early approaches like SafeDrug [77] employ dual molecular graph encoders to capture structural drug information and minimize DDI losses, while MoleRec [78] enhances safety by modeling the relationships between critical molecular substructures and patient health conditions. ARC [7] improves safety from a reliability perspective by calibrating confidence for medication recommendations at both the individual-drug and set levels. With the advent of LLMs, recent works have attempted to integrate safety constraints into generative frameworks. For example, KELLM [74] incorporates safety constraints via LoRA fine-tuning with external knowledge, while FLAME [15] formulates recommendation as a sequential decision process, utilizing step-wise Group Relative Policy Optimization for fine-grained drug list generation. Despite these advancements, existing methods lack verifiable reasoning trajectories and overlook patient-specific risk tolerance, hindering the adaptive balance between efficacy and safety across diverse patients.

Reasoning-enhanced LLM-Based Recommendation. Recent advancements have spurred interest in leveraging the reasoning capabilities of Large Language Models (LLMs) to move beyond simple rating prediction toward reasoning-enhanced recommendation [2, 11, 34, 39]. While in-context learning strategies like Chain-of-Thought (CoT) have been explored, general-purpose LLMs often lack domain-specific optimization without fine-tuning. Consequently, research has shifted toward fine-tuning paradigms to internalize reasoning patterns [17, 35, 40, 57]. EXP3RT [29] proposes a distillation framework that constructs profiles from reviews to jointly generate rationales and ratings in a single step. Reason4Rec [17] introduces a deliberative, multi-stage framework supervised by feedback to enable finer control over reasoning paths. However, these general-domain methods prioritize user preference alignment, failing to address the complexity of clinical practice where accurate decisions require jointly considering therapeutic benefits, drug-drug interactions, and contraindications.

Problem Formulation

Electronic Health Records (EHRs). Let D\mathcal{D}, P\mathcal{P}, and M\mathcal{M} denote the sets of diagnoses, procedures, and medications, and ∣D∣|\mathcal{D}|, ∣P∣|\mathcal{P}|, and ∣M∣|\mathcal{M}| represent their sizes. A patient’s EHR is composed of a temporal sequence of visits V=[v1,v2,…,vT]\mathcal{V} = [v_1, v_2, \ldots, v_T], where the tt-th visit is a tuple vt=(Ct,nt,mt)v_t = (C_t, n_t, m_t). Here, Ct=[dt,pt,at]C_t = [d_t, p_t, a_t] denotes the structured clinical context with the diagnosis set dt⊆Dd_t \subseteq\mathcal{D}, the procedure set pt⊆Pp_t \subseteq\mathcal{P}, and patient’s demographic attributes ata_t. In contrast, ntn_t is the unstructured clinical note, and mt⊆Mm_t \subseteq\mathcal{M} denotes the medication set prescribed in the visit. In our framework, the structured context CtC_t, the clinical note ntn_t, and the medications in mtm_t are all described in natural language.

Medical Knowledge Graph. To support risk-aware reasoning, we utilize an external medical knowledge graph Gkg=(E,R,Tkg)\mathcal{G}_{kg} = (\mathcal{E}, \mathcal{R}, \mathcal{T}_{kg}). Here, E\mathcal{E} represents the set of medical entities, and R\mathcal{R} denotes various clinical relations (e.g., Indication and Contraindication). Tkg\mathcal{T}_{kg} consists of triplets (h,r,t)(h, r, t) describing the connections between entities, where h,t∈Eh,t \in\mathcal{E} denote the head and tail entities, and r∈Rr \in\mathcal{R} denotes the relation between them.

Task Definition. Consider a patient with a sequence of visits V\mathcal{V}. For the tt-th visit, given the historical visits v1:t−1=[v1,…,vt−1]v_{1:t-1} = [v_1, \ldots, v_{t-1}], the current visit context (Ct,nt)(C_t, n_t), and the external knowledge Gkg\mathcal{G}_{kg}, our goal is to train an LLM πθ\pi_\theta, such that it can explicitly generate: (1) a reasoning trajectory Ttreason\mathcal{T}^{\mathrm{reason}}_t that explains the clinical decision process; and (2) a safe medication set m^t\hat{m}_t for the current visit.

Methodology

As illustrated in Figure 2, RES-MR aims to generate explainable and safe medication recommendations by leveraging the exceptional reasoning capabilities of LLMs. It adopts a two-stage training paradigm. The first stage, Explainable Clinical Reasoning Distillation (ECRD), focuses on addressing the opacity of decision-making. By integrating knowledge graph retrieval with a reasoning distillation strategy, it teaches the model via SFT to articulate step-by-step reasoning trajectories grounded in clinical evidence. Building upon this foundation, the second stage, Risk-Aware Policy Optimization (RAPO), is devised to enforce patient-specific risk-benefit trade-offs through a reward-guided RL process. To quantify personalized risk boundaries, it first decomposes drug representations into efficacy and risk factors and aggregates them into prototypes that capture desired and avoided medications. Using these prototypes together with the patient’s historical records, we calibrate a personalized risk boundary. Finally, we optimize the policy via adaptive reward shaping and clipping, guiding the model to explore effective treatments while strictly suppressing boundary violations.

Explainable Clinical Reasoning Distillation

To enable the generation of verifiable reasoning paths for the LLM πθ\pi_\theta, this stage comprises two steps: (1) knowledge graph retrieval to construct evidence that grounds the reasoning process in objective medical facts; and (2) supervised fine-tuning on synthesized reasoning trajectories to guide the model to explicitly articulate diagnostic logic as explanations.

Knowledge Graph Retrieval

For a given patient at the current visit, we perform both node and semantic retrieval on the Medical Knowledge Graph to construct the patient-specific knowledge context Gret{\mathcal{G}}_{\mathrm{ret}} [47, 61, 75]. First, to capture explicit structural relations, we employ node retrieval by querying the KG with the current structured context CtC_t (e.g., diagnoses and procedures) and collecting one-hop neighboring triples of these entities to form Gnode\mathcal{G}_{\mathrm{node}}. Complementarily, to uncover implicit semantic associations, we perform semantic retrieval. We embed the current note ntn_t into a dense vector space and retrieve the most relevant KG contexts via cosine similarity search, yielding the semantic knowledge context Gsem\mathcal{G}_{\mathrm{sem}}. Finally, we merge the two streams into a unified knowledge context Gret=Gnode∪Gsem\mathcal{G}_{\mathrm{ret}} = \mathcal{G}_{\mathrm{node}} \cup\mathcal{G}_{\mathrm{sem}}, which not only provides patient-specific evidence for reasoning but also serves as the knowledge foundation for patient prototype construction.

Supervised Fine-tuning

In practice, clinicians formulate prescriptions following a strong rationale from the patient’s specific diagnoses. To endow the model with such diagnostic reasoning capabilities, we leverage GPT-5 to synthesize high-quality reasoning trajectories Treason\mathcal{T}^{\mathrm{reason}} [20, 28] for model fine-tuning. Specifically, GPT-5 is prompted with a comprehensive patient context, including the structured context CtC_t and note ntn_t, the retrieved knowledge Gret\mathcal{G}_{\mathrm{ret}} for grounding, and the ground-truth medication mtm_t. The resulting trajectory provides step-by-step, diagnosis-aware explanations that connect patient evidence and symptoms to pharmacological mechanisms and medication actions. A clear example is shown in Figure 2. We fine-tune the LLM πθ\pi_\theta using the synthesized dataset D\mathcal{D} with low-rank adaptation [23]. Each instance includes the patient history v1:t−1v_{1:t-1}, current visit inputs (Ct,nt)(C_t, n_t), and retrieved knowledge Gret\mathcal{G}_{\mathrm{ret}}. We minimize the negative log-likelihood of generating yy:

LSFT=−E(x,y)∼D[∑j=1∣y∣log⁡πθ(yj∣x,y<j)],(1)\mathcal{L}_{\mathrm{SFT}} = -\mathbb{E}_{(x,y)\sim\mathcal{D}}\left[\sum_{j=1}^{|y|}\log\pi_\theta(y_j \mid x,y_{<j})\right], \tag*{(1)}

where we define the input x=(v1:t−1,Ct,nt,Gret)x = (v_{1:t-1}, C_t, n_t, \mathcal{G}_{\mathrm{ret}}) and yy represents the concatenated sequence of the reasoning path Ttreason\mathcal{T}^{\mathrm{reason}}_t and the final result mtm_t. By learning this structured generation pattern, the LLM acquires diagnosis-aware reasoning behaviors and a strong, format-stable initialization for the RAPO stage.

Risk-Aware Policy Optimization

While SFT establishes fundamental clinical reasoning, its supervision objective overlooks the efficacy-safety trade-off. Consequently, the model struggles to satisfy personalized risk constraints while maintaining accuracy. Therefore, we propose Risk-Aware Policy Optimization (RAPO), which incorporates the trade-off via specially devised reinforcement learning [58, 79]. The core objective is to guide the model to explore more effective medication combinations while adhering to personalized risk boundaries. To achieve this, we first pretrain a dual-factor disentanglement module to decompose drug representations into efficacy and risk factors, making both signals explicitly quantifiable for reward computation. Based on retrieved knowledge, we then construct patient prototypes that summarize desired and avoided medications. Using these prototypes together with the patient’s medication history, we calibrate a patient-specific risk boundary. In this stage, these signals are used for reward shaping to balance efficacy and safety. We further apply reward clipping to prevent potentially imbalanced rewards.

Dual-Factor Disentanglement

To make efficacy and risk signals quantifiable for reward measurement, we introduce a Dual-Factor Disentanglement module and pretrain it before RL [44]. For each drug mm, we obtain its semantic embedding em\mathbf{e}_m from an LLM encoder. We then encode em\mathbf{e}_m with a shared encoder and two factor-specific adapters, i.e., h=fshare(em)\mathbf{h} = f_{\mathrm{share}}(\mathbf{e}_m), heff=feff(h)\mathbf{h}_{\mathrm{eff}} = f_{\mathrm{eff}}(\mathbf{h}), and hrisk=frisk(h)\mathbf{h}_{\mathrm{risk}} = f_{\mathrm{risk}}(\mathbf{h}). To suppress shared information across factors, we introduce a Mutual Exclusion Block [12] prior to the variational projection:

heff′=heff−α⋅σ(Wg[heff;hrisk])⊙MLP⁡(hrisk),(2)\mathbf{h}'_{\mathrm{eff}} = \mathbf{h}_{\mathrm{eff}} - \alpha\cdot\sigma(W_g[\mathbf{h}_{\mathrm{eff}};\mathbf{h}_{\mathrm{risk}}]) \odot\operatorname{MLP}(\mathbf{h}_{\mathrm{risk}}), \tag*{(2)}

where σ\sigma is the sigmoid function, WgW_g is a learnable weight matrix, and α\alpha is a learnable parameter. A symmetric operation is also applied to hrisk′\mathbf{h}'_{\mathrm{risk}}. For k∈{eff,risk}k \in\{\mathrm{eff},\mathrm{risk}\}, we project hk′\mathbf{h}'_k to (μk,σk)(\mu_k,\sigma_k) and adopt the reparameterization trick [32]: zk=μk+σk⊙ϵ\mathbf{z}_k = \mu_k + \sigma_k \odot\epsilon where ϵ∼N(0,I)\epsilon\sim\mathcal{N}(0,I). We align each factor with clinical semantics using KG relations. Specifically, the positive concept set Tk+T_k^+ is constructed from TKG\mathcal{T}_{\mathrm{KG}}: for efficacy (k=effk=\mathrm{eff}), positives are clinical concepts linked by Indication; for risk (k=riskk=\mathrm{risk}), positives are those linked by Contraindication. Negatives Tk−T_k^- are randomly sampled from other concepts. For each factor kk, we pull zk\mathbf{z}_k close to Tk+T_k^+ and push it away from Tk−T_k^-:

Lalign(k)=−∑t∈Tk+log⁡σ(s(zk,t))−∑t′∈Tk−log⁡(1−σ(s(zk,t′))),(3)\mathcal{L}_{\mathrm{align}}^{(k)} = - \sum_{t \in T_k^+} \log\sigma(s(\mathbf{z}_k,t)) - \sum_{t' \in T_k^-} \log(1-\sigma(s(\mathbf{z}_k,t'))), \tag*{(3)}

where s(⋅,⋅)s(\cdot,\cdot) denotes cosine similarity. The overall alignment loss is Lalign=Lalign(eff)+Lalign(risk)\mathcal{L}_{\mathrm{align}} = \mathcal{L}_{\mathrm{align}}^{(\mathrm{eff})} + \mathcal{L}_{\mathrm{align}}^{(\mathrm{risk})}. To promote independence and robustness, we impose an orthogonality constraint and the KL regularizer [24]:

Lorth=∥Cov⁡(μeff,μrisk)∥F2,(4)\mathcal{L}_{\mathrm{orth}} = \lVert\operatorname{Cov}(\boldsymbol{\mu}_{\mathrm{eff}},\boldsymbol{\mu}_{\mathrm{risk}}) \rVert_F^2, \tag*{(4)}
LKL=∑k∈{eff,risk}DKL(qϕ(zk∣em)∥N(0,I)),(5)\mathcal{L}_{\mathrm{KL}} = \sum_{k \in\{\mathrm{eff},\mathrm{risk}\}} D_{\mathrm{KL}}(q_\phi(\mathbf{z}_k \mid\mathbf{e}_m) \mathbin\Vert\mathcal{N}(0,I)), \tag*{(5)}

where Cov⁡\operatorname{Cov} is covariance matrix and DKLD_{\mathrm{KL}} is KL divergence. We parameterize variational posterior: qϕ(zk∣em)=N(μk,diag⁡(σk2))q_\phi(\mathbf{z}_k \mid\mathbf{e}_m) = \mathcal{N}(\mu_k,\operatorname{diag}(\sigma_k^2)). The final objective is Ltotal=Lalign+λorthLorth+βLKL\mathcal{L}_{\mathrm{total}} = \mathcal{L}_{\mathrm{align}} + \lambda_{\mathrm{orth}}\mathcal{L}_{\mathrm{orth}} + \beta\mathcal{L}_{\mathrm{KL}}. After convergence, we use the frozen μeff\mu_{\mathrm{eff}} and μrisk\mu_{\mathrm{risk}} as deterministic drug factors for the following optimization.

Prototype Construction

Given a patient and the current visit, this module constructs patient-specific prototypes as reference points [49] for reward computation in RAPO. Leveraging the pretrained disentangled factors and retrieved knowledge context Gret\mathcal{G}_{\mathrm{ret}}, we derive these prototypes to capture the desired therapeutic features and the risk features to avoid. Specifically, based on medical relations in the Knowledge Graph (e.g., indications and contraindications), we categorize drug entities from Gret\mathcal{G}_{\mathrm{ret}} into an indication set Mpos\mathcal{M}_{\mathrm{pos}} and a contraindication set Mneg\mathcal{M}_{\mathrm{neg}}. To ensure valid prototype construction, we require both sets to be non-empty for each patient. Subsequently, utilizing the frozen encoder, we aggregate the corresponding disentangled factors of the drugs within each set. The positive prototype vposv_{\mathrm{pos}} characterizes the desired therapeutic direction by aggregating the efficacy factors of the indicated drugs:

vpos=1∣Mpos∣∑m∈Mposμeff(m).(6)v_{\mathrm{pos}} = \frac{1}{\lvert\mathcal{M}_{\mathrm{pos}}\rvert} \sum_{m \in\mathcal{M}_{\mathrm{pos}}} \boldsymbol{\mu}_{\mathrm{eff}}(m). \tag*{(6)}

Conversely, the negative prototype vnegv_{\mathrm{neg}} captures the high-risk profiles that must be strictly avoided, obtained by aggregating the risk factors of the contraindicated drugs:

vneg=1∣Mneg∣∑m∈Mnegμrisk(m).(7)v_{\mathrm{neg}} = \frac{1}{\lvert\mathcal{M}_{\mathrm{neg}}\rvert} \sum_{m \in\mathcal{M}_{\mathrm{neg}}} \boldsymbol{\mu}_{\mathrm{risk}}(m). \tag*{(7)}

Reward Shaping

4.2.3 Reward Shaping. To guide the model toward optimizing the trade-off between therapeutic efficacy and personalized safety, we design a composite reward function that combines efficacy rewards with safety costs under a patient-specific risk boundary. Prior to quantifying safety costs, we first calibrate a risk boundary BB to define the maximum risk level a patient can tolerate. Using historical medications Mhist=⋃i<tmi\mathcal{M}_{\mathrm{hist}} = \bigcup_{i < t} m_i as an empirical proxy [48, 50] of patient-specific risk exposure under prior clinical supervision, we define BB as the δ\delta-quantile of risk similarities between historical drugs and the negative prototype vnegv_{\mathrm{neg}}:

B=inf⁡{b∈R | 1∣Mhist∣∑m∈MhistI(s(μrisk(m),vneg)≤b)≥δ},(8)B = \inf\left\{ b \in\mathbb{R} \ \middle| \ \frac{1}{\lvert\mathcal{M}_{\mathrm{hist}}\rvert} \sum_{m \in\mathcal{M}_{\mathrm{hist}}} \mathbb{I}\left(s(\boldsymbol{\mu}_{\mathrm{risk}}(m), v_{\mathrm{neg}}) \le b\right) \ge\delta\right\}, \tag*{(8)}

where s(⋅,⋅)s(\cdot, \cdot) denotes cosine similarity and δ∈[0,1]\delta\in[0,1] controls the strictness. A larger BB implies higher tolerance, allowing broader exploration, whereas a smaller BB imposes tighter constraints for vulnerable patients. The final reward RR is synthesized by subtracting a weighted safety cost from the efficacy reward:

R=(1−ρt)Re−ρtRs.(9)R = (1 - \rho_t)R_e - \rho_t R_s. \tag*{(9)}

The efficacy reward ReR_e encourages clinically accurate prescriptions by combining the Jaccard similarity with the ground truth m∗m^* and an efficacy bonus based on the positive prototype vposv_{\mathrm{pos}}:

Re=λj∣m^∩m∗∣∣m^∪m∗∣+λe1∣m^∣∑d∈m^max⁡(0,s(μeff(d),vpos)).(10)R_e = \lambda_j \frac{\lvert\hat{m} \cap m^* \rvert}{\lvert\hat{m} \cup m^* \rvert} + \lambda_e \frac{1}{\lvert\hat{m}\rvert} \sum_{d \in\hat{m}} \max\left(0, s(\boldsymbol{\mu}_{\mathrm{eff}}(d), v_{\mathrm{pos}})\right). \tag*{(10)}

This efficacy bonus ensures the model receives positive feedback for functionally valid drugs aligned with the desired therapeutic direction, even if they differ from the exact labels. Conversely, the safety cost RsR_s penalizes iatrogenic risks, aggregating Drug-Drug Interaction (DDI) rates and violations of the calibrated risk boundary:

Rs=λdDDI⁡(m^)+λr1∣m^∣∑d∈m^max⁡(0,s(μrisk(d),vneg)−B).(11)R_s = \lambda_d \operatorname{DDI}(\hat{m}) + \lambda_r \frac{1}{\lvert\hat{m}\rvert} \sum_{d \in\hat{m}} \max\left(0, s(\boldsymbol{\mu}_{\mathrm{risk}}(d), v_{\mathrm{neg}}) - B\right). \tag*{(11)}

The second term penalizes only the amount by which a drug’s risk similarity to vnegv_{\mathrm{neg}} exceeds the boundary BB. Crucially, any format violation or hallucinated drug is assigned a fixed penalty (R=−100R = -100) and treated as an invalid sample, bypassing the computation of ReR_e and RsR_s. Finally, to prevent early convergence to overly conservative behaviors, we introduce an adaptive gating coefficient ρt\rho_t derived from the moving average Jaccard performance Jˉt\bar{J}_t:

ρt=σ(Jˉt−τt),(12)\rho_t = \sigma(\bar{J}_t - \tau_t), \tag*{(12)}

where τt\tau_t linearly increases during training. This mechanism ensures that strict safety constraints intervene only after the model acquires sufficient clinical reasoning accuracy.

Reward Clipping and Policy Update

4.2.4 Reward Clipping and Policy Update. With the established reward shaping, we may still encounter a critical risk: high efficacy rewards could potentially overshadow safety costs, encouraging the model to trade safety for performance (i.e., reward hacking [6, 68]). To address this, we introduce a reward clipping strategy that suppresses “high-reward but unsafe” trajectories upon boundary violations, while allowing a higher upper bound for safe trajectories, thereby encouraging safe exploration and conservative updates, respectively [9, 16]. Specifically, we compute the difference between the personalized risk boundary BB and the maximum risk similarity among the generated medications, and use it to adaptively clip the raw reward RR:

Δt=B−max⁡d∈m^(s(μrisk(d),vneg)).(13)\Delta_t = B - \max_{d \in\hat{m}} \left(s(\boldsymbol{\mu}_{\mathrm{risk}}(d), v_{\mathrm{neg}})\right). \tag*{(13)}

A positive Δt\Delta_t indicates the medication set is within the safe region, while a non-positive Δt\Delta_t signals a boundary violation. Based on the sign of Δt\Delta_t, we obtain the final reward RtotalR_{\mathrm{total}} by clipping the raw shaped reward RR, where the clipping bounds are computed from the group-wise mean μR\mu_R and standard deviation σR\sigma_R over the GG sampled trajectories for the same input context:

Rtotal={clip⁡(R,μR−σR,μR+2σR)if Δt>0,clip⁡(R,μR−2σR,μR+σR)if Δt≤0.(14)R_{\mathrm{total}} = \begin{cases} \operatorname{clip}(R, \mu_R - \sigma_R, \mu_R + 2\sigma_R) & \text{if } \Delta_t > 0, \\ \operatorname{clip}(R, \mu_R - 2\sigma_R, \mu_R + \sigma_R) & \text{if } \Delta_t \le0. \end{cases} \tag*{(14)}

Here clip⁡(x,a,b)=min⁡(max⁡(x,a),b)\operatorname{clip}(x,a,b) = \min(\max(x,a),b) truncates the reward into [a,b][a,b], preventing extreme reward values from dominating policy updates and stabilizing optimization. When Δt>0\Delta_t > 0, we relax the upper bound to allow higher rewards for safe trajectories. When Δt≤0\Delta_t \le0, we tighten the upper bound and relax the lower bound to suppress unsafe high-reward trajectories, mitigating reward hacking and inducing conservative updates.

Finally, to ensure stable convergence under these dynamic constraints, we employ Group Sequence Policy Optimization [87]. Concretely, we sample an input context x∼Dx \sim\mathcal{D}. For each xx, we draw GG candidate sequences {yi}i=1G∼πθold(⋅∣x)\{y_i\}_{i=1}^{G} \sim\pi_{\theta_{\mathrm{old}}}(\cdot\mid x), where each yiy_i is a complete generation containing the reasoning trajectory and the medication set. We maximize the following objective:

J(θ)=E[1G∑i=1Gmin⁡(si(θ)A^i,clip⁡(si(θ),1−ϵ,1+ϵ)A^i)].(15)\mathcal{J}(\theta) = \mathbb{E}\left[\frac{1}{G}\sum_{i=1}^{G}\min\left(s_i(\theta)\hat{A}_i,\operatorname{clip}\left(s_i(\theta),1-\epsilon,1+\epsilon\right)\hat{A}_i\right)\right]. \tag*{(15)}

where A^i\hat{A}_i is the standardized advantage derived from RtotalR_{\mathrm{total}}. The importance ratio si(θ)s_i(\theta) is defined based on sequence likelihood:

si(θ)=(πθ(yi∣x)πθold(yi∣x))1∣yi∣.(16)s_i(\theta) = \left(\frac{\pi_\theta(y_i \mid x)}{\pi_{\theta_{\mathrm{old}}}(y_i \mid x)}\right)^{\frac{1}{\lvert y_i\rvert}}. \tag*{(16)}

This length normalization keeps the importance ratio comparable across varying response lengths, which helps stabilize training.

Inference

During inference, we perform knowledge graph retrieval to obtain Gret\mathcal{G}_{\mathrm{ret}} for the current visit. We form the input context as x=x =

ItemsMIMIC-IIIMIMIC-IVeICU
# of visits / # of patients12,433 / 4,785156,315 / 46,81118,636 / 8,544
dis. / proc. / med. space size4,316 / 1,330 / 59319,812 / 10,859 / 7431,562 / 937 / 152
avg. / max # of visits5.68 / 2911.07 / 702.18 / 9
avg. / max # of dis. per visit14.68 / 3913.45 / 564.79 / 76
avg. / max # of proc. per visit4.69 / 322.75 / 348.03 / 118
avg. / max # of med. per visit14.78 / 6714.24 / 12810.35 / 51

caption: Statistics on MIMIC-III, MIMIC-IV, and eICU Datasets

:::

(v1:t−1,Ct,nt,Gret)(\mathbf{v}_{1:t-1}, \mathbf{C}_t, \mathbf{n}_t, \mathcal{G}_{\mathrm{ret}}) and autoregressively generate a serialized output sequence:

y^∼πθ(⋅∣x).(17)\hat{y} \sim\pi_\theta(\cdot\mid x). \tag*{(17)}

The generated y^\hat{y} for visit tt consists of an explicit reasoning trajectory T^treason\hat{\mathcal{T}}^{\mathrm{reason}}_t followed by the recommended medication set m^t\hat{\mathbf{m}}_t.

Experiments

Experimental Setup

Datasets. We conduct experiments on MIMIC-III [27], MIMIC-IV [26], and eICU [51]. MIMIC-III and MIMIC-IV are large-scale databases comprising deidentified critical care data from the Beth Israel Deaconess Medical Center. eICU is a multi-center ICU EHR database with deidentified patient records across hospitals. To better reflect real-world clinical practice, we retain the complete set of diagnoses, procedures, and medications without truncation. Additionally, for the MIMIC-III and MIMIC-IV datasets, we only include admissions that have available clinical notes. Regarding text processing, we follow the common practice [15, 85] and extract specific segments from these notes, including history of present illness, past medical history, allergies, and medications on admission. For data standardization, we unify the diagnosis and procedure codes by mapping them to the ICD-9 standard [22], utilizing their descriptions as model inputs. Similarly, medications are mapped to DrugBank IDs [65], with their corresponding generic names to unify diverse formulations. Furthermore, following established protocols [37, 77], we construct the drug-drug interaction matrix MddiM_{ddi} based on interaction pairs extracted from the DrugBank database [65]. We split all three datasets into training, validation, and test sets at the patient level with a 4:1:1 ratio. Retaining the full medication set enlarges the label space, making results not directly comparable to prior studies with different preprocessing. The detailed statistics of the processed datasets are summarized in Table 1.

Metrics. We evaluate our method from three perspectives: recommendation accuracy, medication safety, and reasoning interpretability. We adopt the commonly-used accuracy metrics, i.e., Jaccard Similarity (Jaccard) [1] and F1-score (F1) [53], to measure the overlap between the predicted set m^i\hat{\mathbf{m}}_i and the ground-truth set mi\mathbf{m}_i at the last visit for each patient ii in the test set U\mathcal{U}:

Jaccard⁡=1∣U∣∑i=1∣U∣∣mi∩m^i∣∣mi∪m^i∣,F1⁡=1∣U∣∑i=1∣U∣2⋅Pre⁡i⋅Rec⁡iPre⁡i+Rec⁡i.(18)\operatorname{Jaccard} = \frac{1}{|\mathcal{U}|}\sum_{i=1}^{|\mathcal{U}|}\frac{|\mathbf{m}_i \cap\hat{\mathbf{m}}_i|}{|\mathbf{m}_i \cup\hat{\mathbf{m}}_i|},\quad\operatorname{F1} = \frac{1}{|\mathcal{U}|}\sum_{i=1}^{|\mathcal{U}|}\frac{2\cdot\operatorname{Pre}_i\cdot\operatorname{Rec}_i}{\operatorname{Pre}_i+\operatorname{Rec}_i}. \tag*{(18)}

where Pre⁡i=∣m^i∩mi∣∣m^i∣\operatorname{Pre}_i = \frac{|\hat{\mathbf{m}}_i\cap\mathbf{m}_i|}{|\hat{\mathbf{m}}_i|} and Rec⁡i=∣m^i∩mi∣∣mi∣\operatorname{Rec}_i = \frac{|\hat{\mathbf{m}}_i\cap\mathbf{m}_i|}{|\mathbf{m}_i|}. Safety is assessed via the DDI rate [55] and our proposed Risk Intrusion Score (RIS). The DDI rate calculates the proportion of medication pairs in m^i\hat{\mathbf{m}}_i that induce interactions based on the adjacency matrix MddiM_{ddi}:

DDI⁡=1∣U∣∑i=1∣U∣∑j=1∣m^i∣∑k=j+1∣m^i∣I(Mddi[m^ij,m^ik]=1)∑j=1∣m^i∣∑k=j+1∣m^i∣1.(19)\operatorname{DDI} = \frac{1}{|\mathcal{U}|}\sum_{i=1}^{|\mathcal{U}|}\frac{\sum_{j=1}^{|\hat{\mathbf{m}}_i|}\sum_{k=j+1}^{|\hat{\mathbf{m}}_i|}\mathbb{I}\left(M_{ddi}[\hat{m}_i^j,\hat{m}_i^k]=1\right)}{\sum_{j=1}^{|\hat{\mathbf{m}}_i|}\sum_{k=j+1}^{|\hat{\mathbf{m}}_i|}1}. \tag*{(19)}

where I(⋅)\mathbb{I}(\cdot) is the indicator function. To empirically assess patient-specific risk tolerance, which is not directly observable from EHRs, we define RIS as a proxy metric [50] that measures the extent to which predicted drugs violate each patient’s risk boundary BiB_i:

RIS⁡=1∣U∣∑i=1∣U∣1∣m^i∣∑d∈m^imax⁡(0,s(μrisk(d),vneg)−Bi)1−Bi.(20)\operatorname{RIS} = \frac{1}{|\mathcal{U}|}\sum_{i=1}^{|\mathcal{U}|}\frac{1}{|\hat{\mathbf{m}}_i|}\sum_{d\in\hat{\mathbf{m}}_i}\frac{\max\left(0,s(\boldsymbol{\mu}_{\mathrm{risk}}(d),\mathbf{v}_{\mathrm{neg}})-B_i\right)}{1-B_i}. \tag*{(20)}

Grounded in external medical knowledge, RIS leverages frozen disentangled factors as a safety signal complementary to DDI, capturing patient-specific risks. To evaluate the quality of explanations provided by reasoning trajectory, we follow previous work [17, 38, 46] and adopt BLEURT. Specifically, BLEURT measures the semantic alignment between the generated reasoning paths and reference explanations [52]. Meanwhile, we introduce two composite metrics based on harmonic means to measure the pair-wise trade-offs between accuracy, safety, and explainability: FASF_{AS} (Accuracy-Safety) and FAEF_{AE} (Accuracy-Explainability):

FAS=2⋅SAcc⋅SsafeSAcc+Ssafe,FAE=2⋅SAcc⋅BLEURTSAcc+BLEURT,(21)F_{AS}=\frac{2\cdot S_{Acc}\cdot S_{safe}}{S_{Acc}+S_{safe}},\quad F_{AE}=\frac{2\cdot S_{Acc}\cdot\mathrm{BLEURT}}{S_{Acc}+\mathrm{BLEURT}}, \tag*{(21)}

where SAcc=Jaccard+F12S_{Acc}=\frac{\mathrm{Jaccard}+F1}{2} and Ssafe=(1−DDI)+(1−RIS)2S_{safe}=\frac{(1-\mathrm{DDI})+(1-\mathrm{RIS})}{2}.

Baseline Methods. To comprehensively evaluate RES-MR, we select representative and state-of-the-art baselines and group them into three categories: (1) General medication recommendation methods: LEAP [82], COGNet [71], RAREMed [86], ARMR [66], LAMO [85]; (2) Safety methods: SafeDrug [77], MoleRec [78], ARC [7], KELLM [74], FLAME [15]; and (3) Explainable methods: ExpDrug [45], Reason4Rec [17], EXP3RT [29]. Among them, the LLM-based methods include KELLM, LAMO, FLAME, Reason4Rec, and EXP3RT, while the remaining baselines are conventional methods. To ensure a rigorous and fair comparison, we employ MICRON [76] as the backbone of ARC, following the best practice reported in the original paper [7]. For LLM-based methods, we use Llama-3.1-Aloe-Beta-8B [18] as backbone to control for foundation model capacity. Moreover, we transfer Reason4Rec and EXP3RT to our medication recommendation setting.

Implementation Details. All experiments are conducted on a cluster equipped with 8 NVIDIA A100-SXM4 GPUs, Intel Xeon Platinum 8370C CPUs, and 512GB RAM. For the Dual-Factor Disentanglement module, the drug encoder is configured with latent/shared dimensions of 128/512 and pretrained for 100 epochs using Adam with a learning rate of 10−410^{-4}. After pretraining, we freeze the encoder as a fixed feature extractor. We search λorth\lambda_{\mathrm{orth}} in [0.05,0.50][0.05, 0.50] with step size 0.05 and βKL\beta_{\mathrm{KL}} in {1,3,5,7,9}×10−4\{1,3,5,7,9\}\times10^{-4}. For Knowledge Graph Retrieval, we leverage PrimeKG [5], performing 1-hop neighbor expansion via Neo4j and employing beagle- en-v1.5 [73] to retrieve the top-5 entities relevant to clinical notes. In Stage 1, we employ GPT-5 as the teacher model and Llama-3.1-Aloe-Beta-8B [18] as the student model. We set the context length to 8,192 and retain only the latest three visits to limit input length while preserving space for retrieved knowledge. We fine-tune the student via LoRA (Rank r=8r=8, Alpha α=16\alpha=16, Dropout 0.05). The training uses a learning rate of 2×10−42 \times10^{-4}, the AdamW optimizer, and Flash Attention 2 [13]. In Stage 2, we initialize Stage 1 weights, maintaining LoRA settings, and employ GSPO [87] (G=4G = 4, ϵ=0.2\epsilon= 0.2) with a learning rate of 10−610^{-6}. The risk boundary strictness δ\delta is set to 0.9, and reward weights λ{j,e,d,r}\lambda_{\{j,e,d,r\}} are tuned within {1,3,5,7,10}\{1, 3, 5, 7, 10\}. The adaptive gating threshold τt\tau_t is linearly annealed from 0.2 during training. All experiments are repeated five times with different random seeds.

whereas baselines are fully trained on these datasets. We implement RES-MR using both Llama-3.2-3B-Instruct and Llama-3.1-Aloe-Beta-8B backbones to assess performance across different parameter scales, denoted as RES-MR-3B and RES-MR-8B.

Overall Performance Comparison

We evaluate RES-MR on the MIMIC-III dataset across accuracy, safety, and explainability. Meanwhile, following [10, 15], we evaluate the generalization and transferability of our RES-MR by initializing the model with SFT weights from MIMIC-III and performing only one epoch of RAPO training on MIMIC-IV and eICU datasets,

As shown in Table 2, we report the average performance and standard deviations of each method on three datasets. From these results, we observe the following: 1) RES-MR consistently achieves the best overall performance across three datasets. In particular, RES-MR-8B outperforms all baselines, achieving a 7.7% improvement in Jaccard over the state-of-the-art FLAME on MIMIC-III. These gains are attributed to our ECRD, which fosters explicit clinical reasoning rather than mere co-occurrence patterns, and to RAPO, which dynamically optimizes the efficacy-safety trade-off. Notably, under our transfer setting where RES-MR is initialized from MIMIC-III SFT weights and only lightly adapted on MIMIC-IV and eICU, it still maintains superior performance, demonstrating robust transferability. 2) Safety baselines can be overly conservative, making it difficult to balance accuracy and safety and leading to suboptimal performance. For instance, SafeDrug and MoleRec primarily enforce safety via DDI penalties. Consequently, these methods may prioritize interaction avoidance over therapeutic coverage, resulting in overly restricted medication combinations. In contrast, RES-MR achieves the lowest RIS and DDI rates while maintaining superior accuracy. Since RIS is measured with respect to personalized risk boundaries, these results suggest the effectiveness of RAPO in better balancing therapeutic efficacy and safety under patient-specific safety constraints. 3) General reasoning baselines (e.g., Reason4Rec and EXP3RT) provide recommendation rationales but show limited overall performance. While these methods introduce interpretability, they fail to translate their reasoning capabilities into clinically accurate and safe decisions. This limitation may stem from the fact that these frameworks are adapted from general domains that prioritize user preference, and consequently lack explicit modeling of stringent safety constraints and heterogeneous clinical contexts.

DatasetMethodsJaccard ↑\uparrowF1 ↑\uparrowDDI ↓\downarrowRIS ↓\downarrowBLEURT1^{1} ↑\uparrowFASF_{AS} ↑\uparrowFAEF_{AE} ↑\uparrow
MIMIC-IIILEAP0.1934 ±\pm 0.00230.3285 ±\pm 0.00320.1341 ±\pm 0.00120.1433 ±\pm 0.0023-0.4005 ±\pm 0.0029-
COGNet0.2381 ±\pm 0.00190.3628 ±\pm 0.00320.1466 ±\pm 0.00130.1473 ±\pm 0.0021-0.4444 ±\pm 0.0015-
RAREMed0.2244 ±\pm 0.00460.3414 ±\pm 0.00120.1482 ±\pm 0.00460.1547 ±\pm 0.0038-0.4243 ±\pm 0.0026-
ARMR0.2356 ±\pm 0.00550.3599 ±\pm 0.00350.1536 ±\pm 0.00250.1613 ±\pm 0.0035-0.4400 ±\pm 0.0040-
LAMO0.2512 ±\pm 0.00030.3707 ±\pm 0.00270.1124 ±\pm 0.00230.1427 ±\pm 0.0027-0.4585 ±\pm 0.0015-
SafeDrug0.2210 ±\pm 0.00230.3469 ±\pm 0.00120.1054 ±\pm 0.00140.1484 ±\pm 0.0015-0.4285 ±\pm 0.0012-
MoleRec0.2454 ±\pm 0.00520.3770 ±\pm 0.00380.1044 ±\pm 0.00070.1401 ±\pm 0.0005-0.4595 ±\pm 0.0034-
KELLM0.2291 ±\pm 0.00310.3507 ±\pm 0.00290.1318 ±\pm 0.00250.1403 ±\pm 0.0040-0.4341 ±\pm 0.0019-
ARC0.2377 ±\pm 0.00120.3610 ±\pm 0.00380.1167 ±\pm 0.00330.1454 ±\pm 0.0014-0.4453 ±\pm 0.0024-
FLAME0.2601 ±\pm 0.00310.3880 ±\pm 0.00330.1291 ±\pm 0.00090.1374 ±\pm 0.0013-0.4717 ±\pm 0.0026-
ExpDrug0.2326 ±\pm 0.00140.3610 ±\pm 0.00220.1047 ±\pm 0.00170.1397 ±\pm 0.0028-0.4436 ±\pm 0.0016-
Reason4Rec0.1529 ±\pm 0.00360.2519 ±\pm 0.00220.1512 ±\pm 0.00640.1311 ±\pm 0.00260.4052 ±\pm 0.00110.3276 ±\pm 0.00220.2700 ±\pm 0.0015
EXP3RT0.2150 ±\pm 0.00280.3402 ±\pm 0.00260.1589 ±\pm 0.00140.1531 ±\pm 0.00350.3752 ±\pm 0.00050.4178 ±\pm 0.00260.3191 ±\pm 0.0015
RES-MR-3B0.2407 ±\pm 0.00440.3681 ±\pm 0.00170.1041 ±\pm 0.00190.1342 ±\pm 0.00060.4390 ±\pm 0.00300.4524 ±\pm 0.00240.3595 ±\pm 0.0017
RES-MR-8B0.2803 ±\pm 0.0046*0.4179 ±\pm 0.0016*0.1031 ±\pm 0.0006*0.1267 ±\pm 0.0045*0.4538 ±\pm 0.0026*0.5007 ±\pm 0.0020*0.3946 ±\pm 0.0017*
MIMIC-IVLEAP0.1761 ±\pm 0.00550.3105 ±\pm 0.00120.1310 ±\pm 0.00210.1474 ±\pm 0.0039-0.3794 ±\pm 0.0037-
COGNet0.2279 ±\pm 0.00210.3598 ±\pm 0.00080.1391 ±\pm 0.00310.1408 ±\pm 0.0002-0.4380 ±\pm 0.0011-
RAREMed0.2214 ±\pm 0.00060.3447 ±\pm 0.00070.1440 ±\pm 0.00530.1526 ±\pm 0.0015-0.4249 ±\pm 0.0008-
ARMR0.2280 ±\pm 0.00320.3541 ±\pm 0.00060.1499 ±\pm 0.00100.1337 ±\pm 0.0037-0.4347 ±\pm 0.0022-
LAMO0.2359 ±\pm 0.00150.3582 ±\pm 0.00400.1370 ±\pm 0.00120.1410 ±\pm 0.0041-0.4417 ±\pm 0.0022-
SafeDrug0.2107 ±\pm 0.00580.3398 ±\pm 0.00230.1104 ±\pm 0.00340.1473 ±\pm 0.0037-0.4183 ±\pm 0.0041-
MoleRec0.2311 ±\pm 0.00290.3607 ±\pm 0.00310.1084 ±\pm 0.00500.1391 ±\pm 0.0022-0.4424 ±\pm 0.0033-
KELLM0.2013 ±\pm 0.00600.3164 ±\pm 0.00060.1560 ±\pm 0.00070.1401 ±\pm 0.0016-0.3971 ±\pm 0.0035-
ARC0.2297 ±\pm 0.00190.3586 ±\pm 0.00430.1198 ±\pm 0.00480.1374 ±\pm 0.0037-0.4398 ±\pm 0.0026-
FLAME0.2401 ±\pm 0.00560.3644 ±\pm 0.00490.1210 ±\pm 0.00240.1344 ±\pm 0.0043-0.4489 ±\pm 0.0036-
ExpDrug0.2257 ±\pm 0.00220.3516 ±\pm 0.00270.1073 ±\pm 0.00250.1410 ±\pm 0.0038-0.4342 ±\pm 0.0024-
Reason4Rec0.1477 ±\pm 0.00090.2480 ±\pm 0.00290.1476 ±\pm 0.00440.1370 ±\pm 0.00180.4207 ±\pm 0.00300.3215 ±\pm 0.00200.2691 ±\pm 0.0017
EXP3RT0.2055 ±\pm 0.00190.3301 ±\pm 0.00220.1331 ±\pm 0.00320.1431 ±\pm 0.00240.4077 ±\pm 0.00270.4086 ±\pm 0.00210.3233 ±\pm 0.0011
RES-MR-3B0.2301 ±\pm 0.00500.3340 ±\pm 0.00090.1017 ±\pm 0.00210.1303 ±\pm 0.00070.4288 ±\pm 0.00230.4276 ±\pm 0.00290.3403 ±\pm 0.0021
RES-MR-8B0.2525 ±\pm 0.0012*0.3842 ±\pm 0.0030*0.1064 ±\pm 0.00610.1247 ±\pm 0.0034*0.4439 ±\pm 0.0045*0.4682 ±\pm 0.0019*0.3708 ±\pm 0.0015*
eICULEAP0.1831 ±\pm 0.00310.3085 ±\pm 0.00260.1241 ±\pm 0.00060.1364 ±\pm 0.0005-0.3833 ±\pm 0.0021-
COGNet0.2283 ±\pm 0.00310.3580 ±\pm 0.00120.1283 ±\pm 0.00220.1408 ±\pm 0.0012-0.4380 ±\pm 0.0018-
RAREMed0.2323 ±\pm 0.00270.3601 ±\pm 0.00270.1431 ±\pm 0.00100.1412 ±\pm 0.0036-0.4404 ±\pm 0.0021-
LAMO0.2331 ±\pm 0.00070.3674 ±\pm 0.00200.1173 ±\pm 0.00120.1341 ±\pm 0.0044-0.4470 ±\pm 0.0010-
ARMR0.2249 ±\pm 0.00080.3503 ±\pm 0.00160.1491 ±\pm 0.00480.1401 ±\pm 0.0024-0.4305 ±\pm 0.0012-
SafeDrug0.2011 ±\pm 0.00350.3312 ±\pm 0.00870.1104 ±\pm 0.00340.1364 ±\pm 0.0043-0.4083 ±\pm 0.0056-
MoleRec0.2276 ±\pm 0.00140.3532 ±\pm 0.00260.1065 ±\pm 0.00390.1386 ±\pm 0.0022-0.4364 ±\pm 0.0019-
KELLM0.2197 ±\pm 0.00480.3482 ±\pm 0.00170.1211 ±\pm 0.00110.1374 ±\pm 0.0022-0.4282 ±\pm 0.0034-
ARC0.2197 ±\pm 0.00150.3486 ±\pm 0.00220.1201 ±\pm 0.00080.1433 ±\pm 0.0007-0.4282 ±\pm 0.0020-
FLAME0.2397 ±\pm 0.00430.3690 ±\pm 0.00060.1146 ±\pm 0.00660.1311 ±\pm 0.0029-0.4519 ±\pm 0.0021-
ExpDrug0.2158 ±\pm 0.00420.3404 ±\pm 0.00390.1086 ±\pm 0.00380.1324 ±\pm 0.0027-0.4226 ±\pm 0.0040-
Reason4Rec0.1877 ±\pm 0.00150.2871 ±\pm 0.00130.1320 ±\pm 0.00130.1423 ±\pm 0.00490.4277 ±\pm 0.00390.3724 ±\pm 0.00140.3053 ±\pm 0.0011
EXP3RT0.1981 ±\pm 0.00440.3017 ±\pm 0.00430.1552 ±\pm 0.00130.1464 ±\pm 0.00350.4119 ±\pm 0.00490.3862 ±\pm 0.00360.3111 ±\pm 0.0032
RES-MR-3B0.2376 ±\pm 0.00090.3711 ±\pm 0.00170.1074 ±\pm 0.00140.1291 ±\pm 0.00460.4013 ±\pm 0.00160.4525 ±\pm 0.00100.3462 ±\pm 0.0007
RES-MR-8B0.2593 ±\pm 0.0022*0.3908 ±\pm 0.0039*0.1009 ±\pm 0.0009*0.1247 ±\pm 0.0016*0.4368 ±\pm 0.0016*0.4758 ±\pm 0.0021*0.3727 ±\pm 0.0016*

Table 2. Comparison of accuracy, safety, and explainability performance with baselines on the MIMIC-III, MIMIC-IV, and eICU datasets. ↑\uparrow and ↓\downarrow indicate higher and lower is better, respectively. The best and second-best results are highlighted in bold and underlined. * denotes statistical significance (p<0.05p < 0.05) by a paired tt-test.

Ablation Study

To validate the effectiveness of each component in RES-MR, we design the following variants for comparative analysis: 1) w/o Reasoning: Fine-tunes on labels only, skipping the reasoning stage; 2) w/o Retrieval: Removes retrieved context from the input; 3) w/o RAPO: Removes the reinforcement learning stage; 4) w/o Disentangle: Uses raw LLM embeddings without dual-factor disentanglement; 5) w/o Dense/Sparse Reward: Removes dense (Efficacy/Risk) or sparse (Jaccard/DDI) rewards; 6) w/o Trade-off: Uses a fixed static sum instead of a dynamic trade-off; 7) w/o Clipping: Removes the reward clipping. The experimental results in Table 3 indicate several key findings. First, significant accuracy drops for w/o Retrieval and w/o Reasoning confirm that retrieval-augmented reasoning is fundamental for understanding complex clinical contexts and making accurate decisions. Second, the marked increase in DDI rates for w/o RAPO demonstrates that supervised learning alone is insufficient to internalize patient-specific risk boundary, necessitating RL for exploration and correction. Furthermore, the comprehensive performance decline in w/o Disentangle highlights that disentangled factors are critical for constructing high-quality prototypes. Finally, removing specific reward components or the Trade-off/Clipping mechanisms hinders the model from achieving

MethodsJaccard ↑DDI ↓BLEURT ↑
RES-MR w/o Reasoning0.24140.1474-
RES-MR w/o Retrieval0.22440.16260.4117
RES-MR w/o RAPO0.26680.15050.4408
RES-MR w/o Disentangle0.26310.12110.4410
RES-MR w/o Dense Reward0.27140.11030.4483
RES-MR w/o Sparse Reward0.26310.13860.4396
RES-MR w/o Trade-off0.27030.13240.4387
RES-MR w/o Clipping0.26880.10860.4337
RES-MR-8B0.28030.10310.4538

Table 3. Ablation study of RES-MR on the MIMIC-III dataset.

an optimal balance between efficacy and safety (e.g., w/o Clipping may induce reward hacking, ignoring safety risks for high scores), highlighting the importance of our fine-grained reward design.

Hyperparameter Analysis

In this section, we analyze the impact of four key hyperparameters on the performance of RES-MR on the MIMIC-III dataset, i.e., Jaccard reward weight λj\lambda_j, efficacy bonus weight λe\lambda_e, DDI penalty weight λd\lambda_d, and risk penalty weight λr\lambda_r. We vary these parameters within the range of {1,3,5,7,10}\{1, 3, 5, 7, 10\} and report the results of Jaccard and DDI rate in Figure 3. As shown in Figure 3 (a) and (b), increasing efficacy-related weights generally encourages the model to better fit the target medication distribution. However, we observe that an excessively large λe\lambda_e leads to a slight decline in Jaccard. This suggests that over-emphasizing semantic similarity may divert the model towards “functionally similar” alternatives rather than the exact ground-truth labels, causing a drop in performance. Figure 3 (c) and (d) illustrate the trade-off between accuracy and safety. As λd\lambda_d and λr\lambda_r increase, DDI rates decrease significantly, validating the effectiveness of RAPO in suppressing unsafe behaviors. Notably, extremely high penalties cause a sharp collapse in Jaccard, reflecting an over-conservative policy that refuses prescriptions to avoid potential risks. Given that clinical safety is our primary consideration, we select weight settings that strictly control risks, even though this may incur a marginal loss in accuracy.

Hyperparameter effects on model performance

Figure 3. Hyperparameter effects on model performance.

Efficiency Analysis

To assess practical deployability, we compare the computational costs of RES-MR with representative LLM-based baselines in Figure 4, with all experiments conducted in a unified hardware environment. While KELLM achieves the lowest time due to its non-generative discriminative design, RES-MR demonstrates superior efficiency among generative LLM-based methods. Specifically, regarding training, RES-MR requires approximately 125 GPU-hours, significantly lower than FLAME, which relies on a resource-intensive multi-stage training pipeline. In terms of inference, unlike reasoning-enhanced baselines such as Reason4Rec and EXP3RT that incur high time overheads due to generating lengthy rationales, RES-MR achieves an inference time of only 13.3 s, comparable to the non-reasoning baseline LAMO. This efficiency is primarily attributed to the ECRD stage, which distills concise, clinically grounded reasoning paths, avoiding costly multi-pass generation during inference.

Efficiency analysis of training cost and inference time on MIMIC-III

Figure 4. Efficiency analysis of training cost and inference time on MIMIC-III. Training uses 8× NVIDIA A100 GPUs, while inference uses a single NVIDIA A100 GPU.

Explanation Quality Assessment

To evaluate explanation quality, we conduct a blind pairwise comparison on 50 randomly sampled MIMIC-III test instances, assessed by both GPT-5 and three human evaluators with medical or pharmaceutical backgrounds. The evaluation assesses the generated explanations via Reasonableness and Verifiability, and the recommended medication sets via Effectiveness and Safety. Note that ExpDrug is evaluated only on the latter two due to its lack of textual explanations. As shown in Figure 5, RES-MR consistently outperforms baselines. This superiority stems from ECRD, which enables the model to internalize verifiable, clinically grounded reasoning paths, and RAPO, which explicitly enforces safety via reward shaping. Moreover, human evaluators show substantial inter-rater agreement across all four dimensions (Fleiss’ κ>0.7\kappa> 0.7), and the agreement between human and GPT-5 judgments further supports the reliability of these findings.

Human and GPT evaluations on pairwise quality comparison of explanations

Figure 5. Human and GPT evaluations on pairwise quality comparison of explanations (p-value < 0.05).

Case Study

Table 4 exemplifies how RES-MR generates medication recommendations with verifiable explanations. Instead of relying on superficial co-occurrence, the model demonstrates deep reasoning: it adheres to procedural protocols by recommending Neostigmine and Glycopyrronium for neuromuscular blockade reversal, while leveraging pharmacological knowledge from Knowledge Graph Retrieval to anticipate Furosemide-induced hypokalemia, proactively co-prescribing Potassium Chloride. Furthermore, in addressing the conflict between stroke risk (AFib) and postoperative bleeding, RES-MR leverages fine-grained risk perception from RAPO to establish a patient-specific risk boundary. It prudently advises prescribing Warfarin only “once hemostasis is secured.” This nuance attests to the model’s ability to handle intricate clinical trade-offs while generating verifiable rationales and accurate, safe recommendations.

Subject 41115 (80y, Male). Proc: AVR + CABG. Hx: AFib, HTN.
ContextVerifiable Rationale → Recommendation
Surgical ProtocolExpl: “Given extracorporeal circulation, requires reversal of neuromuscular blockade...” → Rec: Neostigmine, Glycopyrronium
Stroke RiskExpl: “Restart Warfarin post-op once hemostasis secured to prevent thromboembolism.” → Rec: Warfarin (personalized risk boundary)
Fluid BalanceExpl: “Replete K+ losses caused by aggressive diuresis to maintain electrical stability.” → Rec: Furosemide, Potassium Cl

Table 4. A case study of a patient in the MIMIC-III dataset.

Conclusion

In this paper, we proposed RES-MR, a novel risk-aware reasoning framework designed to address the critical challenges of interpretability and personalized safety in medication recommendation. By integrating Explainable Clinical Reasoning Distillation (ECRD) for transparent reasoning and Risk-Aware Policy Optimization (RAPO) for dynamic safety balancing, RES-MR transforms recommendations into an explainable, verifiable process. Experiments on three datasets demonstrate that RES-MR significantly outperforms state-of-the-art baselines, achieving a superior accuracy-safety trade-off. In future work, we will explore agentic reasoning workflows with iterative retrieval and self-verification to strengthen faithful clinical reasoning and further enhance decision reliability.

Acknowledgments

This work is supported by the National Natural Science Foundation of China (No. 62376130), Program of New Twenty Policies for Universities of Jinan (No.202333008), and the Pilot Project for Integrated Innovation of Science, Education, Industry of Qilu University of Technology (Shandong Academy of Sciences) (No.2025ZDZX01).

References

  1. [1]Zafar Ali, Yiu Huang, Irfan Ullah, Junlan Feng, Chao Deng, Nimbeshaho Thierry, et al. 2023. Deep learning for medication recommendation: A systematic survey. Data Intelligence 5, 2 (2023), 303–354.DOI
  2. [2]Keqin Bao, Jizhi Zhang, Yang Zhang, Wenjie Wang, Fuli Feng, et al. 2023. TALLRec: An effective and efficient tuning framework to align large language model with recommendation. In Proceedings of the 17th ACM Conference on Recommender Systems. 1007–1014.DOI
  3. [3]Suman Bhoi, Mong Li Lee, Wynne Hsu, Hao Sen Andrew Fang, et al. 2021. Personalizing medication recommendation with a graph-based approach. ACM Transactions on Information Systems 40, 3 (2021), 1–23.DOI
  4. [4]Suman Bhoi, Mong Li Lee, Wynne Hsu, and Ngiap Chuan Tan. 2023. REFINE: A fine-grained medication recommendation system using deep learning and personalized drug interaction modelling. In Proceedings of the 37th International Conference on Neural Information Processing Systems. 24013–24024.DOI
  5. [5]Payal Chandak, Kexin Huang, and Marinka Zitnik. 2023. Building a knowledge graph to enable precision medicine. Scientific Data 10, 1 (2023), 1–16.DOI
  6. [6]Lichang Chen, Chen Zhu, Jiuhai Chen, Davit Soselia, Tianyi Zhou, et al. 2024. ODIN: Disentangled reward mitigates hacking in RLHF. In Proceedings of the 41st International Conference on Machine Learning. 7935–7952.arxiv.org/abs/2402.07319
  7. [7]Qianyu Chen, Xin Li, Yujie Fang, and Mingzhong Wang. 2025. Advancing confidence calibration and quantification in medication recommendation. In Proceedings of the 31st ACM SIGKDD Conference on Knowledge Discovery and Data Mining. 106–117.DOI
  8. [8]Qianyu Chen, Xin Li, Kunnan Geng, and Mingzhong Wang. 2023. Context-aware safe medication recommendations with molecular graph and DDI graph embedding. In Proceedings of the 37th AAAI Conference on Artificial Intelligence. 7053–7060.
  9. [9]Daixuan Cheng, Shaohan Huang, Xuekai Zhu, Bo Dai, Wayne Xin Zhao, Zhenliang Zhang, and Furu Wei. 2025. Reasoning with exploration: An entropy perspective. arXiv preprint arXiv:2506.14758 (2025), 1–19.arxiv.org/abs/2506.14758
  10. [10]Tianzhe Chu, Yuexiang Zhai, Jihan Yang, Shengbang Tong, Saining Xie, Dale Schuurmans, Quoc V Le, Sergey Levine, and Yi Ma. 2025. SFT memorizes, RL generalizes: A comparative study of foundation model post-training. In Proceedings of the 42nd International Conference on Machine Learning. 1–21.arxiv.org/abs/2501.17161
  11. [11]Sunhao Dai, Ning Luo Hao, Haiyuan Zhao, Weijie Yu, Zihua Si, et al. 2023. Uncovering ChatGPT’s capabilities in recommender systems. In Proceedings of the 17th ACM Conference on Recommender Systems. 1126–1132.
  12. [12]Zhuohang Dang, Min­nan Luo, Jihong Wang, Chengyou Jia, Haochen Han, et al. 2025. Disentangled noisy correspondence learning. IEEE Transactions on Image Processing 34, 1 (2025), 2602–2615.arxiv.org/abs/2408.05503
  13. [13]Tri Dao. 2024. FlashAttention-2: Faster attention with better parallelism and work partitioning. In Proceedings of the 12th International Conference on Learning Representations. 1–14.
  14. [14]Mingliang Dou, Jun Tang, Prayag Tiwari, Yijie Ding, and Fei Guo. 2024. Drug–drug interaction relation extraction based on deep learning: A review. Comput. Surveys 56, 6 (2024), 1,33.
  15. [15]Chenxiao Fan, Chongming Gao, Wentao Shi, Yaxin Gong, Zhao Zhaio, et al. 2025. Fine-grained list-wise alignment for generative medication recommendation. In Proceedings of the 39th Annual Conference on Neural Information Processing Systems. 1–17.
  16. [16]Yue Fang, Yuxin Guo, Jiaran Gao, Hongxin Ding, Xinke Jiang, et al. 2025. Toward better EHR reasoning in LLMs: Reinforcement learning with expert attention guidance. arXiv preprint arXiv:2508.13579 (2025), 1–18.
  17. [17]Yi Fang, Wenjie Wang, Yang Zhang, Fengbin Zhu, Qifan Wang, et al. 2025. Reason4Rec: Large language models for recommendation with deliberative user preference alignment. arXiv preprint arXiv:2502.02061 (2025), 1–11.
  18. [18]Dario Garcia-Gasulla, Jordi Bayarri-Planas, Ashwin Kumar Gururajan, Enrique Lopez-Cuena, Adrian Tormos, et al. 2025. The aloe family recipe for open and specialized healthcare LLMs. arXiv preprint arXiv:2505.04388 (2025), 1–82.
  19. [19]Fan Gong, Meng Wang, Haofen Wang, Sen Wang, and Mengyue Liu. 2021. SMR: Medical knowledge graph embedding for safe medicine recommendation. Big Data Research 23, 1 (2021), 1–9.
  20. [20]Daya Guo, Dejian Yang, Haowei Zhang, Junxiao Song, Ruoyu Zhang, et al. 2025. DeepSeek-R1 incentivizes reasoning in LLMs through reinforcement learning. arXiv preprint arXiv:2501.12948 (2025), 1–11.
  21. [21]Ming He, Yongjie Zheng, Changle Li, and Man Zhou. 2025. Improving the safety of medication recommendation via graph augmented patient similarity network. In Proceedings of the 34th ACM International Conference on Information and Knowledge Management. 833–842.
  22. [22]Health Care Financing Administration, National Center for Health Statistics, and Commission on Professional and Hospital Activities. 1989. The international classification of diseases, 9th revision, clinical modification: ICD-9-CM. Vol. 3. Commission on Professional and Hospital Activities.
  23. [23]Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, Weizhu Chen, et al. 2022. LoRA: Low-rank adaptation of large language models. In Proceedings of the 10th International Conference on Learning Representations. 1–20.
  24. [24]Shizhe Hu, Zhengzheng Lou, Xiaoqiang Yan, and Yangdong Ye. 2024. A survey on information bottleneck. IEEE Transactions on Pattern Analysis and Machine Intelligence 46, 8 (2024), 5325–5344.
  25. [25]Chengkai Huang, Shoujin Wang, Xianzhi Wang, and Lina Yao. 2023. Dual contrastive transformer for hierarchical preference modeling in sequential recommendation. In Proceedings of the 46th international acm sigir conference on research and development in information retrieval. 99–109.
  26. [26]Alistair E. W. Johnson, Lucas Bulgarelli, Lu Shen, Alex Gayles, Aya Shammout, et al. 2023. MIMIC-IV, A freely accessible electronic health record dataset. Scientific Data 10, 1 (2023), 1.
  27. [27]Alistair E W Johnson, Tom J Pollard, Lu Shen, Li-Wei H Lehman, Mengling Feng, et al. 2016. MIMIC-III, A freely accessible critical care database. Scientific Data 3, 1 (2016), 1–9.
  28. [28]Minki Kang, Seanie Lee, Jinheon Baek, Kenji Kawaguchi, and Sung Ju Hwang. 2023. Knowledge-augmented reasoning distillation for small language models in knowledge-intensive tasks. In Proceedings of the 37th Annual Conference on Neural Information Processing Systems. 1–30.
  29. [29]Jieyong Kim, Hyunseo Kim, Hyunjin Cho, SeongKu Kang, Buru Chang, et al. 2025. Review-driven personalized preference reasoning with large language models for recommendation. In Proceedings of the 48th International ACM SIGIR Conference on Research and Development in Information Retrieval. 1697–1706.
  30. [30]Taeri Kim, Jiho Heo, Hyunjoon Kim, and Sang-Wook Kim. 2025. HI-DR: Exploiting health status-aware attention and an EHR graph+ for effective medication recommendation. In Proceedings of the 39th AAAI Conference on Artificial Intelligence. 11950–11958.
  31. [31]Taeri Kim, Jiho Heo, Hongil Kim, Kijung Shin, and Sang-Wook Kim. 2024. VITA: ‘Carefully chosen and weighted less’ is better in medication recommendation. In Proceedings of the 38th AAAI Conference on Artificial Intelligence. 8600–8607.
  32. [32]Diederik P. Kingma and Max Welling. 2014. Auto-encoding variational bayes. In Proceedings of the 2nd International Conference on Learning Representations. 1–14.arxiv.org/abs/1312.6114
  33. [33]Erika Y Lee, Tara Gomes, Aaron M Drucker, Nick Daneman, Ayesha Asaf, et al. 2024. Oral antibiotics and risk of serious cutaneous adverse drug reactions. Journal of the American Medical Association 332, 9 (2024), 730–737.
  34. [34]Jin Li, Huilin Guo, Shoujin Wang, Qi Zhang, Shui Yu, Chen Wang, Xiewei Xu, and Fang Chen. 2026. Towards Fair Large Language Model-based Recommender Systems without Costly Retraining. arXiv preprint arXiv:2601.17492 (2026).
  35. [35]Xin Li, Zhuo Cai, Shoujin Wang, Kun Yu, and Fang Chen. 2025. A survey on enhancing causal reasoning ability of large language models. In Pacific-Asia Conference on Knowledge Discovery and Data Mining. 399–416.
  36. [36]Yishuo Li, Zhufeng Shao, Weimin Chen, Shoujin Wang, Yuehan Du, and Wengpeng Lu. 2024. Significance-aware medication recommendation with medication representation learning. In Proceedings of the 27th International Conference on Computer Supported Cooperative Work in Design, Vol. 1. 1633–1638.
  37. [37]Yishuo Li, Qi Zhang, Wengpeng Lu, Xueping Peng, Weiyu Zhang, et al. 2025. Time-aware medication recommendation via intervention of dynamic treatment regimes. In Proceedings of the 34th ACM on Web Conference. 5161–5172.
  38. [38]Yuhan Li, Xinni Zhang, Linhao Luo, Heng Chang, Yuanqing Ren, et al. 2025. G-Refer: Graph retrieval-augmented large language model for explainable recommendation. In Proceedings of the 34th ACM on Web Conference. 240–251.
  39. [39]Jiahao Liu, Shengkang Gu, Dongsheng Li, Guangping Zhang, Mingzhe Han, et al. 2025. AgentCF++: Memory-enhanced LLM-based agents for popularity-aware cross-domain recommendations. In Proceedings of the 48th International ACM SIGIR Conference on Research and Development in Information Retrieval. 2566–2571.
  40. [40]Jiahao Liu, Xueshuo Yan, Dongsheng Li, Guangping Zhang, Hansu Gu, Peng Zhang, et al. 2025. Improving LLM-powered recommendations with personalized information. In Proceedings of the 48th International ACM SIGIR Conference on Research and Development in Information Retrieval. 2560–2565.
  41. [41]Qidong Liu, Zhaoqiong Qiu, Xiangyu Zhao, Xian Wu, Zijian Zhang, et al. 2025. A contrastive pretrain model with prompt tuning for multi-center medication recommendation. ACM Transactions on Information Systems 43, 3 (2025), 1–29.
  42. [42]Qidong Liu, Xian Wu, Xiangyu Zhao, Yuanshao Zhu, Zijian Zhang, et al. 2024. Large language model distilling medication recommendation Model. arXiv preprint arXiv:2402.02803 (2024), 1–12.arxiv.org/abs/2402.02803
  43. [43]Wenpeng Lu, Kangjun Liu, Juanlei Wang, Xueping Peng, Tao Shen, Fa Zhu, Weiyu Zhang, Jiabing Zhu, Tao Xin, and Athanasios V. Vasilakos. 2025. Advancing chinese conversation-based patient guidance with a benchmark and knowledge-evolvable assistant. IEEE Journal of Biomedical and Health Informatics 1, 1 (2025), 1–12.
  44. [44]Wenpeng Lu, Yuteng Zhang, Shoujin Wang, Heyan Huang, Qian Liu, and Sheng Luo. 2020. Concept representation by learning explicit and implicit concept couplings. IEEE Intelligent Systems 36, 1 (2020), 6–15.
  45. [45]Xuan Lu, Yanhong Hao, Furong Peng, Zheqing Zhu, and Zhanwen Cheng. 2025. ExpDrug: An explainable drug recommendation model based on space feature mapping. Neurocomputing 619 (2025), 1–11.
  46. [46]Qiyao Ma, Zubin Ren, and Chao Huang. 2024. XRec: Large language models for explainable recommendation. In Findings of the 29th Conference on Empirical Methods in Natural Language Processing. 391–402.
  47. [47]Costas Marvromatis and George Karypis. 2025. GNN-RAG: Graph neural retrieval for efficient large language model reasoning on knowledge graphs. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics. 16682–16699.
  48. [48]Anton Nilsson, Jonas Björk, and Carl Bonander. 2022. Proxy variables and the generalizability of study results. American Journal of Epidemiology 192, 3 (2022), 448–454.
  49. [49]Susana Nunes, Samy Baddredine, and Catia Pesquita. 2025. Rewarding explainability in drug repurposing with knowledge graphs. In Proceedings of the 34th International Joint Conference on Artificial Intelligence. 4624–4632.
  50. [50]Yang Ouyang, Yuchen Wu, He Wang, Chenyang Zhang, Furui Cheng, et al. 2024. Leveraging historical medical records as a proxy via multimodal modeling and visualization to enrich medical diagnostic learning. IEEE Transactions on Visualization and Computer Graphics 30, 1 (2024), 1238–1248.
  51. [51]Tom J. Pollard, Alistair E. W. Johnson, Jesse D. Raffa, Leo A. Celi, Roger G. Mark, et al. 2018. The eICU collaborative research database, A freely available multi-center database for critical care research. Scientific Data 5, 1 (2018), 180178.DOI
  52. [52]Sellam, Thibault and Das, Dipanjan and Parikh, Ankur. 2020. BLEURT: Learning robust metrics for text generation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics. 7881–7892.
  53. [53]Alyaa Hamel Sayyih, Nasri Sulaiman, and Ahmad H Sabry. 2023. A review on lung disease recognition by acoustic signal analysis with deep learning networks. Journal of Big Data 10, 1 (2023), 101.
  54. [54]Junyuan Shang, Tengfei Ma, Cao Xiao, and Jimeng Sun. 2019. Pre-training of graph augmented transformers for medication recommendation. In Proceedings of the 28th International Joint Conference on Artificial Intelligence. 5953–5959.arxiv.org/abs/1906.00346
  55. [55]Junyuan Shang, Cao Xiao, Tengfei Ma, Hongyan Li, and Jimeng Sun. 2019. GAMENet: Graph augmented memory networks for recommending medication combination. In Proceedings of the 33rd AAAI Conference on Artificial Intelligence. 1126–1133.arxiv.org/abs/1809.01852
  56. [56]Yanchao Tan, Chengjun Kong, Leisheng Yu, Pan Li, Chaochao Chen, et al. 2022. 4SDrug: Symptom-based set-to-set small and safe drug recommendation. In Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining. 3970–3980.DOI
  57. [57]Alicia Tsai, Adam Kraft, Long Jin, Chenwei Cai, Anahita Hosseini, et al. 2024. Leveraging LLM reasoning enhances personalized recommender systems. In Findings of the 62nd Annual Meeting of the Association for Computational Linguistics. 13176–13188.arxiv.org/abs/2408.00802
  58. [58]Boyuan Wang, Yun Qiu, Yuhang Jiang, Jianzhun Shao, Chang Liu, et al. 2024. LLM-empowered state representation for reinforcement learning. In Proceedings of the 41st International Conference on Machine Learning. 51348–51375.arxiv.org/abs/2407.13237
  59. [59]Nan Wang, Shoujin Wang, Yan Wang, Quan Z Sheng, and Mehmet Orgun. 2020. Modelling local and global dependencies for next-item recommendations. In International Conference on Web Information Systems Engineering. Springer, 285–300.DOI
  60. [60]Nan Wang, Shoujin Wang, Yan Wang, Quan Z Sheng, and Mehmet A Orgun. 2022. Exploiting intra- and inter-session dependencies for session-based recommendations. World Wide Web 25, 1 (2022), 425–443.DOI
  61. [61]Shijie Wang, Wenqi Fan, Yue Feng, Lin Shanru, Xinyu Ma, et al. 2025. Knowledge graph retrieval-augmented generation for LLM-based recommendation. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics. 27152–27168.arxiv.org/abs/2501.02226
  62. [62]Shoujin Wang, Wentao Wang, Xiuzhen Zhang, Yan Wang, Huan Liu, and Fang Chen. 2024. A hierarchical and disentangling interest learning framework for unbiased and true news recommendation. In Proceedings of the 30th ACM SIGKDD Conference on Knowledge Discovery and Data Mining. 3200–3211.DOI
  63. [63]Yanda Wang, Weitong Chen, Dechang PI, Lin Yue, Sen Wang, et al. 2021. Self-supervised adversarial distribution regularization for medication recommendation. In Proceedings of the 30th International Joint Conference on Artificial Intelligence. 3134–3140.DOI
  64. [64]Shoujin Wang Guoqiang Zhang Xu Zhang Antai Ouyang Xiaodong Zhang Wenpeng Lu, Fangieng Meng. 2019. Graph-Based Chinese Word Sense Disambiguation with Multi-Knowledge Integration. Computers, Materials & Continua 61, 1 (2019), 179–212.DOI
  65. [65]David S Wishart, Yannick D Feunang, An C Guo, Elvis J Lo, Ana Marcu, et al. 2018. DrugBank 5.0: A major update to the DrugBank database for 2018. Nucleic Acids Research 46, D1 (2018), D1074–D1082.DOI
  66. [66]Feiyue Wu, Tianxing Wu, and Shenqi Jing. 2025. ARMR: Adaptively responsive network for medication recommendation. In Proceedings of the 34th International Joint Conference on Artificial Intelligence. 7831–7839.arxiv.org/abs/2507.04428
  67. [67]Jialun Wu, Yuxin Dong, Zeyu Gao, Tieliang Gong, and Chen Li. 2023. Dual attention and patient similarity network for drug recommendation. Bioinformatics 39, 1 (2023), 1–12.DOI
  68. [68]Jie Wu, Yu Gao, Zilyu Ye, Ming Li, Liang Li, et al. 2025. Rewarddance: Reward scaling in visual generation. arXiv preprint arXiv:2509.08826 (2025), 1–19.arxiv.org/abs/2509.08826
  69. [69]Jialun Wu, Kai He, Rui Mao, Xuequn Shang, and Erik Cambria. 2025. Harnessing the potential of multimodal EHR Data: A comprehensive survey of clinical predictive modeling for intelligent healthcare. Information Fusion 123 (2025), 103283.DOI
  70. [70]Jialun Wu, Buuyue Qian, Yang Li, Zeyu Gao, Meizhi Ju, Yifan Yang, et al. 2022. Leveraging multiple types of domain knowledge for safe and effective drug recommendation. In Proceedings of the 31st ACM International Conference on Information & Knowledge Management. 2169–2178.DOI
  71. [71]Rui Wu, Zhaopeng Qiu, Jiacheng Jiang, Guilin Qi, and Xian Wu. 2022. Conditional generation net for medication recommendation. In Proceedings of the 31st ACM Web Conference. 935–945.DOI
  72. [72]Su Xian, Monika E Grabowska, Iftikhar J Kullo, Yuan Luo, Jordan W Smoller, et al. 2025. Transformer patient embedding using electronic health records enables patient stratification and progression analysis. npj Digital Medicine 8, 1 (2025), 521.DOI
  73. [73]Shitao Xiao, Zheng Liu, Peitian Zhang, Niklas Muennighoff, Defu Lian, and Jian-Yun Nie. 2024. C-pac: Packed resources for general chinese embeddings. In Proceedings of the 47th international ACM SIGIR Conference on Research and Development in Information Retrieval. 641–649.arxiv.org/abs/2309.07597
  74. [74]Tianhan Xu and Bin Li. 2025. KELLM: Knowledge-enhanced label-wise large language model for safe and interpretable drug recommendation. Electronics 14, 1 (2025), 1–23.DOI
  75. [75]Zhenchao Xu, Mark Jerome Cruz, Matthew Guevara, Tie Wang, Manasi Deshpande, et al. 2024. Retrieval-augmented generation with knowledge graphs for customer service question answering. In Proceedings of the 47th International ACM SIGIR Conference on Research and Development in Information Retrieval. 2905–2909.DOI
  76. [76]Chaoqi Yang, Cao Xiao, Lucas Glass, and Jimeng Sun. 2021. Change matters: Medication change prediction with recurrent residual networks. In Proceedings of the 30th International Joint Conference on Artificial Intelligence. 3728–3734.arxiv.org/abs/2105.01876
  77. [77]Chaoqi Yang, Cao Xiao, Fenglong Ma, Lucas Glass, and Jimeng Sun. 2021. Safe-Drug: Dual molecular graph encoders for recommending effective and safe drug combinations. In Proceedings of the 30th International Joint Conference on Artificial Intelligence. 3735–3741.arxiv.org/abs/2105.02711
  78. [78]Nianzhu Yang, Kaipeng Zeng, Qitian Wu, and Junchi Yan. 2023. MoleRec: Combinatorial drug recommendation with substructure-aware molecular representation learning. In Proceedings of the 32nd ACM Web Conference. 4075–4085.DOI
  79. [79]Qiying Yu, Zheng Zhang, Ruofei Zhu, Yufeng Yuan, Xiaocheng Zuo, et al. 2025. DAPO: An open-source LLM reinforcement learning system at scale. arXiv preprint arXiv:2503.14476 (2025), 1–16.arxiv.org/abs/2503.14476
  80. [80]Haodi Zhang, Jiawei Wen, Jiahong Li, Yuanfeng Song, Liang-Jie Zhang, et al. 2025. SSPRNet: Leveraging robust medication recommendation with history and knowledge. In Proceedings of the 34th International Joint Conference on Artificial Intelligence. 9465–9473.
  81. [81]Qi Zhang, Yayi Yang, Chongyang Shi, An Lao, Liang Hu, Shoujin Wang, and Usman Naseem. 2024. Rumor Detection With Hierarchical Representation on Bipartite Ad Hoc Event Trees. IEEE Transactions on Neural Networks and Learning Systems 35, 10 (2024), 14112–14124.DOI
  82. [82]Yutao Zhang, Robert Chen, Jie Tang, Walter F Stewart, and Jimeng Sun. 2017. LEAP: Learning to prescribe effective and safe treatment combinations for multimorbidity. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. 1315–1324.DOI
  83. [83]Yingying Zhang, Xian Wu, Quan Fang, Shengsheng Qian, and Changsheng Xu. 2023. Knowledge-enhanced attributed multi-task learning for medicine recommendation. ACM Transactions on Information Systems 41, 1 (2023), 1–24.DOI
  84. [84]Chuang Zhao, Hongke Zhao, Xiaofang Zhou, and Xiaomeng Li. 2024. Enhancing precision drug recommendations via in-depth exploration of motif relationships. IEEE Transactions on Knowledge and Data Engineering 36, 12 (2024), 8164–8178.DOI
  85. [85]Zihao Zhao, Chenxiao Fan, Chongming Gao, Fuli Feng, and Xiangnan He. 2025. Fine-grained alignment of large language models for general medication recommendation without overprescription. arXiv preprint arXiv:2503.03687 (2025), 1–17.arxiv.org/abs/2503.03687
  86. [86]Zihao Zhao, Yi Jing, Fuli Feng, Jiancan Wu, Chongming Gao, et al. 2024. Leave no patient behind: Enhancing medication recommendation for rare disease patients. In Proceedings of the 47th International ACM SIGIR Conference on Research and Development in Information Retrieval. 533–542.arxiv.org/abs/2403.17745
  87. [87]Chujie Zheng, Shixuan Liu, Mingze Li, Xiong-Hui Chen, Bowen Yu, et al. 2025. Group sequence policy optimization. arXiv preprint arXiv:2507.18071 (2025), 1–7.arxiv.org/abs/2507.18071
  88. [88]Zhi Zheng, Chao Wang, Tong Xu, Dazhong Shen, Penggang Qin, et al. 2023. Interaction-aware drug package recommendation via policy gradient. ACM Transactions on Information Systems 41, 1 (2023), 1–32.DOI
  89. [89]Peilin Zhou, Chao Liu, Jing Ren, Kinfeng Zhou, Yueqi Xie, Meng Cao, Zhongtao Rao, You-Liang Huang, Dading Chong, Junling Liu, Jae Boum Kim, Shoujin Wang, Raymond Chi-Wing Wong, and Sunghun Kim. 2025. When Large Vision Language Models Meet Multimodal Sequential Recommendation: An Empirical Study. In Proceedings of the ACM on Web Conference 2025. 275–292.DOI

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