Manuscript Offprint

arXiv:2608.30472

ToxLens: A Reproducible Graph-Learning Framework for Leakage-Aware, Uncertainty-Calibrated Molecular Toxicity Prediction

Magnus H. Strømme, Alex G. C. de Sá, David B. Ascher

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Magnus H. Strømme 1^{1}, Alex G. C. de Sá 1,2,∗^{1,2,*}, David B. Ascher 1,2,∗^{1,2,*}

1^{1}The Australian Centre for Ecogenomics, School of Chemistry and Molecular Biosciences, The University of Queensland, Brisbane, Queensland, 4072, Australia

2^{2}Computational Biology and Clinical Informatics, Baker Heart and Diabetes Institute, Melbourne, Victoria, 3004, Australia

*D.B.A., tel. +61 7 3365 3891, email d.ascher@uq.edu.au; or A.G.C.d.S., email a.desa@uq.edu.au.

Abstract. Molecular toxicity prediction is increasingly used to prioritise compounds before experimental testing, but conventional benchmark performance can overstate practical utility when structurally related molecules occur across training and test folds. We introduce ToxLens, a reproducible multi-task graph-learning framework for 11 toxicity endpoints spanning Ames mutagenicity, acute oral toxicity, hERG inhibition, and Tox21 nuclear-receptor and stress-response assays. The workflow combines conservative chemical curation, sphere-exclusion filtering, a leakage-aware UMAP-HDBSCAN split, parallel graph and global-feature encoders joined by late concatenation, temperature-scaled Monte Carlo dropout with conformal-style prediction sets, applicability-domain analysis, and SHAP-guided toxicophore discovery with occlusion controls. On the leakage-controlled test fold, a five-seed soft-voting ensemble achieved a Matthews correlation coefficient (MCC) score of 0.44, an area under the receiver operating characteristic curve (AUROC) score of 0.83, and an area under the precision-recall curve (AUPRC) score of 0.58. It exceeded four ECFP4-based shallow baselines on all 11 endpoints under the same split and validation-based threshold-selection protocol. Controlled ablations showed that the global pathway was important, whereas late concatenation outperformed the tested gated and feature-wise linear modulation fusion variants. Conformal-style prediction sets revealed substantial endpoint-specific variation in set efficiency, and discrimination and calibration improved with similarity to the training domain. Retraining on fixed published Tox21 Challenge and Therapeutics Data Commons folds produced competitive, but not uniformly state-of-the-art, performance. SHAP-guided occlusion and consensus subgraph mining yielded model-derived structural hypotheses, 44 of which contained at least one occurrence that passed the predefined counterfactual criteria.

Scientific Contribution. ToxLens integrates leakage-controlled partitioning, uncertainty reporting, applicability-domain auditing, and counterfactually controlled structural interpretation within one reproducible multi-task toxicity workflow. Its scientific contribution is the auditable combination and fixed-split evaluation of these components, rather than a claim of universal state-of-the-art discrimination.

Keywords: Molecular toxicity; graph neural networks; multi-task learning; conformal prediction; applicability domain; explainable artificial intelligence.

1. Introduction

Chemical toxicity is the capacity of a substance to cause adverse effects in biological systems. Computational toxicity prediction has therefore become an important component of early compound triage [11, 16, 17]. Experimental toxicity assays are costly and time-consuming, and they cannot screen chemical libraries at the scale required for modern drug discovery, chemical-safety assessment, and environmental prioritisation [18-23]. Machine-learning models can complement these assays by estimating toxicity risk from molecular structure, thereby supporting compound deprioritisation, redesign, or selection for confirmatory testing.

Despite rapid progress in molecular machine learning, practical reliability cannot be inferred from benchmark metrics alone [8, 105]. Reported performance can be inflated when structurally similar molecules, near-duplicates, or closely related chemotypes occur across training and test folds [24-28, 33]. In such settings, a model may appear to generalise while relying partly on interpolation among close analogues [31, 52]. This issue is especially important in prospective toxicity prediction, where query compounds may be structurally distinct from the training distribution. A useful model should therefore report structural separation, applicability-domain behaviour, and uncertainty alongside predictive discrimination [32, 56, 57].

