Chemistry-intuitive explanation of graph neural networks for molecular property prediction with substructure masking

Zhenhua Wu, Jike Wang, Hongyan Du, Dejun Jiang, Yu Kang, Dan Li, Peichen Pan, Yafeng Deng, Dongsheng Cao, Chang‐Yu Hsieh, Tingjun HouNature Communications 2023

Abstract

Graph neural networks (GNNs) have been widely used in molecular property prediction, but explaining their black-box predictions is still a challenge. Most existing explanation methods for GNNs in chemistry focus on attributing model predictions to individual nodes, edges or fragments that are not necessarily derived from a chemically meaningful segmentation of molecules. To address this challenge, we propose a method named substructure mask explanation (SME). SME is based on well-established molecular segmentation methods and provides an interpretation that aligns with the understanding of chemists. We apply SME to elucidate how GNNs learn to predict aqueous solubility, genotoxicity, cardiotoxicity and blood–brain barrier permeation for small molecules. SME provides interpretation that is consistent with the understanding of chemists, alerts them to unreliable performance, and guides them in structural optimization for target properties. Hence, we believe that SME empowers chemists to confidently mine structure-activity relationship (SAR) from reliable GNNs through a transparent inspection on how GNNs pick up useful signals when learning from data.

Introduction

Graph Neural Networks (GNNs) have become a powerhouse for predicting molecular properties like solubility and toxicity. However, they are notoriously "black boxes." While existing XAI methods attempt to explain these models, they usually focus on individual nodes (atoms) or edges (bonds). For a chemist, an explanation like "this specific carbon atom is 20% responsible for toxicity" is often useless or confusing. Chemists think in terms of functional groups (like a nitro group) and scaffolds (the core ring structure). If an XAI method highlights a random string of atoms that doesn't correspond to a known chemical entity, the chemist cannot use that information to design a better drug. There is a fundamental "language gap" between deep learning attributions and chemical intuition.

Methods

The authors introduce Substructure Mask Explanation (SME), a perturbation-based approach. Instead of looking at gradients or individual atoms, SME systematically "hides" (masks) chemically meaningful substructures and observes how the model's prediction changes.

Key components include:

  • Chemically Meaningful Segmentation: SME uses three established methods to break down molecules: BRICS (breaking bonds that are synthetically easy to form), Murcko scaffolds (identifying the core ring systems), and a library of 33 common functional groups.
  • Consensus Modeling: To ensure the explanations are robust, the authors use an ensemble of 10 Relational Graph Convolutional Networks (RGCNs). The final explanation is derived from the average behavior of these models.
  • Attribution Scoring: The "importance" of a substructure is calculated as the difference between the prediction for the whole molecule and the prediction when that specific substructure is masked.

Results and Discussion

The researchers evaluated SME across four diverse and critical tasks in drug discovery: ESOL (aqueous solubility), Mutagenicity, hERG (cardiotoxicity), and BBBP (blood-brain barrier permeation).

Bridging the Intuition Gap

SME moves the conversation from "atom importance" to "fragment importance." As seen in Figure 1, while atom-level masking provides some signal, substructure masking reveals much clearer, systematic trends that align with chemical knowledge (e.g., identifying exactly which alkyl groups drive hydrophobicity).

Figure 1: SME explanation of aqueous solubility. Panels (a) and (b) compare atom-level vs. substructure-level attributions for two molecules. Panel (c) shows the global average attribution for various functional groups, revealing learned SAR rules.

Global SAR Mining and Model Debugging

By averaging attributions across an entire dataset, SME can "rediscover" classic Structure-Activity Relationship (SAR) rules. For example, it correctly identified that adding hydroxyl groups generally increases solubility, while large alkyl groups decrease it. SME also acts as a diagnostic tool. In one case, the model incorrectly predicted that an isocyanate group was "detoxifying." SME revealed that this happened because the training set was highly imbalanced, containing very few examples of that group. This alerts chemists when a model is "right for the wrong reasons" or simply lacks enough data to be reliable.

Quantitative Performance

The underlying GNN models performed exceptionally well, achieving an $R^2$ of 0.927 on the ESOL test set and ROC-AUC scores above 0.90 for Mutagenicity and BBBP. More importantly, the SME explanations proved highly accurate: the average functional group attributions generated by SME showed a high correlation ($r = 0.882$) with the model's actual solubility predictions. In the Mutagenicity task, SME successfully identified known "toxophores" like aromatic nitro and amino groups.

Conclusion

While SME is a significant step forward, the authors acknowledge several hurdles, including data dependency, tautomer representation, and the efficiency of exploring the massive space of possible substructure combinations. Overall, SME provides a transparent window into the "mind" of a GNN, transforming it from a black box into a collaborative tool for medicinal chemists.

Summary updated

BibTeX
@inproceedings{wu2023chemistry,
  author = {Zhenhua Wu and Jike Wang and Hongyan Du and Dejun Jiang and Yu Kang and Dan Li and Peichen Pan and Yafeng Deng and Dongsheng Cao and Chang‐Yu Hsieh and Tingjun Hou},
  title = {{Chemistry-intuitive explanation of graph neural networks for molecular property prediction with substructure masking}},
  booktitle = {Nature Communications},
  year = {2023},
  doi = {10.1038/s41467-023-38192-3},
}
Figure