Source-linked AI summary

From Scores to Safe Sets: Exact Safety--Constrained Decoding for Medication Recommendation

Animesh Agarwal, Meysam Ghaffari, Nina Fatehi, Anushka Swarup, Carlos Morato

arXiv:2610.29228v1cs.AI

TL;DR

Prior work mainly addresses DDI-aware medication recommendation through learning, leaving open whether local repair loses accuracy when fixed scores are converted into a constrained set. This study compares local repair with exact global decoding under the same scores, output size, and DDI budget; global decoding achieves higher Jaccard, with a larger advantage under tighter constraints.

  • Problem

    Prior work mainly targets DDI-aware recommendation through learning, while it remains unclear whether converting existing scores into a constrained medication set introduces avoidable error.

    Source: §1 · p. 2
  • Method

    The study uses a mixed-integer linear program to jointly select a fixed-cardinality medication set from frozen scores under a DDI-edge budget, comparing it with local repair.

    Source: §1 · p. 2, §5 · p. 6
  • Results

    +0.0064 Jaccard over degree-aware repair with 1-swap local search at the strict DDI operating point on the test split; the advantage also appears across validation, a fine matched-exposure sweep, and three score representations.

    Source: §8 · p. 9
  • Takeaways & Limitations

    With the scorer frozen, the mapping from scores to a constrained set materially changes the accuracy–DDI frontier.

    Source: §8 · pp. 8–9

    The evaluation is scoped to one EHR benchmark, one frozen scorer, and a binary TWOSIDES-derived DDI graph, and does not establish clinical safety or utility.

    Source: §9 · p. 9

Abstract

from arXiv · show

Recent generative medication recommendation systems ultimately produce sets of drugs, but drug--drug interaction (DDI) constraints depend on the set as a whole. A natural post-hoc approach is to first predict medications and then locally repair interacting pairs by removing one drug at a time. We ask whether this local repair step itself introduces avoidable error. Using fixed medication scores from FLAME's frozen classifier on MIMIC-III, we compare increasingly strong local repair strategies with an exact global decoder while holding the scores, output size, and DDI constraint fixed. The global decoder jointly selects the highest-scoring feasible medication set using mixed-integer linear programming. Across validation and test splits, global decoding consistently achieves higher Jaccard similarity than greedy repair, degree-aware repair, and degree-aware repair strengthened with exhaustive 1-swap local search. Its advantage is small under loose DDI constraints and becomes larger as the constraint tightens; on the test split it reaches +0.0064 Jaccard over the strongest local baseline at the strict DDI operating point. The finding also holds across a fine accuracy--DDI sweep at matched realized DDI exposure and under three score representations. At the strict setting, global decoding retains more true-positive medications while removing more false positives. These results show that medication recommendation is not only a representation-learning problem: even with a frozen clinical model, how its scores are converted into a constrained medication set can materially affect the final prediction.

1 Introduction

Medication recommendation is a set-selection problem, but much prior work focuses on learning scores or safer representations. This paper isolates the decoding step and compares local repair with exact global selection under fixed scores and DDI constraints.

1 Introduction

  • Prior work primarily addresses the accuracy–DDI tradeoff through learning, while this paper asks whether converting existing scores into a constrained set introduces avoidable error.A survey notes that removing one interacting drug can discard treatment value elsewhere in the regimen.Source: §1 · p. 2
  • Dense conflicts make local choices interdependent: retaining a high-scoring hub can make several other high-scoring medications mutually infeasible.The evaluated output sets average approximately 27 medications and typically contain dozens of active DDI edges.Source: §1 · p. 2
  • Exact global decoding outperforms greedy, degree-aware, and 1-swap repair on validation and test, with the advantage growing as DDI constraints tighten.The comparison holds scores, output cardinality, and DDI constraints fixed.Source: §1 · p. 2, Figure 1 · p. 3
  • The study uses FLAME’s frozen classifier on MIMIC-III and tests the ordering across validation and test, matched realized DDI exposure, and three score representations.The splits follow a 4:1:1 train/validation/test ratio over approximately 14,000 visits.Source: §1 · p. 2
  • Under strict DDI pressure, global decoding retains more true positives while removing more false positives, consistent with the cost of locally committing to coupled medication choices.The shared setup compares methods using the same frozen scores, output cardinality, DDI graph, and patient-specific DDI budget.Source: §1 · p. 3, Figure 1 · p. 3

