RES-MR: Risk-Aware Reasoning for Explainable and Safe Medication Recommendation
Authors: Cong Wang, Jin Li, Shoujin Wang, Yishuo Li, Huilin Gu, Wenpeng Lu
Organizations: Key Laboratory of Computing Power Network and Information Security, Ministry of Education, Shandong Computer Science Center (National Supercomputer Center in Jinan), Qilu University of Technology (Shandong Academy of Sciences); Shandong Provincial Key Laboratory of Computing Power Internet and Service Computing, Shandong Fundamental Research Center for Computer Science, Jinan, Shandong, China · University of Technology Sydney, Sydney, NSW, Australia
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.
Figures & tables
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.
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.
Items
MIMIC-III
MIMIC-IV
eICU
# of visits / # of patients
12,433 / 4,785
156,315 / 46,811
18,636 / 8,544
dis. / proc. / med. space size
4,316 / 1,330 / 593
19,812 / 10,859 / 743
1,562 / 937 / 152
avg. / max # of visits
5.68 / 29
11.07 / 70
2.18 / 9
avg. / max # of dis. per visit
14.68 / 39
13.45 / 56
4.79 / 76
avg. / max # of proc. per visit
4.69 / 32
2.75 / 34
8.03 / 118
avg. / max # of med. per visit
14.78 / 67
14.24 / 128
10.35 / 51
Table 1. Statistics on MIMIC-III, MIMIC-IV, and eICU Datasets
Dataset
Methods
Jaccard ↑
F1 ↑
DDI ↓
RIS ↓
BLEURT 1 ↑
FAS↑
FAE↑
MIMIC-III
LEAP
0.1934 ± 0.0023
0.3285 ± 0.0032
0.1341 ± 0.0012
0.1433 ± 0.0023
-
0.4005 ± 0.0029
-
COGNet
0.2381 ± 0.0019
0.3628 ± 0.0032
0.1466 ± 0.0013
0.1473 ± 0.0021
-
0.4444 ± 0.0015
-
RAREMed
0.2244 ± 0.0046
0.3414 ± 0.0012
0.1482 ± 0.0046
0.1547 ± 0.0038
-
0.4243 ± 0.0026
-
ARMR
0.2356 ± 0.0055
0.3599 ± 0.0035
0.1536 ± 0.0025
0.1613 ± 0.0035
-
0.4400 ± 0.0040
-
LAMO
0.2512 ± 0.0003
0.3707 ± 0.0027
0.1124 ± 0.0023
0.1427 ± 0.0027
-
0.4585 ± 0.0015
-
SafeDrug
0.2210 ± 0.0023
0.3469 ± 0.0012
0.1054 ± 0.0014
0.1484 ± 0.0015
-
0.4285 ± 0.0012
-
Table 2. Comparison of accuracy, safety, and explainability performance with baselines on the MIMIC-III, MIMIC-IV, and eICU datasets. ↑ and ↓ indicate higher and lower is better, respectively. The best and second-best results are highlighted in bold and underlined . * denotes statistical significance ( p<0.05 ) by a paired t -test.
Methods
Jaccard ↑
DDI ↓
BLEURT ↑
RES-MR w/o Reasoning
0.2414
0.1474
-
RES-MR w/o Retrieval
0.2244
0.1626
0.4117
RES-MR w/o RAPO
0.2668
0.1505
0.4408
RES-MR w/o Disentangle
0.2631
0.1211
0.4410
RES-MR w/o Dense Reward
0.2714
0.1103
0.4483
RES-MR w/o Sparse Reward
0.2631
0.1386
0.4396
Table 3. Ablation study of RES-MR on the MIMIC-III dataset.
Figure 3. Hyperparameter effects on model performance.
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.
Figure 5. Human and GPT evaluations on pairwise quality comparison of explanations (p-value < 0.05).
Medication recommendation predicts medications for patient visits, but existing methods still face two key challenges. At the model level, traditional drug recommendation methods only predict structured drug codes with limited evidence grounding, while LLM agents can use richer clinical context but may lack safety verification and traceability. At the task level, existing benchmarks often use broad medication categories, which ignore subgroup-level safety differences and can lead to risk overestimation. We introduce the first fine-grained medication recommendation setting based on fourth-level ATC code generation. We propose Safe Prescription Agent (SafeRx-Agent), a knowledge-grounded multi-agent framework that uses patient context, external clinical knowledge, and safety verification to recommend traceable medication sets. Experimental results on MIMIC-III and MIMIC-IV datasets show that SafeRx-Agent improves fine-grained medication prediction accuracy while controlling drug interactions, contraindications, and medication set size.
Xinyu Wang, Hanwei Wu, Zhenghan Tai +7
McGill University · McMaster University · University of Toronto +1
Medication recommendation (MR) is critical for clinical decision support. While existing MR methods are mostly designed for single-center learning, where only one independent hospital is involved, multi-center MR with hospitals of different scales has become increasingly demanding in practice. In multi center settings, abundant data from large medical centers can improve recommendation performance for low-resource centers. Despite a few preliminary attempts on this task, two critical gaps remain. Gap 1: Existing multi-center methods fail to disentangle transferable cross-hospital clinical experience from hospital-specific prescribing patterns, limiting clinical feasibility and physician acceptance. Gap 2: They commonly overlook multi label safety constraints of MR, including drug-drug interaction risks and local formulary feasibility, which are essential for safe real-world deployment. To address these gaps, we propose HEM-Med, a novel hierarchical agentic memory framework for multi-center MR. To address Gap 1, we design a disentangled hierarchical memory module that builds patient-level medication context attribution records and disentangles them into cross hospital experience memory and hospital-specific residual memory. To address Gap 2, we introduce a safety-aware medication set generation module, which integrates dual-level experience retrieval with safety-aware set decoding to produce clinically relevant, safer, and locally adaptive medication recommendations. Experiments on a real-world multi-center eICU dataset show that HEM-Med outperforms representative transfer learning, LLM-based, and MR baselines in terms of both recommendation accuracy and safety.
Min Xiao, Jin Li, Shoujin Wang +3
Key Laboratory of Computing Power Network and Information Security, Ministry of Education; Shandong Computer Science Center (National Supercomputer Center in Jinan); Qilu University of Technology (Shandong Academy of Sciences); Shandong Provincial Key Laboratory of Computing Power Internet and Service Computing; Shandong Fundamental Research Center for Computer Science, Jinan, Shandong, China · University of Technology Sydney
Large language model (LLM) agents can support medication review between clinical visits, but safe choices for older adults with multimorbidity depend on conditions, medications, and geriatric risks that users may omit. We introduce ATLAS, a coupled graph--policy distillation framework for patient-adaptive medication safety. ATLAS structures guideline evidence as a medication-safety graph. Targeted questions update the patient state and distill relevant relations into a patient-specific medication conflict graph (PMCG). A risk-first multi-agent policy uses the PMCG to screen contraindications, assess cautions and monitoring needs, identify safer alternatives, and verify the final medication plan. We also introduce GeriMedBench, an interactive benchmark that tests safety-critical information acquisition and evidence-based decision revision. Across a European non-interactive multimorbidity benchmark, an Asian interactive multimorbidity benchmark, and an Asian non-interactive cross-guideline benchmark, ATLAS achieves the strongest complete-decision performance among the compared systems. On the European non-interactive multimorbidity benchmark, it exceeds the strongest proprietary LLM baseline by 53.73 points in Strict Success Rate and 14.63 points in overall safety reasoning score (OSRS), with no unsafe recommendations under the automated evaluator. A blinded clinician evaluation gives ATLAS higher mean ratings across all five criteria and flags potentially unsafe recommendations in one ATLAS case and two Gemini cases.
Zihan Wang, Anglin Liu, Rongyi Wang +6
1Artificial Intelligence Thrust, The Hong Kong University of Science and Technology (Guangzhou) · Faculty of Engineering, University of New South Wales · 3Medical Big Data Center, Guangdong Provincial People’s Hospital, Southern Medical University +2