A second limitation is that many high-capacity molecular models [34–36, 38–40] provide limited chemically interpretable evidence for their predictions [44]. Toxicologists and medicinal chemists often reason in terms of structural alerts, reactive groups, physicochemical liabilities, metabolic activation and known toxicophore patterns [91–93]. A black-box toxicity score, even when accurate on a held-out set, is less useful if it cannot be related back to substructures that plausibly drive the prediction [41]. Post hoc attribution methods can help [15], but saliency maps should not always be treated as evidence on their own [42]. For molecular safety applications, explanations should be tested for faithfulness by perturbing or masking the highlighted substructures and quantifying whether the prediction changes in the expected direction [43].

A third challenge is uncertainty quantification. Binary classifiers are commonly forced to assign every molecule to a toxic or non-toxic class, even when a compound is far from the training distribution or an endpoint is sparse, noisy, or imbalanced [72, 74, 75]. Such forced decisions are poorly matched to chemical triage, where some compounds should instead be flagged for additional testing. Conformal prediction converts model scores into prediction sets with finite-sample marginal coverage under exchangeability [73, 78, 81]. In this setting, a singleton set represents a precise class assignment, whereas a two-label set explicitly communicates that the calibrated evidence is insufficient to distinguish the classes [79, 80].

To address these challenges, we developed ToxLens, a reproducible, leakage-aware framework for multi-task molecular toxicity prediction. ToxLens combines chemical standardisation and conservative duplicate-label handling [29, 30, 37], sphere-exclusion filtering [47], a UMAP-HDBSCAN molecular partition designed to reduce structural leakage [4, 53, 54], a graph neural network paired with a global molecular-feature pathway [1, 2], temperature-scaled Monte Carlo dropout with conformal-style prediction sets [72, 73], and a SHAP-guided toxicophore-mining workflow [15]. The model is evaluated on 11 endpoints comprising Ames mutagenicity [5], acute oral toxicity [6], hERG inhibition [7], and Tox21 nuclear-receptor and stress-response assays [10]. On the leakage-controlled split, the five-seed ensemble achieved macro MCC 0.44, macro AUROC 0.83, and macro AUPRC 0.58, and exceeded ECFP4-based shallow baselines [9] on all 11 endpoints. Separate architecture-level benchmarks retrained ToxLens on fixed published Tox21 Challenge and Therapeutics Data Commons folds to assess transfer under externally defined data partitions.

ToxLens demonstrates how molecular toxicity models can be evaluated and deployed with a broader reliability stack: leakage-controlled validation, applicability-domain auditing, calibrated abstention, reproducible external benchmarking and chemically grounded interpretation. This combination is intended to make toxicity prediction more transparent, reproducible and useful for compound prioritisation.

