Constrained Bayesian Optimization for Automatic Chemical Design

Ryan‐Rhys Griffiths, José Miguel Hernández-LobatoarXiv 2017 · DOI · arXiv

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 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 class of training set mismatch in many generative tasks involving Bayesian optimization over the latent space of a variational autoencoder.

Introduction

In the quest for new medicines and high-performance materials, researchers are increasingly turning to "Automatic Chemical Design." The objective is to leverage machine learning to learn the "language" of chemistry from libraries of known molecules and subsequently generate novel structures that satisfy specific target properties—such as high binding affinity for a protein or record-breaking solar cell efficiency.

However, as demonstrated by Ryan-Rhys Griffiths and José Miguel Hernández-Lobato, these generative models often produce "chemical nightmares"—structures that are mathematically valid within a model's latent space but physically impossible or chemically nonsensical in a laboratory setting. This paper addresses this fundamental failure by introducing a "validity constraint" via Constrained Bayesian Optimization (CBO).

The Problem: Training Set Mismatch

The standard approach to chemical design utilizes a Variational Autoencoder (VAE) to map complex molecular strings (SMILES) into a continuous, high-dimensional latent space. Bayesian Optimization (BO) is then used to navigate this space to find points that maximize a desired property.

The primary issue is that BO is an ambitious explorer. It frequently queries regions of the latent space far removed from the training data. In these "dead regions," the VAE’s decoder fails to produce valid chemical structures, instead generating "chemical gibberish." This training set mismatch means that even when the optimizer identifies a theoretical "peak" in property space, the resulting SMILES string often cannot be synthesized.

Methods: Constraining the Latent Space

To mitigate this pathology, the authors propose shifting from standard BO to Constrained Bayesian Optimization (CBO). The methodology involves four key components:

  1. Latent Mapping: Molecules are mapped to a 56-dimensional latent space using a standard VAE.
  2. Validity Filter: A Bayesian Neural Network (BNN) is trained to act as a constraint function, predicting the probability that a specific point in the latent space will decode into a valid, "drug-like" molecule.
  3. Constrained Search: The search is restricted to regions where the probability of generating a valid molecule is high.
  4. Acquisition Function: The Expected Improvement with Constraints (EIC) function is used to balance the optimization of the target property with the requirement of chemical validity.
The VAE architecture incorporating a learned constraint function within the latent space to ensure chemical validity.

Key Insights and Results

The authors empirically confirmed the "Dead Region" hypothesis. As the search moves further from the training data (simulated by increasing noise levels), the percentage of valid molecules drops significantly. Interestingly, when the model becomes "lost" in these regions, it tends to default to generating methane—the simplest organic molecule—because 'C' is the most frequent character in the training set.

Comparison of molecular validity, methane generation, and drug-likeness across training data and various optimization scenarios.

The results of applying CBO were significant:

  • Validity Improvement: In drug design tasks, the unconstrained baseline produced valid drug-like molecules less than 5% of the time. The constrained model increased this success rate to over 80%.
  • Property Optimization: Molecules identified via CBO consistently ranked in the 90th to 100th percentile of the training data for properties like solubility (logP) and drug-likeness (QED).
  • Material Discovery: In tests using the Harvard Clean Energy Project dataset, CBO successfully identified novel molecules with predicted power conversion efficiencies (PCE) significantly exceeding the training set average.

Conclusion

While CBO significantly improves the reliability of automatic chemical design, challenges remain. Current benchmarks like "penalized logP" may not fully capture the nuances of drug discovery, and the computational cost of training BNNs is higher than standard methods. Furthermore, care must be taken to ensure constraints do not overly restrict the search, potentially missing novel but valid molecules. Nonetheless, by treating chemical validity as a formal constraint, this research provides essential guardrails for AI-driven discovery, moving the field closer to reliable, computer-aided molecular invention.

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 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 class of training set mismatch in many generative tasks involving Bayesian optimization over the latent space of a variational autoencoder.
BibTeX
@misc{griffiths2017constrained,
  author = {Ryan‐Rhys Griffiths and José Miguel Hernández-Lobato},
  title = {{Constrained Bayesian Optimization for Automatic Chemical Design}},
  year = {2017},
  eprint = {1709.05501},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1709.05501},
}
Figure