Interpreting Molecule Generative Models for Interactive Molecule Discovery

1 INTRODUCTION . Designing molecules with desired properties is a fundamental problem in chemistry , which has a variety of applications in drug discovery and material science ( Chen et al. , 2018 ) . Traditional pipelines require exhaustive human efforts and domain knowledge , which are difficult to scale up . Recent studies exploit deep generative models to solve this problem by encoding molecules into a latent space , from which random samples are drawn and decoded to novel molecules ( Walters & Barzilay , 2020 ) . It has been widely observed that such deep molecule generative models are able to facilitate the design and development of drugs and materials from many perspectives ( Lopez et al. , 2020 ; Sanchez-Lengeling & Aspuru-Guzik , 2018 ) . Despite the promising results of deep generative models for molecule generation , much less effort has been made to interpret the learned representations . Most of the existing models are based on deep neural networks , which are known to be short on interpretability ( Samek et al. , 2019 ) . Outside of molecule generation domain , many attempts have been made to improve the interpretability of deep learning models from various aspects , e.g. , representation space ( Zhou et al. , 2016 ) , model space ( Guo et al. , 2021 ) , and latent space ( Shen et al. , 2020 ; Shen & Zhou , 2021 ) . In molecule generation domain , interpretability can be studied in two ways : ( 1 ) the interpretation of learned latent space where steering the value of latent vectors could lead to smooth and continuous molecular property change and ( 2 ) the interpretation of molecular space that adjusting the molecular property could observe smooth structure change of molecules . In addition , it remains challenging to generate molecules with desired properties . Previous works mostly rely on optimization-based , reinforcement learning-based , and searching-based methods to achieve property control of the generated molecules ( Shi et al. , 2020 ; Jin et al. , 2018a ) . Specifically , reinforcement learning-based algorithm ( You et al. , 2018a ) equips the model with rewards designed to encourage the molecule generative models to generate molecules with specific molecular properties . Optimization-based algorithm takes advantage of the learnt latent space by molecule generative models and optimize the molecular properties via Bayesian Optimization ( Liu et al. , 2018 ) . Searching-based algorithm instead searches directly from the chemical space for molecules with optimal properties ( Kwon et al. , 2021 ) . However , these lines of work are designed for molecule generation with optimized property and thus unable to change the property monotonically and smoothly . Besides , current methods are confined to a limited number of molecular properties , which hinders real-world applications in drug discovery and material science . For example , existing work only discover a limited set of molecular properties , such as penalized logP ( octanol-water partition coefficient ) , QED ( Drug-likeness ) , DRD2 activity , etc ( Jin et al. , 2018a ; Shi et al. , 2020 ; Liu et al. , 2018 ; Fu et al. , 2020 ) . Consequently , when molecules with new properties are needed , the models must be re-trained with a different optimization goal , which is significantly time-consuming . To tackle the above challenges , we formulate a new task , molecule manipulation , which aims to improve the interpretability and steerability of a given molecule generative model via continuously manipulating molecular properties . Based on the observation that molecules sharing similar structures/properties tend to cluster in the latent space , we develop MolSpace Explorer , a model-agnostic method to manipulate molecules with continuous changes of molecular properties . Specifically , MolSpace Explorer first identifies the property separation hyperplane which defines the boundary for molecular properties ( e.g. , drug-like or drug-unlike ) in the latent molecular space learned by a given generative model . Based on the property separation hyperplane , we estimate the latent directions that govern molecular properties , which are in turn used to enable continuous change of the molecular structures and properties without re-training the given molecular generative model . To the best our knowledge , this work is one of the earliest attempts to achieve interactive molecule discovery through the steering of pretrained generative models . The experiments demonstrate that our method can effectively quantify the interpretability and steerability of state-of-the-art molecule generative models . To measure the ability of generative models in interpreting molecular properties and generating molecules with continuous property control , we design a new evaluation metric named success rate , which evaluates the percentage of successful manipulations with continuous property-changing molecules over manipulations of a group of molecules . To visualize our method and facilitate interactive molecule discovery for scientists , we develop an interactive system with visualization of real-time molecule manipulations and smooth molecular structure/property changes . Our main contributions are summarized as follows : • We formulate molecule manipulation , a new task which measures the interpretability and steerability of molecule generative models via the ability to manipulate the molecular properties of molecules in the latent space . • We develop a simple yet effective model-agnostic method named MolSpace Explorer for molecule manipulation , which further analyzes current molecule generative models in terms of their interpretability and steerability.terpretation . • Comprehensive experiments demonstrate the effectiveness of our method in quantifying the interpretability and steerability of various molecule generative models . An interactive system is developed for real-time molecule manipulation . 2 RELATED WORK . Molecule Generation . Recent studies have explored a variety of deep generative models for molecule generation . Specifically , GrammarVAE ( Kusner et al. , 2017 ) designs a variational autoencoder-based model that represents molecules as SMILE strings . With the advancement of graph neural networks ( GNN ) , a surge of GNN-based generative models have been proposed to tackle the problem , by combining GNN with variational autoencoders ( VAEs ) , generative adversarial networks ( GANs ) , normalizing flows , energy-based models ( EBMs ) , and reinforcement learning ( Olivecrona et al. , 2017 ; De Cao & Kipf , 2018 ; Jin et al. , 2018a ; Zhou et al. , 2019 ; Madhawa et al. , 2019 ; Shi et al. , 2020 ; Luo et al. , 2021 ; Liu et al. , 2021 ; Yang et al. , 2021 ) . To be specific , JT-VAE ( Jin et al. , 2018a ) proposes a VAE-based architecture to encode both atomic graphs and structural graphs for efficient molecule generation . MolGAN ( De Cao & Kipf , 2018 ) exploits GANs for molecule generation , where discriminators are used to encourage the model to generate realistic and chemically-valid molecules . MRNN ( Popova et al. , 2019 ) extends the idea of GraphRNN ( You et al. , 2018b ) to formulate molecule generation as an auto-regressive process . GCPN ( You et al. , 2018a ) formulates the molecule generation process as a reinforcement learning problem where it obtains a molecule step by step by connecting atoms and reward is used for controllable generation . GraphNVP ( Madhawa et al. , 2019 ) first introduces normalizing flows for molecule generation , where the generation process is invertible . Later work improve the flow-based models via autoregressive generation ( Shi et al. , 2020 ) , valency correction ( Zang & Wang , 2020 ) , and discrete latent representation ( Luo et al. , 2021 ) . GraphEBM ( Liu et al. , 2021 ) introduces energy-based models which models the density of molecule data . Controllable Molecule Generation . Another key point for molecule generation is controllable generation where the generated molecules are expected to possess certain properties . Early work ( Segler et al. , 2018 ) bias on the distribution of the data and fine-tune the generative models with known desired properties to generate molecules with desired properties . The recent work mainly leverage optimization-based ( Shi et al. , 2020 ; You et al. , 2018a ; Hoffman et al. , 2020 ; Winter et al. , 2019 ; ? ) , reinforcement learning-based ( Zang & Wang , 2020 ; Jin et al. , 2018a ; Blaschke et al. , 2020 ) , and searching-based ( Brown et al. , 2019 ; Yang et al. , 2020 ; Kwon et al. , 2021 ) approaches to generate molecules with desired properties . Optimization-based methods are quite flexible and can both directly work on the molecules ( Renz et al. , 2019 ; Fu et al. , 2020 ; Xie et al. , 2021 ; Maziarz et al. , 2021 ) and work on the learnt latent vectors of the molecules ( Gómez-Bombarelli et al. , 2018 ; Jin et al. , 2018b ; Winter et al. , 2019 ; Griffiths & Hernández-Lobato , 2020 ; Notin et al. , 2021 ) . Reinforcement learning-based methods usually formulates controllable generation as a sequential decision-making problem and requires a score-function to provide rewards to the agent . Searching-based approaches ( Brown et al. , 2019 ; Yang et al. , 2020 ; Kwon et al. , 2021 ) are also capable of searching molecules with optimized properties . Besides , few work ( Chenthamarakshan et al. , 2020 ; Das et al. , 2021 ) leverage the learnt latent space and achieve controllable generation by accepting/rejecting sampled molecules based on a molecular property predictor . Despite the ability to generate molecules with optimized properties , it is challenging for existing methods to interpret the generation process and can not generate molecules with monotonically and smoothly changing molecular properties . 3 PRELIMINARIES . Molecule Graph . Molecules can be presented as graphs X = ( V , E , E , F ) , where V denotes a set of N vertices ( i.e. , atoms ) , E ⊆ V × V denotes a set of edges ( i.e. , bonds ) , F ∈ { 0 , 1 } N×D denotes the node features ( i.e. , atom types ) and E ∈ { 0 , 1 } N×N×K denotes the edge features ( i.e. , bond types ) . The number of atom types and bond types are denoted by D and K , respectively . Deep Molecule Generative Models . In molecule generation , a generative model M encodes the molecular graph X as a latent vector Z ∈ Rl with l being the dimension of the latent space , and is capable of decoding any latent vector back to the molecular space . Specifically , variational autoencoder ( VAE ) ( Kingma & Welling , 2013 ) and flow-based model ( Flow ) ( Rezende & Mohamed , 2015 ) are the two most commonly used models for molecule generation tasks . Both of them encode the data from molecular space to latent space , which is usually modeled as a Gaussian distribution ; then they decode the latent code back to molecular space . They can be formulated as : z = f ( x ) , x′ = g ( z ) , ( 1 ) where x and x′ are the ground-truth and reconstructed/sampled data respectively , and z ∈ Z represents a latent vector in the latent space . 4 PROBLEM FORMULATION OF MOLECULE MANIPULATION . To improve the steerability and interpretability of molecule generative models , we propose a new research task , molecule manipulation , which interprets the generative model and steers the properties of the output molecules . To be specific , a deep generative model contains a generator g : Z → X , whereZ ∈ Rl stands for the l-dimensional latent space , which is commonly assumed to be Gaussian distribution ( Kingma & Welling , 2013 ; Rezende & Mohamed , 2015 ) . There exist property functions fP which define the property space P via P = fP ( X ) . drug-dislike mols Formulation . The input to molecule manipulation is a list of n molecules X = { x1 , x2 , · · · , xn } and a list of m molecular properties P = { p1 , p2 , · · · , pm } . We aim to manipulate one or more molecular properties p of a given molecule in a k consecutive steps and output the manipulated molecules with properties p′ = { p ( 1 ) , p ( 2 ) , · · · , p ( k ) } . By manipulating the given molecule , we can observe the alignment of Z → X → P , where the relationship between Z and X explains the latent space of molecule generative models . The relationship between X and P reveals the correlations between molecular structures and properties . By traversing latent space , we can generate molecules with continuous structure/property changes . Evaluation . For the molecule manipulation task , we design two new evaluation metrics named success rate ( SR ) and soft success rate ( SSR ) that measure the performance in discovering latent molecular property directions . To be specific , we consider a manipulation to be successful only if we generate molecules with monotonically-changing properties in a consecutive k steps of manipulation , as follows : φsuccess ( x , k ) = 1 [ ∀ i ∈ [ k ] , s.t. , fp ( x ( i ) ) − fp ( x ( i+1 ) ) ≤ 0 ] , ( 2 ) where fp is a property function which calculates certain molecular property and x ( i ) , x ( i+1 ) represents molecules generated in two adjacent steps . As monotonicity is rather strict , we propose a more flexible definition of success , namely soft success , as follows : φsoft success ( x , k ) = 1 [ ∀ i ∈ [ k ] , s.t. , fp ( x ( i ) ) − fp ( x ( i+1 ) ) ≤ ] , ( 3 ) where is a predefined tolerance threshold that weakens the monotonicity requirement . To extend the evaluation metric for |P | molecular properties and |X| candidate molecules to manipulate , we calculate the overall SR as : SR ( P , X , k ) = ∑ p∈P , x∈X 1 [ φsuccess ( xp , k ) ∧ φSD ( xp , k ) ∧ φDIV ( xp , k ) ] |P | × |X| , ( 4 ) where xp represents manipulating property p of molecule x which results in a manipulation path xp = { x ( i ) p |i ∈ [ k ] } . Since the molecular space is essentially discrete , we allow the model to generate duplicate molecules during manipulation , but the model has to generate at least one distinct molecule from the base molecule ( diversity or DIV ) and the structure difference ( SD ) enforces monotonically-decreasing structure similarity along the manipulation sequence , as follows : φDIV ( x , k ) = 1 [ ∃ i ∈ [ k ] , s.t. , x ( i ) 6= x ( 1 ) ] , ( 5 ) φSD ( x , k ) = 1 [ ∀ i ∈ [ k ] , s.t. , δ ( x ( i ) , x ( 1 ) ) − δ ( x ( i+1 ) , x ( 1 ) ) ≥ 0 ] , ( 6 ) where δ measures the structure similarity between the two input molecules . Similarly , we provide a soft structure difference ( SSD ) with a predefined tolerance threshold γ as follows : φSSD ( x , k ) = 1 [ ∀ i ∈ [ k ] , s.t. , δ ( x ( i ) , x ( 1 ) ) − δ ( x ( i+1 ) , x ( 1 ) ) ≥ γ ] , ( 7 ) Finally , we calculate the overall SSR as : SSR ( P , X , k ) = ∑ p∈P , x∈X 1 [ φsoft success ( xp , k ) ∧ φSSD ( xp , k ) ∧ φDIV ( xp , k ) ] |P | × |X| , ( 8 ) ‘

Summary: This paper proposes Molecular Space Explorer (MolSpacE), a method to generate molecules with continuously varying properties using a pre-trained latent variable generative model. It essentially involves 3 steps (although these steps were not clearly spelled out in the paper):  1. Sample many points from the model and evaluate their properties 2. For each property, train a SVM to predict the property given the the latent vector 3. Use the normal to this hyperplane as a "property manipulation" direction in latent space, which can be added a latent vector to change the property value of the decoded molecule.