Fine-grained List-wise Alignment for Generative Medication Recommendation

Chenxiao Fan, Chongming Gao, Wentao Shi, Yaxin Gong, Zhao Zihao, Fuli Feng

Introduction

In modern healthcare, treating patients with multimorbidity—the presence of two or more chronic conditions—requires complex medication regimens. Effective prescribing is not merely about selecting individual drugs for specific symptoms; it is about curate a cohesive list of medications that are both effective and safe when taken together.

Traditional AI-driven medication recommendation systems, including recent Large Language Model (LLM) adaptations, often rely on a point-wise prediction paradigm. These systems score candidate drugs independently and aggregate the highest-scoring items into a final prescription. This approach fundamentally fails to account for synergistic effects and adverse drug-drug interactions (DDIs). Furthermore, while Reinforcement Learning (RL) can align LLMs with safety goals, standard algorithms like Group Relative Policy Optimization (GRPO) typically assign a single reward to an entire sequence. In a clinical context, if a model generates a list of five drugs where only one is dangerous, standard RL struggles to identify the specific culprit, leading to inefficient optimization and poor credit assignment.

To address these challenges, we present FLAME (Fine-grained List-wise Alignment for generative Medication rEcommendation), a framework that treats prescribing as a sequential, Markov Decision Process, enabling fine-grained alignment with both clinical accuracy and patient safety.

Methodology

FLAME introduces three primary innovations to transition from independent drug prediction to holistic list generation:

1. Two-Stage Architecture

The framework operates in two distinct phases. First, an LLM-based binary classifier acts as a filter to identify a personalized subset of candidate drugs from a vast pharmacopeia. Second, a list-wise LLM policy refines this selection, sequentially adding or removing drugs based on the patient's specific clinical context and safety constraints.

2. Step-wise GRPO with Reward Shaping

To solve the credit assignment problem inherent in list generation, FLAME utilizes "step-wise GRPO." Rather than rewarding the final output, the framework segments the LLM’s generation by drug names. It employs a potential function at each step, calculated based on:

  • Correctness: Jaccard similarity to the ground-truth prescription.
  • Safety: Penalties derived from known DDIs.

The reward for each generated drug is defined as the difference in potential between the current step and the previous one. This mathematical approach maintains policy invariance while providing the model with immediate, granular feedback on whether a specific drug addition improved the prescription or introduced a safety risk.

3. Multi-source Knowledge Fusion

While LLMs are adept at processing unstructured clinical notes, they often lack the structural understanding of disease co-occurrence or molecular relationships found in specialized medical graphs. FLAME bridges this gap by injecting "collaborative embeddings"—derived from graph models of diagnoses, procedures, and molecular structures—directly into the LLM’s token embedding space via learnable projectors. The system uses Llama3.1-Aloe-Beta-8B as its backbone.

Experimental Setup

The model was evaluated across several diverse datasets to test both accuracy and robustness:

  • MIMIC-III: The primary dataset for training and benchmarking.
  • MIMIC-IV: Used to assess temporal generalization, specifically how the model handles newer clinical practices and the transition to ICD-10 coding.
  • eICU: A multi-center dataset used to evaluate spatial generalization across different hospital systems.
  • TWOSIDES: Utilized to construct the ground-truth DDI graph for safety penalty calculations.

Key Results and Insights

State-of-the-Art Performance

FLAME demonstrated superior performance on the MIMIC-III benchmark, achieving a Jaccard score of 0.4836 and an F1 score of 0.6408. These results outperform both traditional graph-based models (such as MoleRec) and contemporary LLM baselines (such as LAMO, which achieved 0.4701 and 0.6294, respectively).

Safety-Accuracy Trade-off

A critical finding of this research is that safety and accuracy must be evaluated as a Pareto frontier. While a model could achieve a 0% DDI rate by prescribing nothing, such a system is clinically useless. FLAME consistently maintained a higher accuracy at stricter safety thresholds compared to all baselines, demonstrating better controllability over the DDI-accuracy trade-off.

Robust Generalization

Traditional models trained on structured codes often see performance degradation when applied to new datasets due to shifts in coding practices. Because FLAME leverages natural language and hybrid embeddings, it maintained strong performance on MIMIC-IV and eICU, proving its utility in real-world, out-of-distribution clinical environments.

Conclusion and Future Work

FLAME represents a significant step forward in generative medication recommendation by moving beyond point-wise predictions to fine-grained, list-wise alignment. By combining the linguistic power of LLMs with the structural precision of graph embeddings and step-wise reinforcement learning, the framework achieves a new standard for safe and accurate clinical decision support.

Future iterations of FLAME will focus on reducing the computational overhead of the 8B parameter model to facilitate deployment in resource-constrained settings. Additionally, we aim to transition the system toward a fully end-to-end pipeline, reducing reliance on external APIs for initial note parsing and moving toward dynamic, human-in-the-loop clinical assistants.

Summary updated

BibTeX
@inproceedings{fan2025fine,
  author = {Chenxiao Fan and Chongming Gao and Wentao Shi and Yaxin Gong and Zhao Zihao and Fuli Feng},
  title = {{Fine-grained List-wise Alignment for Generative Medication Recommendation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=Quo3XadYcZ},
}
Figure