2 Related work

Medication recommendation research has moved from sequence prediction toward increasingly structured set prediction, while many DDI-aware approaches incorporate safety information during learning. This paper instead isolates constrained inference on fixed scores.

2 Related work

  • Medication recommendation has progressed from instance- and sequence-based prediction to increasingly structured set prediction, including longitudinal, graph-based, and causal approaches.Examples include LEAP, DMNC, GAMENet, G-BERT, MICRON, COGNet, and later temporal and causal methods.Source: §2 · p. 3
  • Many DDI-aware recommenders incorporate interaction information during training through graph integration, molecular encoders, or DDI-focused objectives.Examples include GAMENet, SafeDrug, 4SDrug, MoleRec, Carmen, and DAPSNet.Source: §2 · pp. 3–4
  • Recent medication recommendation systems also use language models, but this study uses FLAME only to supply fixed patient–drug scores.The decoder neither trains nor queries an additional language model and can in principle sit on top of any scorer.Source: §2 · p. 4
  • Mixed-integer optimization is a standard tool for exact discrete decision making under linear constraints.The paper applies it to a controlled medication decoding comparison.Source: §2 · p. 4
  • The paper’s focus is the final fixed-score, fixed-cardinality, DDI-budgeted set-selection problem, solved exactly to compare decoders while keeping the score function identical.The related-work passage contrasts this inference-stage analysis with training losses, graph representations, sequential generation, and heuristic post-processing.Source: §2 · p. 4

3 Problem formulation

The formulation selects a fixed-size medication set from frozen patient-specific scores while limiting selected DDI edges. Every decoder faces the same cardinality and interaction budget.

3 Problem formulation

  • For each patient visit, the frozen model supplies medication scores, with larger scores indicating stronger evidence for a medication.The experimental medication vocabulary contains 151 medications.Source: §3 · p. 4
  • Each decoder must return exactly Kq medications, where Kq is set to the size of the base model’s initial medication set.This fixed-cardinality condition prevents a decoder from appearing to meet a looser DDI constraint merely by returning fewer drugs.Source: §3 · p. 4
  • The DDI graph is undirected, and an edge marks a flagged drug–drug interaction; the formulation measures a predicted set’s pairwise DDI rate.The rate is based on selected interaction edges relative to set size.Source: §3 · p. 4
  • Three prespecified nominal DDI targets are converted to feasible integer edge budgets, and the decoding objective chooses the best-scoring set that satisfies the size and budget constraints.Because target conversion is discrete, achieved DDI rates are reported alongside nominal targets.Source: §3 · p. 4

4 Exact DDI-constrained decoding

The MILP jointly selects a fixed-cardinality medication set that maximizes frozen scores under a DDI-edge budget. It evaluates coupled choices together, unlike local repair, and uses a mixed-integer optimization solver.

4.1 MILP formulation

  • Binary medication-selection and edge variables encode a fixed-size, score-maximizing set subject to a DDI-edge budget.With binary selection variables, the edge constraints count selected DDI pairs exactly.Source: §4.1 · p. 5

4.2 Why global optimization can differ from local repair

  • A local choice can constrain later removals and replacements; the MILP evaluates these coupled consequences simultaneously.A high-scoring drug involved in many conflicts may force removal of several other medications with a larger joint score.Source: §4.2 · p. 5

4.3 Implementation

  • The MILP is solved with scipy.optimize.milp and the HiGHS backend, without warm starts, learning, or patient-specific tuning.At global optimality, its objective is at least that of any heuristic obeying the same constraints, but higher score is not guaranteed to mean better clinical-label agreement.Source: §4.3 · p. 5, §4.1 · p. 5

5 Local repair baselines

