Drug Discovery under Covariate Shift with Domain-Informed Prior Distributions over Functions

Leo Klarner, Tim G. J. Rudner, Michael Reutlinger, Torsten Schindler, Garrett M. Morris, Charlotte Deane, Yee Whye Teh

TL;DR

Q-SAVI (Quantitative Structure-Activity Variational Inference) is a new probabilistic framework that tackles the "extrapolation problem" in drug discovery. By encoding domain-specific prior knowledge directly into a distribution over functions rather than just model weights, it enables neural networks to generalize more robustly to novel chemical spaces and provide more reliable uncertainty estimates.

What Problem Does This Paper Address?

In early-stage drug discovery, we are looking for a needle in a haystack—or rather, a specific molecule in a "chemical space" of $10^{60}$ possibilities. The challenge is that experimental data is scarce and highly biased. Chemists tend to explore "chemical series" of similar molecules, meaning our training data is a tiny, non-representative sliver of the space we actually want to search.

This creates a massive covariate shift: the molecules we want to predict (the test set) look fundamentally different from the ones we trained on. Standard deep learning models are notorious for failing under these conditions; they don't just make wrong predictions, they make confident wrong predictions. As shown in Figure 1, while models might work well in the "interpolative" regime (a), they become unreliable when asked to "extrapolate" to novel chemical structures (b).

Figure 1. In early-stage drug discovery, bioactivity labels are usu- ally only available for a small and biased subset of compounds (a). However, predictions are often most useful for novel molecules that are dissimilar to the ones already explored—an evaluative setting in which deep learning algorithms perform unreliably (b). We demonstrate that using a regularizing distribution over func- tions to encode prior knowledge of drug-like chemical space into the modeling process improves the predictive performance and calibration of neural networks in this extrapolative regime (c).

Methods

The authors introduce Q-SAVI, which shifts the focus from parameter-space to function-space.

Standard Bayesian Neural Networks (BNNs) place a prior distribution over the model weights ($p(\theta)$). However, it's incredibly difficult for a human expert to translate "I think the model should be uncertain here" into a specific distribution of millions of weights.

Q-SAVI instead defines a prior over the outputs of the function ($p(f)$). Key components include:

  1. Context Points: The model uses a large set of unlabeled, "drug-like" molecules (sampled from the ZINC database) as context points. These represent the broader chemical space the model might encounter.
  2. Function-Space Prior: Researchers can specify how the model should behave on these context points. For example, they can encode a preference for high uncertainty in regions far from the training data.
  3. Variational Inference: The model is trained to balance fitting the labeled training data with adhering to this function-space prior across the wider chemical domain.

This approach is visualized in Figure 2, where the prior (gray dashed lines) helps constrain the model's hypothesis space, leading to better behavior in the red "extrapolation" zone.

Figure 2. When trained on a small and highly biased subset of chemical space, standard neural networks (gray) rarely generalize well in the extrapolative regime. Our approach enables the construction of a problem-informed regularizing prior distribution over functions to place soft constraints on a neural network’s hypothesis space, enabling better generalization and uncertainty quantification under covariate shift. In-distribution training points are shown in (blue) and out-of-distribution test points are shown in (red).

Datasets

The authors emphasize that many public bioactivity datasets are "noisy" due to experimental artifacts like assay interference. To ensure a rigorous test, they used:

  • A Curated Antimalarial Dataset: Derived from Antonova-Koch et al. (2018), this dataset was carefully cleaned to remove false positives and confirmed via counter-screens.
  • Merck Molecular Activity Challenge: A real-world production dataset consisting of 15 time-split tasks, representing the actual data shift encountered during drug optimization campaigns.

They also explored different ways to split data to simulate covariate shift, moving beyond simple "Random" or "Scaffold" splits to more challenging "Molecular Weight" and "Spectral" splits (visualized in Figure 4).

Figure 4: UMAP visualization of different data splits. Spectral and Molecular Weight splits induce significantly stronger covariate shifts than standard random or scaffold splits.

Key Insights and Ideas

  • Scaffold Splits are Not Enough: A common practice in the field is "scaffold splitting" (grouping by molecular core). The authors show that even molecules with different scaffolds can be structurally very similar (Figure 5), meaning scaffold splits might underestimate the difficulty of real-world extrapolation.
  • The Power of Unlabeled Data: By using millions of unlabeled molecules from ZINC as "context points," Q-SAVI effectively "sees" the boundaries of drug-like chemical space during training, even if it doesn't have labels for those regions.
  • Calibration Matters: In drug discovery, a false positive is expensive. Q-SAVI doesn't just improve accuracy; it significantly improves calibration (measured by Brier Score and ACE), meaning when the model says it's 80% sure, it's actually right about 80% of the time.
Figure 5: Molecules with nominally different scaffolds can still be structurally and functionally similar, illustrating why standard scaffold splits can be misleading.

Key Results

  • Outperforming the Giants: Q-SAVI consistently outperformed state-of-the-art self-supervised models like GROVER and GIN, as well as specialized domain adaptation techniques (like IRM and DANN), particularly on the most challenging Spectral and Molecular Weight splits.
  • Antimalarial Task: On the Spectral split, Q-SAVI achieved an AUC-ROC of 0.606, compared to 0.574 for a standard MLP and 0.589 for a Deep Ensemble.
  • Merck Challenge: Q-SAVI outperformed all baselines on the three most shifted datasets (HIVPROT, DPP4, NK1) by a statistically significant margin. For instance, on HIVPROT (bit vector), it achieved a Mean Squared Error of 0.664, beating the next best model (L1-Regression at 0.714).

Limitations and Future Work

The primary limitation is computational cost. Because Q-SAVI performs a forward pass over both a mini-batch of training data and a sample of context points at every step, it is slower than standard training. However, the authors found this increase to be manageable (comparable to training a small ensemble).

Future work could involve:

  • Using Q-SAVI to construct better acquisition functions for active learning.
  • Integrating more complex prior knowledge, such as synthetic accessibility or patentability constraints, directly into the function-space prior.
  • Exploring how this framework could assist in "scaffold hopping"—finding novel chemical cores that maintain the same biological activity.

Summary updated

Abstract

Accelerating the discovery of novel and more effective therapeutics is an important pharmaceutical problem in which deep learning is playing an increasingly significant role. However, real-world drug discovery tasks are often characterized by a scarcity of labeled data and significant covariate shift$\unicode{x2013}\unicode{x2013}$a setting that poses a challenge to standard deep learning methods. In this paper, we present Q-SAVI, a probabilistic model able to address these challenges by encoding explicit prior knowledge of the data-generating process into a prior distribution over functions, presenting researchers with a transparent and probabilistically principled way to encode data-driven modeling preferences. Building on a novel, gold-standard bioactivity dataset that facilitates a meaningful comparison of models in an extrapolative regime, we explore different approaches to induce data shift and construct a challenging evaluation setup. We then demonstrate that using Q-SAVI to integrate contextualized prior knowledge of drug-like chemical space into the modeling process affords substantial gains in predictive accuracy and calibration, outperforming a broad range of state-of-the-art self-supervised pre-training and domain adaptation techniques.
BibTeX
@inproceedings{klarner2023drug,
  author = {Leo Klarner and Tim G. J. Rudner and Michael Reutlinger and Torsten Schindler and Garrett M. Morris and Charlotte Deane and Yee Whye Teh},
  title = {{Drug Discovery under Covariate Shift with Domain-Informed Prior Distributions over Functions}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=BbZVFj0QPv},
}
Figure