The medications prescribed to a patient often change during a hospital admission as clinicians start, stop, or continue therapies. We study whether models can predict which medication classes are added or removed between 24 hours after admission and discharge. Metrics that compare the complete discharge regimen can reward models for copying medications that remain unchanged, even when they identify no actual changes. We therefore introduce a leakage-controlled benchmark that predicts net ATC3 additions and removals using only prior completed admissions and information available within the first 24 hours of the current admission. Addition candidates are classes not active at 24 hours, whereas removal candidates are classes active at that time. We also introduce R-GEAN, an asymmetric candidate-scoring network with independent addition and removal predictors. Across 240,480 admissions from 82,286 patients, R-GEAN achieves the highest predefined summary of addition, removal, changed-regimen, and action-pattern performance, termed the edit composite (0.464), compared with 0.435 for the strongest primary comparator. Reimplemented RETAIN, GAMENet, and MICRON baselines obtain 0.428, 0.420, and 0.288, respectively. R-GEAN's advantage is concentrated in correctly identifying medication classes no longer active at discharge, while rare additions and admissions with multiple medication changes remain difficult. Rankings based on micro-F1 over the reconstructed discharge regimen and the edit composite correlate weakly across the evaluated models (Spearman r = 0.20). The continuation baseline achieves the highest complete-regimen score despite predicting no additions or removals. These results show that complete-regimen and edit-level evaluation measure different aspects of medication prediction. The benchmark evaluates observed prescribing changes, not treatment appropriateness
Figures & tables
Figure 1: The model uses prior history and information available within the first 24 hours to predict medication classes added to or removed from the observed 24-hour regimen by discharge. The two predictions are combined to reconstruct the discharge regimen. No information recorded after the 24-hour boundary is available to the model.
Property
Value
Source
MIMIC-IV v3.1
Patients
82,286
Admission-level examples
240,480
Target vocabulary (ATC3)
78 classes
Train examples / patients
167,418 / 57,627
Validation examples / patients
24,030 / 8,215
Table 1: Benchmark and split statistics. The splits are patient-disjoint. Each test admission belongs to one of seven mutually exclusive medication-change patterns: continue 9,580, add 9,879, remove 7,818, switch 7,389, multi-edit 13,560, empty-to-nonempty 749, and nonempty-to-empty 57.
Figure 2: R-GEAN architecture. The addition and removal encoders receive 117- and 101-dimensional admission inputs, respectively, and produce 256-dimensional admission representations. Each representation is combined with a 32-dimensional medication-specific laboratory vector, a 16-dimensional exposure vector, and an 83-dimensional medication-class representation. The resulting 387-dimensional vector is scored by a 387→128→1 MLP. The addition branch evaluates classes absent from the observed 24-hour regimen ( C+=V∖MA ), whereas the removal branch evaluates classes present in it ( C−=MA ). Their predictions reconstruct the discharge regimen as M^T=(MA∖Y^−)∪Y^+ .
Model
Add F1 ↑
Remove F1 ↑
Changed Jacc. ↑
Action mF1 ↑
Composite ↑
Contextual (non-learned) baselines
continuation
0.0000
0.0000
0.6347
0.0467
0.1634
frequency
0.1942
0.5014
0.5968
0.3364
0.4012
Public models, reimplemented under this benchmark
RETAIN-FullSet
0.2687
0.4671
0.6209
0.3811
0.4275
RETAIN-Edit
0.0959
0.4780
0.5444
0.3608
0.3492
Table 2: Test results for the primary seed (49,032 admissions; 16,444 patients). Bold and underlined values indicate the best and second-best result in each column. The continuation baseline attains the highest changed-admission Jaccard despite predicting no additions or removals. The composite is the predefined summary of edit performance described in Equation 6 .
Variant
ΔF1+
ΔF1−
ΔS
Add. w/o DDI
−0.0786
—
−0.0409
Add. w/o history
−0.0299
—
−0.0224
Add. w/o transition
−0.0125
—
−0.0108
Add. w/o exposure
−0.0227
—
−0.0085
Rem. w/o exposure
—
−0.0772
−0.0293
Shared predictor (rerun)
−0.0570
−0.0077
−0.0298
Table 3: Changes in test performance after removing individual components. Full R-GEAN obtains F1+=0.2509 , F1−=0.6013 , and S=0.4643 . When one branch is modified, the other is held fixed. Complete results are provided in the supplement.
Appendix figures & tables19 assets
Supplementary material from the paper’s appendix.
Appendix
Stage
Result
Raw prescription rows
20,292,611
Records linked to eligible admissions
15,562,624
RxNorm entity coverage
64.6%
ATC coverage (by record)
88.6%
Resolved eligible records (after exclusions)
99.4%
Final ATC3 vocabulary
78 classes
Appendix
Table 4: Summary of medication mapping and benchmark construction. Coverage percentages use the denominators defined in the text.
Variable
Recurrent-care
Single-adm.
SMD
Admissions
240,480
109,899
—
Mean age (years)
62.9
56.6
0.33
Mean length of stay (d)
6.1
5.2
0.12
Appendix
Table 5: Cohort selection relative to otherwise-eligible single-admission adults (standardized mean differences).
Input block
Availability rule
Branch
Verdict
Prior-admission and admission features
Available by admission
Add, Rem
Pass
Anchor regimen (multi-hot)
Active at the 24-hour landmark
Add, Rem
Pass
Laboratory summaries and candidate-specific interactions
Table 7: Action strata and their first-match precedence order.
Comparator
Metric
Diff.
95% CI
RETAIN-FullSet
composite
0.0368
[0.0341, 0.0395]
GAMENet-FullSet
composite
0.0448
[0.0424, 0.0472]
Tree
composite
0.0431
[0.0408, 0.0456]
Shared
composite
0.0293
[0.0276, 0.0310]
MICRON
composite
0.1759
[0.1731, 0.1788]
MICRON
addition F1
0.0229
[0.0193, 0.0264]
Appendix
Table 8: R-GEAN improvements over each comparator with 95% patient-paired bootstrap confidence intervals. Positive values favor R-GEAN.
Scheme
F1 +
F1 -
Jchg
F1 act
Primary
0.35
0.30
0.25
0.10
Equal
0.25
0.25
0.25
0.25
Edit-heavy
0.40
0.40
0.10
0.10
Balanced
0.30
0.30
0.20
0.20
Addition-heavy
0.45
0.25
0.20
0.10
Removal-heavy
0.25
0.45
0.20
0.10
Appendix
Table 9: Prespecified composite-weight schemes over addition F1, removal F1, changed-admission Jaccard, and action macro-F1.
Property
MICRON
DualNN
R-GEAN
Prediction interval
within admission
between visits
within admission
Base regimen
observed 24-hour anchor
predicted
observed 24-hour anchor
Recursive prediction
no
no
no
Candidate spaces
one shared vector
two nets, shared space
two disjoint anchor spaces
Candidate-specific exposure
no
no
yes
Observation boundary
24-hour cutoff
visit-level input
explicit 24-hour cutoff
Appendix
Table 10: Comparison of the adapted MICRON baseline, DualNN, and R-GEAN under the within-admission prediction setting. MICRON columns describe the adapted implementation evaluated here; DualNN is listed as originally proposed and was not re-evaluated.
Model
2026
2027
2028
Mean
R-GEAN
0.4672
0.4583
0.4655
0.4636
Shared
0.4350
0.4278
0.4375
0.4334
RETAIN-FullSet
0.4275
0.4292
0.4289
0.4285
GAMENet-FullSet
0.4195
0.4170
0.4182
0.4182
MICRON-Adapted
0.2884
0.2895
0.2894
0.2891
Appendix
Table 11: Seed-specific edit composites and arithmetic means. Means are calculated from the full-precision seed-specific results.
Model
Parameters
Composite
Shared, original
363,394
0.4333±
0.0050
Shared, param-matched
465,454
0.4362±
0.0070
R-GEAN
465,924
0.4636±
0.0047
Appendix
Table 12: Three-seed parameter-matched comparison. Models were retrained under a common capacity-control protocol, so the shared-model values differ slightly from the primary multiseed results.
Component
Parameters
Training time
R-GEAN addition branch
235,138
31.3 s
R-GEAN removal branch
230,786
4.4 s
R-GEAN combined
465,924
35.7 s
Appendix
Table 13: R-GEAN parameter counts and recorded branch training times for the primary seed-2026 run.
Model
Set μ F1
Set rank
Comp.
Edit rank
R-GEAN
0.7769
4
0.4643
1
Shared
0.7334
7
0.4350
2
RETAIN-FullSet
0.7878
3
0.4275
3
Tree
0.7425
6
0.4212
4
GAMENet-FullSet
0.7938
2
0.4195
5
Frequency
0.7753
5
0.4012
6
Appendix
Table 14: Set-level and edit-level ranks for the ten systems included in the rank-correlation analysis. Rank 1 is best.
Variant
Add F1
Remove F1
Changed Jacc.
Action macro-F1
Composite
Δ Comp.
Full R-GEAN
0.2509
0.6013
0.6088
0.4392
0.4643
0.0000
Addition, no transition states
0.2384
0.6013
0.5888
0.4251
0.4535
−0.0108
Addition, no candidate exposure
0.2282
0.6013
0.6153
0.4173
0.4558
−0.0085
Addition, no laboratory interaction
0.2441
0.6013
0.5966
0.4322
0.4582
−0.0061
Addition, no prior history
0.2210
0.6013
0.5837
0.3825
0.4419
−0.0224
Addition, no interaction regularizer
0.1723
0.6013
0.5546
0.4410
0.4234
−0.0409
Appendix
Table 15: Complete component ablations on the test set. The unmodified prediction direction is held fixed.
Variant
Comp.
Add F1
Add/adm
No regularizer
0.4223
0.1686
3.69
Interaction-derived regularizer
0.4618
0.2454
1.95
L1 expected-count control
0.4467
0.2084
2.77
Anchor-size count-matching
0.4615
0.2448
1.87
Appendix
Table 16: Addition-branch regularization (removal branch fixed): a count-matching control reproduces the predictive effect of the interaction-derived term. Pair-normalized interaction burden is 0.983 without the term and 0.994 with it.
Model
Rare-addition F1
Tree
0.0938
RETAIN-FullSet
0.0765
GAMENet-FullSet
0.0541
Shared
0.0231
R-GEAN
0.0004
Appendix
Table 17: Addition F1 across the 39 classes in the bottom half of training-set addition support.
Group
R@5
R@10
MRR
Macro-AUPRC
All classes
0.384
0.550
0.268
0.076
Rare classes
0.017
0.029
0.042
0.028
Common classes
0.440
0.630
0.302
0.123
Rarest quartile
0.000
0.000
0.019
0.007
Appendix
Table 18: Addition ranking quality by class-frequency group.
Direction
Method
ECE
Brier
F1
Addition
raw
0.0323
0.0235
0.2509
Addition
isotonic
0.0003
0.0213
0.2510
Removal
raw
0.1943
0.1370
0.6013
Removal
isotonic
0.0023
0.0904
0.6011
Appendix
Table 19: Validation-only calibration. Calibration improves probability quality with essentially unchanged thresholded F1.
Subgroup
Adm.
Add F1
Rem F1
Chg. Jacc.
Comp.
Age 18–44
8,254
0.2378
0.5982
0.6197
0.4613
Age 45–64
16,171
0.2361
0.6064
0.6133
0.4599
Age 65–74
10,865
0.2530
0.6065
0.5955
0.4624
Age 75–84
8,292
0.2509
0.5913
0.5875
0.4552
Age 85+
5,450
0.2414
0.5930
0.5698
0.4476
Sex F
25,473
0.2467
0.5974
0.6124
0.4628
Appendix
Table 20: R-GEAN performance by age band, sex, and admission type on the test split (internal stress tests).
Duration stratum
Classes
R-GEAN
RETAIN
Median order ≤48 h
27
0.6925
0.5937
Median order >48 h
51
0.4769
0.2774
Appendix
Table 21: Removal F1 by class order-duration stratum. Classes are grouped by their median anchor-order duration on the test split for this post-hoc diagnostic; the grouping was not used for training, threshold selection, or model selection.
Event category
Count
%
Represented addition
121,836
17.2
Represented removal
74,174
10.5
Transient exposure
238,068
33.6
Stop–restart, membership unchanged
207,087
29.2
Restart of a removal class
26,601
3.8
Within-window stop of an addition class
40,383
5.7
Appendix
Table 22: Complete mutually exclusive taxonomy of medication start and stop events occurring between the 24-hour anchor and discharge. Net snapshot labels are directly represented by the first two rows; the final two rows are opposite-direction transitions of edit-labeled classes with multiple within-window episodes.
Inpatient medication recommendation requires clinicians to repeatedly select specific medications, doses, and routes as a patient's condition evolves. Existing benchmarks formulate this task as admission-level prediction over coarse drug codes with multi-hot diagnostic and procedure code inputs, failing to capture the per-timepoint, information-rich nature of real prescribing. We propose RxEval, a prescription-level benchmark that evaluates LLM prescribing capability by multiple-choice questions: each question presents a detailed patient profile and time-ordered clinical trajectory, requiring selection of specific medication-dose-route triples from real prescriptions and patient-specific distractors generated via reasoning-chain perturbation. RxEval comprises 1,547 questions spanning 584 patients, 18 diagnostic categories, and 969 unique medications. Evaluation of 16 LLMs shows that RxEval is both challenging and discriminative: F1 ranges from 45.18 to 77.10 across models, and the best Exact Match is only 46.10%. Error analysis reveals that even frontier models may overlook stated patient information and fail to derive clinical conclusions.
Shuhao Chen, Weisen Jiang, Changmiao Wang +4
The Hong Kong University of Science and Technology · Southern University of Science and Technology · The Chinese University of Hong Kong +2
Recommending safe and effective medication combinations from electronic health records (EHRs) is a core clinical AI problem, yet it remains difficult because patient trajectories are long, noisy, and clinically heterogeneous. Existing methods typically excel at either temporal modeling across visits or pharmacological knowledge integration (e.g., drug-drug interactions, DDIs), but rarely achieve both while robustly suppressing noise. We present GraphDiffMed, a knowledge-constrained medication recommendation framework built on dual-scale Differential Attention v2. Differential attention is applied at both intra-visit and inter-visit levels to filter spurious signals within encounters and across longitudinal history, while pharmacological constraints are incorporated during learning. Experiments on MIMIC-III and ablation studies show that this design consistently improves recommendation quality and ranking over strong baselines while achieving a more favorable safety performance balance. We further find that the strongest-performing configuration uses only demographic auxiliary features under our experimental setting. Overall, GraphDiffMed demonstrates that combining noise-aware attention with pharmacological constraints yields more reliable and clinically meaningful medication recommendation. We open-source our code at https://github.com/saxenakrati09/GraphDiffMed.
Krati Saxena, Tomohiro Shibata
Kyushu Institute of Technology, Kitakyushu, Fukuoka, Japan
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