The local baselines repair DDI conflicts and then refill to the target cardinality. They range from score-based removal to degree-aware repair with exhaustive feasible 1-for-1 swaps.

  • Greedy repair starts from the top-K set, removes the lower-scoring endpoint of a conflict until feasible, then refills by descending score.Refill adds the highest-scoring excluded medication whose addition preserves feasibility, until cardinality Kq is restored.Source: §5 · p. 5
  • Degree-aware repair removes the selected medication with maximum current conflict degree, breaking ties by lower model score, then refills as in greedy repair.Removing a high-degree medication can resolve several conflicts at once.Source: §5 · pp. 5–6
  • Degree-aware + 1-swap repeatedly applies the feasible selected-for-excluded swap with the largest score gain until no improving swap remains.It searches the full 1-for-1 neighborhood and can undo a bad greedy commitment.Source: §5 · p. 6
  • All decoders receive the same scores, target cardinality, DDI graph, and DDI budget, differing only in how they search feasible sets.Source: §5 · p. 6

6 Experimental setup

The evaluation uses a frozen FLAME classifier and its MIMIC-III DDI graph, with disjoint patient-level splits and a fixed pipeline. Decoders are compared at shared cardinality and DDI budgets using Jaccard and patient-cluster bootstrap intervals.

  • The frozen FLAME classifier supplies scores for 151 medications, and its TWOSIDES-derived DDI graph contains 1,425 undirected edges.Source: §6 · p. 6
  • Approximately 14,000 MIMIC-III visits are divided into disjoint train, validation, and test splits in a 4:1:1 ratio, with no shared patient identifiers.The fitted pipeline is confirmed on validation and evaluated once, unchanged, on test.Source: §6 · p. 6
  • The study uses loose, moderate, and strict target DDI rates of 0.136, 0.100, and 0.080, plus a ten-rate sweep from 0.14 to 0.02.Source: §6 · p. 6
  • Visit-level Jaccard is averaged across visits, and equal per-visit output cardinality means accuracy differences cannot be attributed to set size.Table 1 reports that all methods output 26.78 medications on average.Source: §6 · p. 6, Table 1 · p. 7
  • Mean Jaccard differences are assessed with 2,000 patient-cluster bootstrap resamples over SUBJECT_ID and percentile 95% confidence intervals.Table 2 reports that all intervals exclude zero on validation and test.Source: §6 · p. 6, Table 2 · p. 7
  • At the strict budget, mechanism analysis compares decoded sets with the original top-K set and ground truth, tracking true- and false-positive changes and final score sums.Source: §6 · p. 6

7 Results

With matched cardinality and DDI budgets, global decoding achieves the highest Jaccard among the tested decoders. Its advantage is distinguishable across splits and persists across matched-exposure sweeps and score representations, with more true positives retained and more false positives removed at the strict target.

7.1 Global decoding improves the accuracy–DDI tradeoff

  • At the strict target, global decoding reaches 0.4027 Jaccard versus 0.3963 for degree-aware + 1-swap, 0.3937 for degree-aware, and 0.3790 for greedy.The ordering Jglobal > J1-swap > Jdegree > Jgreedy holds at all three DDI regimes; every decoder averages 26.78 medications.Source: §7.1 · p. 7

7.2 The advantage is statistically distinguishable on both validation and test

  • Against degree-aware + 1-swap, the test advantage grows from +0.0021 Jaccard at loose constraints to +0.0064 at strict constraints, with every bootstrap interval excluding zero.Validation shows a similar increase, from +0.0020 to +0.0061.Source: §7.2 · p. 7

7.3 The advantage holds across the accuracy–DDI frontier

  • At matched realized DDI checkpoints, global decoding remains above degree-aware + 1-swap; Figure 2 shows its curve above all three local baselines across the fine sweep.The frontier is not perfectly monotonic point-to-point, so the widening gap is a pattern across coarse and fine sweeps, not a strict adjacent-point relationship.Source: §7.3 · pp. 7–8, Figure 2 · p. 8, Table 3 · p. 8
  • Global decoding beats degree-aware + 1-swap in all nine tested score-by-budget combinations, including raw log-margin, sigmoid probability, and rank-normalized scores.Source: §7.3 · p. 8

