Predicting clinical trial outcomes

Clinical trial outcome models combining tabular, molecular, protein, and text features. Includes time-based evaluation and leakage diagnostics, with same-drug target encoding still unresolved.

At a glance

Question
Can molecular, tabular, and text features predict trial outcomes without exploiting evaluation leakage?
My contribution
Compared multimodal features, time-based splits, and leakage diagnostics, and built a small browser demonstration.
Result & scope
Ongoing. Same-drug target encoding remains an unresolved evaluation issue. Demo outputs are illustrative, not a trial-planning service.

I built a Phase 3 clinical trial outcome predictor to study how trial design, molecular features, and protocol text contribute to prediction across time and indications.

The data is all open. ClinicalTrials.gov publishes its full database through AACT (582,806 trials going back to the 1990s, refreshed monthly), and Drugs@FDA tells you which compounds eventually got approved. The first afternoon I had a LightGBM model hitting 0.77 AUROC on a time-based held-out split. Trial design features, sponsor type, prior-trial counts, the standard tabular stuff. That felt right, matched what the published literature reports for similar setups.

The next morning I tried to push harder. Joined in features from ChEMBL, FDA AdCom voting records, FAERS adverse event reports. By lunch I was at 0.87. Which is when I started getting suspicious.

Published trial outcome prediction work clusters around 0.70–0.85 AUROC. HINT at NeurIPS 2022, Lo’s 2023 paper, Hong 2020. The jump to 0.87 prompted a review of feature provenance, which exposed a label proxy. I was using whether the drug ever showed up in Drugs@FDA as a feature, which is basically the label. Drugs in the FDA database are drugs that completed P3 successfully, almost by construction. The model was learning “matched to FDA → succeeds” and it was right but for the wrong reason.

I dropped the FDA-match features and rebuilt with more care. Prior trials of the same compound, time-truncated to registration date so future information couldn’t sneak in. Orphan designation status at registration date, not “ever”. Mechanism of action via a multi-step fuzzy match against the ChEMBL preferred-name and synonym tables. The AUROC returned to approximately 0.87, so I tested whether other features carried unintended outcome information.

So Day 3 turned into the meaningful part of the project: an explicit leakage audit. The thing I’d missed on Day 2 was that the FDA-match feature wasn’t obviously a label proxy until I looked at it sideways, and there’s probably some other feature in 108 doing the same thing more subtly. Three checks. Train the model on shuffled training labels and evaluate on the real test set: this negative control scored 0.4818, near chance. A passing shuffled-label check does not by itself rule out outcome information in the features. Retraining under the audit gave 0.8603 on the held-out time split, against 0.8718 for the Day-2 model. I also ran a five-fold within-train cross-validation, but its result wasn’t saved to a file, so I’m not quoting a number for it. Per-feature univariate train/test AUROC delta — no feature has a test AUROC outside [0.30, 0.70]. The top one is “mechanism of action unknown” at 0.695, which is biologically plausible. Drugs whose mechanism nobody documented tend to fail more.

Leakage audit: Day-2 held-out AUROC 0.872, audit retrain 0.860, shuffled-label control 0.482 (chance).

The audit caught a bug in itself, which is worth mentioning because the same bug probably lives in other people’s AACT pipelines. The first audit run produced AUROC 0.91+, which I knew was impossible. After about an hour of staring at column indices I found it. The audit was loading features_v2.parquet and indexing by position into the split pickle, but the split pickle’s positional indices reference cohort_<task>_nct_ids.parquet row order, not features row order. So the audit was scoring mis-aligned rows and convincing itself the model was psychic. The fix is set_index('nct_id').loc[cohort_ncts] instead of isin(keep).reset_index(). Worth knowing if you work with these splits.

After the audit cleared I added the multimodal fusion. ChemBERTa-77M on canonical SMILES, ESM2-150M on protein target sequences, SciBERT on protocol text (title plus brief summary, truncated to 512 tokens). Cross-attention transformer over the five modality tokens. Against a tabular-only model trained in the same pipeline, the P3/time AUROC moved from 0.8672 to 0.8746. A +0.007 lift. Underwhelming, and not uniform: across the eight task-and-split combinations, fusion helped on five and hurt on three (worst: Phase-2 target holdout, −0.019).

The interesting result is buried in the per-split breakdown. On Phase-3 indication holdout, where the test set is therapeutic areas the train set never saw, the lift from adding the deep modalities is +0.034 (+0.008 for Phase 2). Text and protein embeddings generalize to held-out indications in a way one-hot indication codes can’t, because those one-hots are by construction zero on held-out classes. So the deep modalities pay off exactly where you’d expect: out-of-distribution generalization on categorical features that fail by definition.

The demo above is a smaller, simpler version. Eight features instead of 108, AUROC 0.85 instead of 0.87, because the architectural ceiling for eight features is just lower. The full leak-clean Day-2 model is a 7.2MB LightGBM file with isotonic calibration on the validation fold. I exported a tiny version for the page because typing 108 features into a form is not a good user experience.

The current assessment is provisional. The multimodal-fusion approach is competitive with published work, not above it. The audit retained a score near 0.86, but unresolved target-encoding concerns limit its interpretation. The thing I’d defend as the actual contribution is the audit methodology. The null-label experiment in particular is a check I’d encourage anyone doing this kind of work to run. It caught nothing here. One other check did not come back clean, though. The success-rate features are target-encoded from training trials, and when I recomputed them for 10 sampled test trials excluding every trial of the same drug, the drug-class rate shifted by up to 0.62. So the encoding carries information from the same compound’s other trials. I haven’t measured how much of the 0.86 that accounts for, and it’s the first thing I would fix: re-encode leave-one-drug-out and retrain.

What didn’t ship is the failure-mode classification — pushing the 33,042 unique why_stopped strings from terminated trials through a language-model classifier to label each as efficacy / safety / PK / recruitment / operational. The batch script is written and resumable but was never run. That would actually be a differentiated contribution — most published trial prediction outputs success/fail, not why — and it’s the thing I’d pick up first if I came back to this.

Repo: github.com/rohit-ravi2/clinical-trial-failure-prediction