Learning Graph Models for Retrosynthesis Prediction

Retrosynthesis prediction is a fundamental problem in organic synthesis , where the task is to identify precursor molecules that can be used to synthesize a target molecule . A key consideration in building neural models for this task is aligning model design with strategies adopted by chemists . Building on this viewpoint , this paper introduces a graph-based approach that capitalizes on the idea that the graph topology of precursor molecules is largely unaltered during a chemical reaction . The model first predicts the set of graph edits transforming the target into incomplete molecules called synthons . Next , the model learns to expand synthons into complete molecules by attaching relevant leaving groups . This decomposition simplifies the architecture , making its predictions more interpretable , and also amenable to manual correction . Our model achieves a top-1 accuracy of 53.7 % , outperforming previous template-free and semi-template-based methods . 1 Introduction . Retrosynthesis prediction , first formalized by E. J. Corey [ Corey , 1991 ] is a fundamental problem in organic synthesis that attempts to identify a series of chemical transformations for synthesizing a target molecule . In the single-step formulation , the task is to identify a set of reactant molecules given a target . Beyond simple reactions , many practical tasks involving complex organic molecules are difficult even for expert chemists . As a result , substantial experimental exploration is needed to cover for deficiencies of analytical approaches . This has motivated interest in computer-assisted retrosynthesis [ Corey and Wipke , 1969 ] , with a recent surge in machine learning methods [ Chen et al. , 2019 , Coley et al. , 2017b , Dai et al. , 2019 , Zheng et al. , 2019 , Genheden et al. , 2020 ] . Computationally , the main challenge is how to explore the combinatorial space of reactions that can yield the target molecule . Largely , previous methods for retrosynthesis prediction can be divided into template-based [ Coley et al. , 2017b , Dai et al. , 2019 , Segler and Waller , 2017 ] and template-free [ Chen et al. , 2019 , Zheng et al. , 2019 ] approaches . Template-based methods match a target molecule against a large set of templates , which are molecular subgraph patterns that highlight changes during a chemical reaction . Despite their interpretability , these methods fail to generalize to new reactions . Template-free methods bypass templates by learning a direct mapping from the SMILES [ Weininger , 1988 ] representations of the product to reactants . Despite their greater generalization potential , these methods generate reactant SMILES character by character , increasing generation complexity . 35th Conference on Neural Information Processing Systems ( NeurIPS 2021 ) . Another important consideration in building retrosynthesis models is aligning model design with strategies adopted by expert chemists . These strategies are influenced by fundamental properties of chemical reactions , independent of complexity level : ( i . ) the product atoms are always a subset of the reactant atoms1 , and ( ii . ) the molecular graph topology is largely unaltered from products to reactants . For example , in the standard retrosynthesis dataset , only 6.3 % of the atoms in the product undergo any change in connectivity . This consideration has received more attention in recent semi-template-based methods [ Shi et al. , 2020 , Yan et al. , 2020 ] , that generate reactants from a product in two stages : ( i . ) first identify intermediate molecules called synthons , ( ii . ) and then complete synthons into reactants by sequential generation of atoms or SMILES characters .. Our model GRAPHRETRO also uses a similar workflow . However , we avoid sequential generation for completing synthons by instead selecting subgraphs called leaving groups from a precomputed vocabulary . This vocabulary is constructed during preprocessing by extracting subgraphs that differ between a synthon and the corresponding reactant . The vocabulary has a small size ( 170 for USPTO-50k ) indicating remarkable redundancy , while covering 99.7 % of the test set . Operating at the level of these subgraphs greatly reduces the complexity of reactant generation , with improved empirical performance . This formulation also simplifies our architecture , and makes our predictions more transparent , interpretable and amenable to manual correction . The benchmark dataset for evaluating retrosynthesis models is USPTO-50k [ Schneider et al. , 2016 ] , which consists of 50000 reactions across 10 reaction classes . The dataset contains an unexpected shortcut towards predicting the edit , in that the product atom with atom-mapping 1 is part of the edit in 75 % of the cases , allowing predictions that depend on the position of the atom to overestimate performance . We canonicalize the product SMILES and remap the existing dataset , thereby removing the shortcut . On this remapped dataset , GRAPHRETRO achieves a top-1 accuracy of 53.7 % when the reaction class is not known , outperforming both template-free and semi-template-based methods . 2 Related Work . Retrosynthesis Prediction Existing machine learning methods for retrosynthesis prediction can be divided into template-based , template-free and recent semi-template-based approaches . Template-Based : Templates are either hand-crafted by experts [ Hartenfeller et al. , 2011 , Szymkuć et al. , 2016 ] , or extracted algorithmically from large databases Coley et al . [ 2017a ] , Law et al . [ 2009 ] . Exhaustively applying large template sets is expensive due to the involved subgraph 1ignoring impurities matching procedure . Template-based methods therefore utilize different ways of prioritizing templates , by either learning a conditional distribution over the template set [ Segler and Waller , 2017 ] , ranking templates based on molecular similarities to precedent reactions [ Coley et al. , 2017b ] or directly modelling the joint distribution of templates and reactants using logic variables [ Dai et al. , 2019 ] . Despite their interpretability , these methods fail to generalize outside their rule set . Template-Free : Template-free methods [ Liu et al. , 2017 , Zheng et al. , 2019 , Chen et al. , 2019 ] learn a direct transformation from products to reactants using architectures from neural machine translation and a string based representation of molecules called SMILES [ Weininger , 1988 ] . Linearizing molecules as strings does not utilize the inherently rich chemical structure . In addition , the reactant SMILES are generated from scratch , character by character . Attempts have been made to improve validity by adding a syntax correcter [ Zheng et al. , 2019 ] and a mixture model to improve diversity of suggestions [ Chen et al. , 2019 ] , but the performance remains worse than [ Dai et al. , 2019 ] on the standard retrosynthesis dataset . Sun et al . [ 2021 ] formulate retrosynthesis using energy-based models , with additional parameterizations and loss terms to enforce the duality between forward ( reaction prediction ) and backward ( retrosynthesis ) prediction . Semi-Template-Based : Our work is closely related to recently proposed semi-template-based methods [ Shi et al. , 2020 , Yan et al. , 2020 ] , which first identify synthons and then expand synthons into reactants through sequential generation using either a graph generative model [ Shi et al. , 2020 ] or a Transformer [ Yan et al. , 2020 ] . To reduce the complexity of reactant generation , we instead complete synthons using subgraphs called leaving groups selected from a precomputed vocabulary . This allows us to view synthon completion as a classification problem instead of a generative one . We also utilize the dependency graph between possible edits , and update edit predictions using a message passing network ( MPN ) [ Gilmer et al. , 2017 ] on this graph . Both innovations together yield a 4.8 % and 3.3 % performance improvement respectively over previous semi-template-based methods . Reaction Center Identification The reaction center covers a small number of participating atoms involved in the reaction . Our work is also related to models that predict reaction outcomes by learning to rank atom pairs based on their likelihood to be in the reaction center [ Coley et al. , 2019 , Jin et al. , 2017 ] . The task of identifying the reaction center is related to the step of deriving the synthons in our formulation . Our work departs from [ Coley et al. , 2019 , Jin et al. , 2017 ] as we utilize the property that new bond formations occur rarely ( ~0.1 % ) from products to synthons , allowing us to predict a score only for existing bonds and atoms and reduce prediction complexity from O ( N2 ) to O ( N ) . We also utilize the dependency graph between possible edits , and update edit predictions using a MPN on this graph . Utilizing Substructures Substructures have been utilized in various tasks from sentence generation by fusing phrases to molecule generation and optimization [ Jin et al. , 2018 , 2020 ] . Our work is closely related to [ Jin et al. , 2020 ] which uses precomputed substructures as building blocks for property-conditioned molecule generation . However , instead of precomputing , synthons —analogous building blocks for reactants— are indirectly learnt during training . 3 Model Design . Our approach leverages the property that graph topology is largely unaltered from products to reactants . To achieve this , we first derive suitable building blocks from the product called synthons , and then complete them into valid reactants by adding specific functionalities called leaving groups . These derivations , called edits , are characterized by modifications to bonds or hydrogen counts on atoms . We first train a neural network to predict a score for possible edits ( Section 3.1 ) . The edit with the highest score is then applied to the product to obtain synthons . Since the number of unique leaving groups are small , we model leaving group selection as a classification problem over a precomputed vocabulary ( Section 3.2 ) . To produce candidate reactants , we attach the predicted leaving group to the corresponding synthon through chemically constrained rules . The overall process is outlined in Figure 1 . Before describing the two modules , we introduce relevant preliminaries that set the background for the remainder of the paper . Retrosynthesis Prediction A retrosynthesis pair R is described by a pair of molecular graphs ( Gp , Gr ) , where Gp are the products and Gr the reactants . A molecular graph is described as G = ( V , E ) with atoms V as nodes and bonds E as edges . Prior work has focused on the single product case , while reactants can have multiple connected components , i.e . Gr = { Grc } Cc=1 . Retrosynthesis pairs are atom-mapped so that each product atom has a unique corresponding reactant atom . The retrosynthesis task then , is to infer { Grc } Cc=1 given Gp . Edits Edits consist of ( i . ) atom pairs { ( ai , aj ) } where the bond type changes from products to reactants , and ( ii . ) atoms { ai } where the number of hydrogens attached to the atom change from products to reactants . We denote the set of edits by E. Since retrosynthesis pairs in the training set are atom-mapped , edits can be automatically identified by comparing the atoms and atom pairs in the product to their corresponding reactant counterparts . Synthons and Leaving Groups Applying editsE to the product Gp results in incomplete molecules called synthons . Synthons are analogous to rationales or building blocks , which are expanded into valid reactants by adding specific functionalities called leaving groups that are responsible for its reactivity . We denote synthons by Gs and leaving groups by Gl . We further assume that synthons and leaving groups have the same number of connected components as the reactants , i.e Gs = { Gsc } Cc=1 and Gl = { Glc } Cc=1 . This assumption holds for 99.97 % reactions in the training set . Formally , our model generates reactants by first predicting the set of edits E that transform Gp into Gs , followed by predicting a leaving group Glc to attach to each synthon Gsc . The model is defined as P ( Gr|Gp ) = ∑ E , Gl P ( E|Gp ) P ( Gl|Gp , Gs ) , ( 1 ) where Gs , Gr are deterministic given E , Gl , and Gp .

Summary:  This paper presents GraphRetro, a single-step retrosynthesis model that represents an advance from last years' NeurIPS state of the art model on semi-template-based modeling of the USPTO-50k dataset. GraphRetro uses a graph neural network that predicts edits to transform a target into synthons and then expands the synthons into full molecules by attaching leaving groups (with the synthons and leaving groups learned from the training set). The authors compare the predictions on the USPTO-50k to existing baselines, and show examples of predictions, including wrong ones. Because of the particular construction of the model, the authors can decompose the sources of errors as wrong edit predictions or wrong synthon completions.