Constrained Bayesian optimization for automatic chemical design using variational autoencoders

Ryan‐Rhys Griffiths, José Miguel Hernández-LobatoChemical 2019 · DOI

TL;DR

This paper tackles the problem of generating valid and high-quality molecules using machine learning. They propose a "constrained Bayesian optimization" approach that significantly improves the success rate of generating chemically valid structures compared to previous methods, by preventing the optimization from exploring "dead regions" in the model's latent space.

What Problem Does This Paper Address?

The automatic generation of novel molecules with desired properties is a major goal in fields like drug discovery and materials science. A popular approach involves using variational autoencoders (VAEs) to represent molecules in a continuous "latent space" and then employing Bayesian optimization (BO) to search this space for molecules that optimize a specific objective function (e.g., drug-likeness). However, the original "Automatic Chemical Design" method, which uses BO on a VAE's latent space, suffers from a critical flaw: it frequently generates invalid molecular structures. The authors identify this as a "training set mismatch" problem, where the BO algorithm, unaware of the VAE's training data distribution, explores regions of the latent space far from where the VAE has learned to decode valid molecules. This leads to the generation of chemically nonsensical outputs.

Methods

The core innovation of this paper is the introduction of constrained Bayesian optimization (CBO) to address the "dead regions" problem. Instead of a standard BO that solely maximizes an objective function $f(z)$, CBO aims to maximize $f(z)$ subject to a constraint $Pr(C(z)) \ge 1 - \delta$. Here, $C(z)$ represents a Boolean constraint that a latent point $z$ must satisfy, and $Pr(C(z))$ is the probability that this constraint is met.

To implement this, the authors train a Bayesian Neural Network (BNN) as a "learned constraint function." This BNN takes a latent point $z$ as input and outputs the probability that $z$ will decode into a valid molecule. This BNN is trained using data points labeled as "realistic" (valid SMILES strings with a tangible molecular weight) or "non-realistic," derived from diagnostic experiments.

The acquisition function for the CBO is then modified to incorporate this constraint. It prioritizes exploring regions where the constraint is likely to be satisfied, effectively guiding the BO away from the problematic "dead regions" of the latent space.

Datasets

The primary dataset used for training the VAE and for evaluation is a collection of 249,456 drug-like molecules drawn from the ZINC database. This is the same dataset used in the original "Automatic Chemical Design" paper.

For the "Experiment II" focusing on power conversion efficiency (PCE), they utilize data from the Harvard Clean Energy Project, comprising 200,000 molecules. For this experiment, a neural network was trained to predict PCE, serving as a surrogate for ground truth values.

Key Insights and Ideas

  • "Dead Regions" are the Culprit: The paper empirically demonstrates that the generation of invalid molecules stems from the Bayesian optimization exploring regions of the VAE's latent space that are far from the training data distribution.
  • Constrained Optimization as a Solution: Reformulating the search as a constrained optimization problem, where the constraint is the probability of decoding a valid molecule, effectively mitigates the "dead regions" issue.
  • Learned Constraint Function is Key: Training a BNN to act as a probabilistic classifier for valid latent points is a practical and effective way to implement the constraint.
  • Generalizability: The approach is shown to be extensible beyond drug design, successfully applied to optimizing power conversion efficiency for materials.

Key Results

  • Dramatic Improvement in Validity: The constrained BO approach achieved a greater than 80% success rate in generating realistic molecules, compared to less than 5% for the unconstrained baseline.
  • Higher Quality Molecules: The best molecules generated by the CBO consistently ranked in the 100th percentile of the training data scores for the penalized log P objective and above the 90th percentile for other drug-likeness metrics (QED).
  • Increased Novelty: While not a massive leap, CBO also showed an improvement in generating unique novel molecules.
  • Successful Application to PCE: In the power conversion efficiency experiment, the generated molecules also achieved scores in the 90th percentile of the training data distribution.

Limitations and Future Work

  • Heuristic Definitions: The paper acknowledges that definitions for "realistic" molecules (SMILES length > 5) and "tangible molecular weight" are somewhat arbitrary heuristics.
  • Penalized Log P as a Proxy: The use of a penalized log P objective is noted as being chemically misspecified for drug design, but retained for comparison with other methods.
  • Future Work: The authors suggest improvements to the constraint scheme itself and extensions to model heteroscedastic noise. They also highlight the importance of industrially-relevant objective functions and the need for better benchmarking of generative models. Additionally, they propose that for sequential sampling in parallel BO, the batch size should be on the order of the initialization set size to tangibly change uncertainty estimates.

Summary updated

Abstract

Automatic Chemical Design is a framework for generating novel molecules with optimized properties. The original scheme, featuring Bayesian optimization over the latent space of a variational autoencoder, suffers from the pathology that it tends to produce invalid molecular structures. First, we demonstrate empirically that this pathology arises when the Bayesian optimization scheme queries latent space points far away from the data on which the variational autoencoder has been trained. Secondly, by reformulating the search procedure as a constrained Bayesian optimization problem, we show that the effects of this pathology can be mitigated, yielding marked improvements in the validity of the generated molecules. We posit that constrained Bayesian optimization is a good approach for solving this kind of training set mismatch in many generative tasks involving Bayesian optimization over the latent space of a variational autoencoder.
BibTeX
@inproceedings{griffiths2019constrained,
  author = {Ryan‐Rhys Griffiths and José Miguel Hernández-Lobato},
  title = {{Constrained Bayesian optimization for automatic chemical design using variational autoencoders}},
  booktitle = {Chemical},
  year = {2019},
  doi = {10.1039/c9sc04026a},
}
Figure