SafeDrug: Dual Molecular Graph Encoders for Safe Drug Recommendations

Chaoqi Yang, Cao Xiao, Fenglong Ma, Lucas Glass, Jimeng Sun

Abstract

Medication recommendation is an essential task of AI for healthcare. Existing works focused on recommending drug combinations for patients with complex health conditions solely based on their electronic health records. Thus, they have the following limitations: (1) some important data such as drug molecule structures have not been utilized in the recommendation process. (2) drug-drug interactions (DDI) are modeled implicitly, which can lead to sub-optimal results. To address these limitations, we propose a DDI-controllable drug recommendation model named SafeDrug to leverage drugs' molecule structures and model DDIs explicitly. SafeDrug is equipped with a global message passing neural network (MPNN) module and a local bipartite learning module to fully encode the connectivity and functionality of drug molecules. SafeDrug also has a controllable loss function to control DDI levels in the recommended drug combinations effectively. On a benchmark dataset, our SafeDrug is relatively shown to reduce DDI by 19.43% and improves 2.88% on Jaccard similarity between recommended and actually prescribed drug combinations over previous approaches. Moreover, SafeDrug also requires much fewer parameters than previous deep learning-based approaches, leading to faster training by about 14% and around 2x speed-up in inference.

Introduction

Recommending a "cocktail" of medications for patients with complex, chronic conditions is a high-stakes task. Traditional AI models for medication recommendation often treat drugs as simple categorical labels, ignoring the rich chemical information contained in their molecular structures. Furthermore, these models often struggle to balance accuracy (matching clinical prescriptions) with safety (minimizing harmful drug-drug interactions).

Existing approaches typically handle DDI implicitly—for example, through soft constraints or post-processing—which often results in uncontrollable DDI rates or sub-optimal recommendation accuracy. SafeDrug aims to bridge this gap by explicitly modeling molecular structures and providing a controllable mechanism for the safety-accuracy trade-off.

Methods

The SafeDrug architecture consists of three main stages:

The SafeDrug architecture featuring dual molecular graph encoders and a PID-controlled loss function.
  1. Patient Representation: The model uses Recurrent Neural Networks (RNNs) to process a patient's longitudinal history of diagnoses and procedures from Electronic Health Records (EHR), creating a comprehensive "health snapshot."
  2. Dual Molecular Graph Encoders: Instead of simple IDs, SafeDrug uses two parallel encoders:
  3. Global MPNN Encoder: A Message Passing Neural Network that learns fingerprints by convolving information across the entire molecular graph of a drug, capturing overall connectivity and pharmacological properties.
  4. Local Bipartite Encoder: This module breaks molecules into functional substructures using the BRICS algorithm. It uses a bipartite graph to map these substructures to drugs, allowing the model to learn which specific chemical groups contribute to efficacy or safety risks.
  5. DDI-Controllable Loss Function: Inspired by Proportional-Integral-Derivative (PID) controllers, the authors designed a loss function that adaptively balances prediction accuracy with a DDI penalty. By setting a target DDI rate ($\gamma$), the model automatically adjusts its training focus to stay within a "safety budget."

Experimental Results

The researchers evaluated SafeDrug using the MIMIC-III dataset, supplemented with DrugBank for molecular SMILES strings and TWOSIDES for known DDI pairs. SafeDrug demonstrated superior performance across multiple metrics compared to state-of-the-art baselines like GAMENet and DMNC.

Performance comparison of SafeDrug against baseline models on the MIMIC-III dataset.
  • Safety: SafeDrug reduced the DDI rate by 19.43% relative to the best-performing baseline (LEAP).
  • Accuracy: It improved Jaccard similarity by 2.88% over the previous state-of-the-art (GAMENet).
  • Efficiency: Despite its sophisticated encoders, SafeDrug is remarkably lean. It uses ~25% fewer parameters than GAMENet, resulting in a 14% reduction in training time and a 2x speed-up during inference.
  • Controllability: Ablation studies confirmed that the DDI rate is effectively upper-bounded by the user-defined threshold $\gamma$, proving the model's practical utility for clinical safety management.

Conclusion

SafeDrug represents a significant advancement in medication recommendation by integrating molecular graph theory with clinical data. By explicitly modeling chemical substructures and employing a dynamic safety controller, the framework achieves a better balance between efficacy and safety than previous methods. Future work may involve incorporating more diverse biomedical data, such as protein-protein interactions or gene expression profiles, to further refine recommendations.

Summary updated

BibTeX
@inproceedings{yang2021safedrug,
  author = {Chaoqi Yang and Cao Xiao and Fenglong Ma and Lucas Glass and Jimeng Sun},
  title = {{SafeDrug: Dual Molecular Graph Encoders for Safe Drug Recommendations}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.24963/ijcai.2021/514},
}
Figure