References (98)

  • How powerful are graph neural networks? ICLR. arXiv:1810.00826 (opens arXiv in a new tab)
  • Strategies for pre-training graph neural networks
  • FiLM: Visual reasoning with a general conditioning layer
  • UMAP-based clustering split for rigorous evaluation of AI models for virtual screening on cancer cell lines
  • Quantitative structure–activity relationship modeling of rat acute toxicity by oral exposure
  • CardioTox net: A robust predictor for hERG channel toxicity using deep learning
  • Comparison of the predicted and observed secondary structure of T4 phage lysozyme
  • Extended-connectivity fingerprints
  • Tox21 Challenge to build predictive models of nuclear receptor and stress response pathways
  • DeepTox: Toxicity prediction using deep learning
  • Analyzing learned molecular representations for property prediction
  • Communicative representation learning on attributed molecular graphs (opens the publisher in a new tab)
  • Pushing the boundaries of molecular representation for drug discovery with the graph attention mechanism (opens the publisher in a new tab)
  • Applications of machine learning in drug discovery and development
  • Concepts of artificial intelligence for computer-assisted drug discovery
  • Toxicity testing in the 21st century: A vision and a strategy
  • Toxicology for the twenty-first century
  • Improving the human hazard characterization of chemicals: A Tox21 update
  • ToxCast chemical landscape: Paving the road to 21st century toxicology
  • The next generation blueprint of computational toxicology at the U.S. Environmental Protection Agency
  • MoleculeNet: A benchmark for molecular machine learning
  • A deep learning approach to antibiotic discovery
  • Experimental error, kurtosis, activity cliffs, and methodology
  • Exposing the limitations of molecular machine learning with activity cliffs
  • Best practices for QSAR model development, validation, and exploitation
  • Trust, but verify: On the importance of chemical structure curation in cheminformatics and QSAR modeling research
  • QSAR modeling: Where have you been? Where are you going to? Journal of Medicinal Chemistry, 57(12), 4977–5010
  • Cross-validation strategies for data with temporal, spatial, hierarchical, or phylogenetic structure
  • The properties of known drugs
  • Most ligand-based classification benchmarks reward memorization rather than generalization
  • ChemBERTa: Large-scale self-supervised pretraining for molecular property prediction (opens arXiv in a new tab)
  • Self-referencing embedded strings (SELFIES)
  • Translation between molecules and natural language
  • SMILES, a chemical language and information system
  • Large-scale chemical language representations capture molecular structure and properties
  • Molecular transformer
  • SMILES-BERT: Large scale unsupervised pre-training for molecular property prediction
  • Stop explaining black box machine learning models for high stakes decisions and use interpretable models instead
  • Sanity checks for saliency maps
  • A benchmark for interpretability methods in deep neural networks
  • Drug discovery with explainable artificial intelligence
  • Uniform manifold approximation and projection
  • Density-based clustering based on hierarchical density estimates
  • Parameter based methods for compound selection from chemical databases
  • Multitask learning
  • A survey on multi-task learning
  • Adverse outcome pathways
  • RDKit: Open-source cheminformatics software
  • Time-split cross-validation as a method for estimating the goodness of prospective prediction
  • UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction
  • hdbscan: Hierarchical density based clustering
  • Unsupervised database clustering based on Daylight's fingerprint and Tanimoto similarity
  • Current status of methods for defining the applicability domain of (Q)SARs
  • Principles of QSAR models validation: Internal and external
  • Iterative partial equalization of orbital electronegativity
  • Prediction of physicochemical parameters by atomic contributions
  • Fast calculation of molecular polar surface area
  • A widely applicable set of descriptors
  • Electrotopological state indices for atom types
  • Open-source platform to benchmark fingerprints for ligand-based virtual screening
  • New substructure filters for removal of PAINS
  • Experimental and computational approaches to estimate solubility and permeability
  • Molecular properties that influence the oral bioavailability of drug candidates
  • Neural message passing for quantum chemistry
  • Convolutional networks on graphs for learning molecular fingerprints
  • Molecular graph convolutions: Moving beyond fingerprints
  • Simple and scalable predictive uncertainty estimation using deep ensembles
  • Dropout as a Bayesian approximation
  • Distribution-free predictive inference for regression
  • What uncertainties do we need in Bayesian deep learning for computer vision? NeurIPS, 30
  • Can you trust your model's uncertainty? NeurIPS, 32
  • Deep networks with stochastic depth
  • Classification with valid and adaptive coverage
  • Algorithmic Learning in a Random World
  • Introducing conformal prediction in predictive modeling
  • Predicting with confidence: Using conformal prediction in drug discovery
  • Conformal prediction: A gentle introduction
  • Verification of forecasts expressed in terms of probability
  • Strictly proper scoring rules, prediction, and estimation
  • The relationship between precision-recall and ROC curves
  • The precision-recall plot is more informative than the ROC plot when evaluating binary classifiers on imbalanced datasets
  • Fast graph representation learning with PyTorch Geometric
  • Axiomatic attribution for deep networks
  • Captum: A unified and generic model interpretability library for PyTorch (opens arXiv in a new tab)
  • Definitive relationships among chemical structure, carcinogenicity and mutagenicity for 301 chemicals tested by the U.S. NTP. Mutation Research, 257(3), 229–306
  • Mechanisms of chemical carcinogenicity and mutagenicity
  • Derivation and validation of toxicophores for mutagenicity prediction
  • A density-based algorithm for discovering clusters in large spatial databases with noise
  • early recognition
  • Random forests
  • XGBoost: A scalable tree boosting system
  • Support-vector networks
  • Probabilistic outputs for support vector machines and comparisons to regularized likelihood methods
  • Computational toxicology: Its essential role in reducing drug attrition
  • hERG K+ channels: Structure, function, and clinical significance
  • Algorithms for hyper-parameter optimization
  • On calibration of modern neural networks
  • The advantages of the Matthews correlation coefficient (MCC) over F1 score and accuracy in binary classification evaluation