7.4 Global decoding preserves more true positives and removes more false positives

  • At the strict target, global decoding retains more true-positive medications while also removing more false positives than the local baselines.The optimized score sum is ordered in the same direction as Jaccard.Source: §7.4 · p. 8

8 Discussion

With the scorer frozen, the choice of decoder materially changes the accuracy–DDI frontier. Exact decoding retains an advantage over local repair, especially under tighter DDI budgets, but the result is limited to benchmark constraints rather than clinical safety.

8 Discussion

  • With scores, output cardinality, and DDI budget held fixed, decoder choice isolates how scores become a constrained medication set.The MILP is standard; the contribution is the controlled empirical isolation of decoder choice.Source: §8 · pp. 8–9
  • Exact decoding exceeds degree-aware 1-swap repair by +0.0021 to +0.0064 Jaccard across three test operating regimes.The advantage also appears on validation, across a fine budget sweep, and under three score representations.Source: §8 · p. 9
  • The global decoder’s advantage grows as tighter budgets contract the feasible region and raise the cost of retaining conflict-heavy drugs.Globally optimized sets remove more false positives while retaining more true positives.Source: §8 · p. 9
  • The decoder requires only patient-specific medication scores, target cardinality, and a pairwise conflict graph, independent of how scores were learned.The empirical claim is about decoder choice under controlled scores and constraints, not the universal superiority of FLAME’s scorer.Source: §8 · p. 9
  • The DDI budget is a benchmark signal, not a complete clinical decision rule or a claim of absolute clinical safety.Severity, dosage, timing, indication, allergy history, organ function, and outcome data are not represented; clinician oversight remains necessary.Source: §8 · p. 9

9 Limitations

The evaluation is deliberately narrow: one EHR benchmark, one frozen scorer, and a binary TWOSIDES-derived DDI graph. It does not establish clinical safety or utility.

9 Limitations

  • The study covers one EHR benchmark, one frozen scorer, and a binary TWOSIDES-derived DDI graph.Broader validation across datasets, scorers, and patient populations is needed before considering clinical deployment.Source: §9 · p. 9
  • Fixed cardinality isolates decoder choice but does not optimize regimen size, and the MILP inherits systematic bias in the underlying scores.Source: §9 · p. 9
  • The DDI constraint omits interaction severity and patient-specific context, so the evaluation does not establish clinical safety or utility.Runtime and scaling under larger vocabularies or richer constraints, and comparisons with stronger multi-swap or beam-search baselines, remain future evaluation needs.Source: §9 · p. 9

10 Conclusion

In the evaluated benchmark, exact global decoding achieves higher Jaccard than local repair while scorer, output cardinality, and DDI budget are fixed. The implementation uses frozen scores and a fixed-cardinality constrained selection setup.

10 Conclusion

  • Exact global decoding achieves higher Jaccard than increasingly sophisticated local repair on validation and test, at matched DDI exposure and across score parameterizations.The findings are limited to benchmark medication recommendations under the evaluated DDI constraint and do not establish clinical safety or utility.Source: §10 · p. 9

A Implementation details

  • The implementation uses disjoint 4:1:1 train, validation, and test splits across approximately 14,000 visits, with scorer calibration fit on training data and frozen for evaluation.The selected threshold is 0.310.Source: A Implementation details · p. 12
  • The MILP solver reaches proven global optimality for every reported instance; exhaustive 1-swap search stops when no feasible improving swap remains.The search had a 200-iteration cap, which was never reached in practice.Source: A Implementation details · p. 12
  • Raw log-margin, sigmoid probability, and rank-normalized scores preserve medication order differently from score spacing, which can affect the MILP and 1-swap search.Greedy and degree-aware repair depend only on score order.Source: A Implementation details · p. 12

B Additional robustness and mechanism details

The additional analyses examine robustness across score representations and strict-budget error mechanisms, alongside a test-split visualization of global decoding’s advantage as the DDI budget tightens.

B Additional robustness and mechanism details

C Additional bootstrap visualization

Loading 2610.29228v1…