Implementation of Retrosynthesis Prediction with Conditional Graph Logic Network
Retrosynthesis is one of the fundamental problems in organic chemistry. The task is to identify reactants that can be used to synthesize a specified product molecule. Recently, computer-aided retrosynthesis is finding renewed interest from both chemistry and computer science communities. Most existing approaches rely on template-based models that define subgraph matching rules, but whether or not a chemical reaction can proceed is not defined by hard decision rules. In this work, we propose a new approach to this task using the Conditional Graph Logic Network, a conditional graphical model built upon graph neural networks that learns when rules from reaction templates should be applied, implicitly considering whether the resulting reaction would be both chemically feasible and strategic. We also propose an efficient hierarchical sampling to alleviate the computation cost. While achieving a significant improvement of 8.1% over current state-of-the-art methods on the benchmark dataset, our model also offers interpretations for the prediction.READ FULL TEXT VIEW PDF
Implementation of Retrosynthesis Prediction with Conditional Graph Logic Network
Retrosynthesis planning is the procedure of identifying a series of reactions that lead to the synthesis of target product. It is first formalized by E. J. Corey  and now becomes one of the fundamental problems in organic chemistry. Such problem of “working backwards from the target” is challenging, due to the size of the search space–the vast numbers of theoretically-possible transformations–and thus requires the skill and creativity from experienced chemists. Recently, various computer algorithms  work in assistance to experienced chemists and save them tremendous time and effort.
The simplest formulation of retrosynthesis is to take the target product as input and predict possible reactants 111We will focus on this “single step” version of retrosynthesis in our paper.. It is essentially the “reverse problem” of reaction prediction. In reaction prediction, the reactants (sometimes reagents as well) are given as the input and the desired outputs are possible products. In this case, atoms of desired products are the subset of reactants atoms, since the side products are often ignored (see Fig 1). Thus models are essentially designed to identify this subset in reactant atoms and reassemble them to be the product. This can be treated as a deductive reasoning process. In sharp contrast, retrosynthesis is to identify the superset of atoms in target products, and thus is an abductive reasoning process and requires “creativity” to be solved, making it a harder problem. Although recent advances in graph neural networks have led to superior performance in reaction prediction [3, 4, 5], such advances do not transfer to retrosynthesis.
Computer-aided retrosynthesis designs have been deployed over the past years since 
. Some of them are completely rule-based systems and do not scale well due to high computation cost and incomplete coverage of the rules, especially when rules are expert-defined and not algorithmically extracted . Despite these limitations, they are very useful for encoding chemical transformations and easy to interpret. Based on this, the retrosim  uses molecule and reaction fingerprint similarities to select the rules to apply for retrosynthesis. Other approaches have used neural classification models for this selection task . On the other hand, recently there have also been attempts to use the sequence-to-sequence model to directly predict SMILES 222https://www.daylight.com/dayhtml/doc/theory/theory.smiles.html. representation of reactants [10, 11] (and for the forward prediction problem, products [12, 13]). Albeit simple and expressive, these approaches ignore the rich chemistry knowledge and thus require huge amount of training. Also such models lack interpretable reasoning behind their predictions.
The current landscape of computer-aided synthesis planning motivated us to pursue an algorithm that shares the interpretability of template-based methods while taking advantage of the scalability and expressiveness of neural networks to learn when such rules apply. In this paper, we propose Conditional Graph Logic Network towards this direction, where chemistry knowledge about reaction templates are treated as logic rules and a conditional graphical model is introduced to tolerate the noise in these rules. In this model, the variables are molecules while the synthetic relationships to be inferred are defined among groups of molecules. Furthermore, to handle the potentially infinite number of possible molecule entities, we exploit the neural graph embedding in this model.
Our contribution can be summarized as follows:
We propose a new graphical model for the challenging retrosynthesis task. Our model brings both the benefit of the capacity from neural embeddings, and the interpretability from tight integration of probabilistic models and chemical rules.
We propose an efficient hierarchical sampling method for approximate learning by exploiting the structure of rules. Such algorithm not only makes the training feasible, but also provides interpretations for predictions.
Experiments on the benchmark datasets show a significant improvement over existing state-of-the-art methods in top-one accuracy.
Other related work:
Recently there have been works using machine learning to enhance the rule systems. Most of them treat the rule selection as multi-class classification or hierarchical classification 
where similar rules are grouped into subcategories. One potential issue is that the model size grows with the number of rules. Our work directly models the conditional joint probability of both rules and the reactants using embeddings, where the model size is invariant to the rules.
A chemical reaction can be seen as a transformation from set of reactant molecules to an outcome molecule . Without loss of generality, we work with single-outcome reactions in this paper, as this is a standard formulation of the retrosynthetic problem and multi-outcome reactions can be split into multiple single-outcome ones. We refer to the set of atoms changed (e.g., bond being added or deleted) during the reaction as reaction centers. Given a reaction, the corresponding retrosynthesis template is represented by a subgraph pattern rewriting rule 333Commonly encoded using SMARTS/SMIRKS patterns
where represents the number of reactant subgraphs in the template, as illustrated in Figure. 1. Generally we can treat the subgraph pattern as the extracted reaction center from , and as the corresponding pattern inside -th reactant, though practically this will include neighboring structures of reaction centers as well.
We first introduce the notations to represent these chemical entities:
Subgraph patterns: we use lower case letters to represent the subgraph patterns.
Molecule: we use capital letters to represent the molecule graphs. By default, we use for an outcome molecule, and for a reactant molecule, or for any molecule in general.
Set: sets are represented by calligraphic letters. We use to denote the full set of possible molecules, to denote all extracted retrosynthetic templates, and to denote all the subgraph patterns that are involved in the known templates. We further use to denote the subgraphs appearing in reaction outcomes, and to denote those appearing in reactants, with .
Task: Given a production or target molecule , the goal of a one-step retrosynthetic analysis is to identify a set of reactant molecules that can be used to synthesize the target . Here is the power set of all molecules .
Let be the predicate that indicates whether subgraph pattern is a subgraph inside molecule . This can be checked via subgraph matching. Then the use of a retrosynthetic template for reasoning about a reaction can be decomposed into two-step logic. First,
where the subgraph pattern from the reaction template is matched against the product , , is a subgraph of the product . Second,
where the set of subgraph patterns from the reaction template are matched against the set of reactants . The logic is that the size of the set of reactant has to match the number of patterns in the reaction template , and there exists a permutation of the elements in the reactant set such that each reactant matches a corresponding subgraph pattern in the template.
Since there will still be uncertainty in whether the reaction is possible from a chemical perspective even when the template matches, we want to capture such uncertainty by allowing each template/or logic reasoning rule to have a different confidence score. More specifically, we will use a template score function given the product , and the reactant score function given the template and the product . Thus the overall probabilistic models for the reaction template and the set of molecules are designed as
|I. Match template:||(4)|
|II. Match reactants:||(5)|
Given the above two step probabilistic reasoning models, the joint probability of a single-step retrosythetic proposal using reaction template and reactant set can be written as
In this energy-based model, whether the graphical model (GM) is directed or undirected is a design choice. We will present our directed GM design and the corresponding partition function in Sec4 shortly. We name our model as Conditional Graph Logic Network (GLN) (Fig. 2), as it is a conditional graphical model defined with logic rules, where the logic variables are graph structures (, molecules, subgraph patterns, ). In this model, we assume that satisfying the templates is a necessary condition for the retrosynthesis, , only if and are nonzero. Such restriction provides sparse structures into the model, and makes this abductive type of reasoning feasible.
Reaction type conditional model: In some situations when performing the retrosynthetic analysis, the human expert may already have a certain type of reaction in mind. In this case, our model can be easily adapted to incorporate this as well:
where is the set of retrosynthesis templates that belong to reaction type .
GLN is related but significantly different from Markov Logic Network (MLN, which also uses graphical model to model uncertainty in logic rules). MLN treats the predicates of logic rules as latent variables, and the inference task is to get the posterior for them. While in GLN, the task is the structured prediction, and the predicates are implemented with subgraph matching. We show more details on this connection in Appendix A.
Although the model we defined so far has some nice properties, the design of the components plays a critical role in capturing the uncertainty in the retrosynthesis. We first describe a decomposable design of in Sec. 4.1, for learning and sampling efficiency consideration; then in Sec. 4.2 we describe the parameterization of the scoring functions in detail.
Depending on how specific the reaction rules are, the template set could be as large as the total number of reactions in extreme case. Thus directly model can lead to difficulties in learning and inference. By revisiting the logic rule defined in Eq. eq:rule1, we can see the subgraph pattern plays a critical role in choosing the template. Since we represent the templates as , it is natural to decompose the energy function in Eq. eq:pt_o as . Meanwhile, recall the template matching rule is also decomposable, so we obtain the resulting template probability model as:
where the partition function is defined as:
Here we abuse the notation a bit to denote the set of subgraph patterns as .
With such decomposition, we can further speed up both the training and inference for , since the number of valid reaction centers per molecule and number of templates per reaction center are much smaller than total number of templates. Specifically, we can sample by first sampling reaction center and then choosing the subgraph patterns for reactants . In the end we obtain the templated represented as .
In the literature there have been several attempts for modeling and learning , , multi-class classification  or multiscale model with human defined template hierarchy . The proposed decomposable design follows the template specification naturally, and thus has nice graph structure parameterization and interpretation as will be covered in the next subsection.
Finally the directed graphical model design of Eq. eq:joint_dist is written as
where sums over all subsets of molecules.
Since the arguments of the energy functions are molecules, which can be represented by graphs, one natural choice is to design the parameterization based on the recent advances in graph neural networks (GNN) [17, 18, 19, 20, 21, 22]. Here we first present a brief review of the general form of GNNs, and then explain how we can utilize them to design the energy functions.
The graph embedding is a function that maps a graph into
-dimensional vector. We denoteas the graph representation of some molecule or subgraph pattern, where is the set of atoms (nodes) and is the set of bonds (edges). We represent each undirected bond as two directional edges. Generally, the embedding of the graph is computed through the node embeddings that are computed in an iterative fashion. Specifically, let initially, where is a vector of node features, like the atomic number, aromaticity, of the corresponding atom. Then the following update operator is applied recursively:
This procedure repeats for steps. While there are many design choices for the so-called message passing operator , we use the structure2vec  due to its simplicity and efficient c++ binding with RDKit. Finally we have the parameterization
is some nonlinear activation function, ,or , and are the learnable parameters. Let the node embedding be the last output of , then the final graph embedding is obtained via averaging over node embeddings: . Note that attention  or other order invariant aggregation can also be used for such aggregation.
With the knowledge of GNN, we introduce the concrete parametrization for each component:
Parameterizing : Given a molecule , can be viewed as a scoring function of possible reaction centers inside . Since the subgraph pattern is also a graph, we parameterize it with inner product, , . Such form can be treated as computing the compatibility between and . Note that due to our design choice, can be written as . Such form allows us to see the contribution of compatibility from each atom in .
Parameterizing : The size of set of subgraph patterns varies for different template . Inspired by the DeepSet , we use average pooling over the embeddings of each subgraph pattern to represent this set. Specifically,
Parameterizing : This energy function also needs to take the set as input. Following the same design as , we have
Note that our GLN framework isn’t limited to the specific parameterization above and is compatible with other parametrizations. For example, one can use condensed graph of reaction  to represent as a single graph. Other chemistry specialized GNNs [3, 26] can also be easily applied here. For the ablation study on these design choices, please refer to Appendix C.1.
Given dataset with reactions, we denote the parameters in as
, respectively. The maximum log-likelihood estimation (MLE) is a natural choice for parameter estimation. Since, and , we have the MLE optimization as
The gradient of w.r.t. can be derived444We adopt the conventions , which is justified by continuity since as . as
where and stand for the expectation w.r.t. current model and , respectively. With the gradient estimator (5
), we can apply the stochastic gradient descent (SGD) algorithm for optimizing (5).
Efficient inference for gradient approximation: Since is a combinatorial space, generally the expensive MCMC algorithm is required for sampling from to approximate (5). However, this can be largely accelerated by scrutinizing the logic property in the proposed model. Recall that the matching between template and reactants is the necessary condition for by design. On the other hand, given , only a few templates with reactants have nonzero and . Then, we can sample and by importance sampling on restricted supported templates instead of MCMC over . Rigorously, given , we denote the matched templates as and the matched reactants based on as , where
Then, the importance sampling leads to an unbiased gradient approximation as illustrated in alg:imp_sampling. To make the algorithm more efficient in practice, we have adopted the following accelerations:
1) Decomposable modeling of as described in Sec. 4.1;
2) Cache the computed and in advance.
In a dataset with reactions, is about 80 and is roughly 10 on average. Therefore, we reduce the actual computational cost to a manageable constant. We further reduce the computation cost of sampling by generating the and uniformly from the support. Although these samples only cover the support of the model, we avoid the calculation of the forward pass of neural networks, achieving better computational complexity. In our experiment, such an approximation already achieves state-of-the-art results. We would expect recent advances in energy based models would further boost the performance, which we leave as future work to investigate.
Remark on : Note that to get all possible sets of reactants that match the reaction template and product , we can efficiently use graph edit tools without limiting the reactants to be known in the dataset. This procedure works as follows: given a template ,
Enumerate all matches between subgraph pattern and target product .
Instantiate a copy of the reactant atoms according to for each match.
Copy over all of the connected atoms and atom properties from .
This process is a routine in most Cheminformatics packages. In our paper we use runReactants from RDKit with the improvement of stereochemistry handling 555https://github.com/connorcoley/rdchiral. to realize this.
Further acceleration via beam search: Given a product , the prediction involves finding the pair that maximizes . One possibility is to first enumerate and then . This is acceptable by exploiting the sparse support property induced by logic rules.
A more efficient way is to use beam search with size . Firstly we find reaction centers with top . Next for each we score the corresponding . In this stage the top pairs (, the templates) that maximize are kept. Finally using these templates, we choose the best that maximizes total score . Fig. 2 provides a visual explanation.
Dataset: We mainly evaluate our method on a benchmark dataset named USPTO-50k, which contains 50k reactions of 10 different types in the US patent literature. We use exactly the same training/validation/test splits as Coley et al. , which contain 80%/10%/10% of the total 50k reactions. Table 3 contains the detailed information about the benchmark. Additionally, we also build a dataset from the entire USPTO 1976-2016 to verify the scalability of our method.
Baselines: Baseline algorithms consist of rule-based ones and neural network-based ones, or both. The expertSys is an expert system based on retrosynthetic reaction rules, where the rule is selected according to the popularity of the corresponding reaction type. The seq2seq  and transformer  are neural sequence-to-sequence-based learning model  implemented with LSTM  or Transformer . These models encode the canonicalized SMILES representation of the target compound as input, and directly output canonical SMILES of reactants. We also include some data-driven template-based models. The retrosim  uses direct calculation of molecular similarities to rank the rules and resulting reactants. The neuralsym  models
as multi-class classification using MLP. All the results except neuralsym are obtained from their original reports, since we have the same experiment setting. Since neuralsym is not open-source, we reimplemented it using their best reported ELU512 model with the same method for parameter tuning.
The evaluation metric we used is the top-exact match accuracy, which is commonly used in the literature. This metric compares whether the predicted set of reactants are exactly the same as ground truth reactants. The comparison is performed between canonical SMILES strings generated by RDKit.
Setup of GLN: We use rdchiral  to extract the retrosynthesis templates from the training set. After removing duplicates, we obtained 11,647 unique template rules in total for USPTO-50k. These rules represent 93.3% coverage of the test set. That is to say, for each test instance we try to apply these rules and see if any of the rules gives exact match. Thus this is the theoretical upper bound of the rule-based approach using this particular degree of specificity, which is high enough for now. For more information about the statistics of these rules, please refer to Table 3.
We train our model for up to 150k updates with batch size of 64. It takes about 12 hours to train with a single GTX 1080Ti GPU. We tune embedding sizes in , GNN layers and GNN aggregation in using validation set. Our code is released at https://github.com/Hanjun-Dai/GLN. More details are included in Appendix B.
|# unique centers||9,078|
|Avg. # centers per mol||29.31|
|Avg. # rules per mol||83.85|
|Avg. # reactants||1.71|
We present the top- exact match accuracy in Table 3, where ranges from . We evaluate both the reaction class unknown and class conditional settings. Using the reaction class as prior knowledge represents some situations where the chemists already have an idea of how they would like to synthesize the product.
In all settings, our proposed GLN outperforms the baseline algorithms. And particularly for top-1 accuracy, our model performs significantly better than the second best method, with 8.1% higher accuracy with unknown reaction class, and 8.9% higher with reaction class given. This demonstrates the advantage of our method in this difficult setting and potential applicability in reality.
Moreover, our performance in the reaction class unknown setting even outperforms expertSys and seq2seq in the reaction conditional setting. Since the transformer paper didn’t report top- performance for , we leave it as blank. Meanwhile, Karpov et al.  also reports the result when training using training+validation set and tuning on the test set. With this extra priviledge, the top-1 accuracy of transformer is 42.7% which is still worse than our performance. This shows the benefit of our logic powered deep neural network model comparing to purely neural models, especially when the amount of data is limited.
Since the theoretical upper bound of this rule-based implementation is 93.3%, the top-50 accuracy for our method in each setting is quite close to this limit. This shows the probabilistic model we built matches the actual retrosynthesis target well.
Visualizing the predicted synthesis: In Fig 4 and 4, we visualize the ground truth reaction and the top 3 predicted reactions (see Appendix C.6 for high resolution figures). For each reaction, we also highlight the corresponding reaction cores (, the set of atoms get changed). This is done by matching the subgraphs from predicted retrosynthesis template with the target compound and generated reactants, respectively. Fig 4 shows that our correct prediction also gets almost the same reaction cores predicted as the ground truth. In this particular case, the explanation of our prediction aligns with the existing reaction knowledge.
Fig 4 shows a failure mode where none of the top-3 prediction matches. In this case we calculated the similarity between predicted reactants and ground truth ones using Dice similarity from RDKit. We find these are still similar in the molecule fingerprint level, which suggests that these predictions could be the potentially valid but unknown ones in the literature.
Visualizing the reaction center prediction: Here we visualize the prediction of probabilistic modeling of reaction center. This is done by calculating the inner product of each atom embedding in target molecule with the subgraph pattern embedding. Fig 5 shows the visualization of scores on the atoms that are part of the reaction center. The top-1 prediction assigns positive scores to these atoms (red ones), while the bottom-1 prediction (, prediction with least probability) assigns large negative scores (blue ones). Note that although the reaction center in molecule and the corresponding subgraph pattern have the same structure, the matching scores differ a lot. This suggests that the model has learned to predict the activity of substructures inside molecule graphs.
To see how this method scales up with the dataset size, we create a large dataset from the entire set of reactions from USPTO 1976-2016. There are 1,808,937 raw reactions in total. For the reactions with multiple products, we duplicate them into multiple ones with one product each. After removing the duplications and reactions with wrong atom mappings, we obtain roughly 1M unique reactions, which are further divided into train/valid/test sets with size 800k/100k/100k.
We train on single GPU for 3 days and report with the model having best validation accuracy. The results are presented in Table 4. We compare with the best two baselines from previous sections. Despite the noisiness of the full USPTO set relative to the clean USPTO-50k, our method still outperforms the two best baselines in top- accuracies.
Evaluation: Retrosynthesis usually does not have a single right answer. Evaluation in this work is to reproduce what is reported for single-step retrosynthesis. This is a good, but imperfect benchmark, since there are potentially many reasonable ways to synthesize a single product.
Limitations: We share the limitations of all template-based methods. In our method, the template designs, more specifically, their specificities, remain as a design art and are hard to decide beforehand. Also, the scalability is still an issue since we rely on subgraph isomorphism during preprocessing.
Future work: The subgraph isomorphism part can potentially be replaced with predictive model, while during inference the fast inner product search  can be used to reduce computation cost. Also actively building templates or even inducing new ones could enhance the capacity and robustness.
We would like to thank anonymous reviewers for providing constructive feedbacks. This project was supported in part by NSF grants CDS&E-1900017 D3SC, CCF-1836936 FMitF, IIS-1841351, CAREER IIS-1350983 to L.S.
A graph-convolutional neural network model for the prediction of chemical reactivity.10(2):370–377, b. doi: 10.1039/C8SC04228D.
Enhancing retrosynthetic reaction prediction with deep learning using multiscale reaction classification.59(2):673–688.
Similar to the proposed model, the Markov logic network (MLN)  is an alternative to introduce uncertainty into logic rules. However, there is significant difference in the way the retrosynthetic templates are treated. The proposed model considers the templates as separate variables that will be inferred for the target molecules together with the reactions. The explicit probabilistic modeling of templates makes it more straightforward to interpret the prediction. The MLN instead sets the logic rules (the templates) as features in the energy-based model, , , upon which the template inference is not well-defined. Moreover, our model will also lead to efficient sampling and inference, avoiding the MCMC on combinatorial space in the MLN, which accelerates the model learning.
So in summary:
[leftmargin=*, noitemsep, topsep=0pt]
GLN is a directed graphical model while MLN is undirected.
MLN treats the predicates of logic rules as latent variables, and the inference task is to get the posterior of them. While in GLN, the task is the structured prediction, and the predicates are implemented with subgraph matching.
Due to the above two, GLN can be implemented with efficient hierarchical sampling. However for MLN, generally the expensive MCMC in combinatorial space is needed for both training and inference.
Figure 6 shows the distribution of reactions over 10 types. We can see this dataset is highly unbalanced.
The preprocessing of and is relatively expensive, since theoretically the subgraph isomorphism check is NP-hard. However, since the processing is embarrassingly parallelizable, it took about 1 hour on a cluster with 48 CPU cores for 50k reactions.
We implement the entire model using pytorch. The optimizer we used is Adam with a fixed learning rate of
and a gradient clip of.
In all the experiments, the graph embedding module is implemented using s2v . The best embedding size we used has size of 256 for representing each molecule or subgraph structure, and is used as nonlinear activation function.
For the aggregation used in , in DeepSet module used for representation of for a specific , or in DeepSet module for molecule set , we tried -pooling, and found the performance is about the same. We use -pooling since it offers the scoring of each node embedding within the graphs. The visualization in Fig 5 relies on this trick.
Our GLN provides a general graphical model to retrosynthesis problem, which is compatible with many reasonable choices of the representation of graphs. In addition to structure2vec with 3 layers (s2v-3) we used in the paper, we provide more ablation studies using different widely used GNNs and different number of “message-passing” layers.
The rationale behind the choices are: 1) the GNNs should be able to take both atom and bond features into consideration; 2) according to Xu et al. , the family of message-passing GNNs should have similar representation power as WL graph isomorphism check at best. We adopt the s2v in our paper since it satisfies these requirements. Meanwhile, it comes with efficient c++ binding of RDKit.
We use 2 layers of GNN by default, or use - after the name in Table 5 to denote -layer design. We can see that most variations of GNNs can achieve similar performances with enough number of message-passing like propagations. Based on this, for the experiment on the full USPTO dataset we simply use ECFP-2 provided by RDKit, as it is WL-isomorphism check based method with enough expressiveness  but faster to run.
Besides the choice of GNN, we also compare the choices of , and mentioned in Section 4.2. Basically all these functions are comparing the compatibility of two vectors . In the paper, we simply used inner-product . Here we also studied and bilinear . For top-1, the inner-prod, MLP and bilinear gets 52.6, 52.7 and 53.5, respectively. So our GLN could be further improved with better design choices.
We study the performance per each reaction category. Following the setting of baseline methods, we report the top-10 accuracy. As is shown in Table 8, the distribution of reaction types is highly unbalanced. From Fig 8 we can see our performances are better than retrosim in most classes, including the most common cases like class 1 and 2, or rare cases like class 4 or 8. This shows that our performance is not obtained by overfitting to one particular category of reactions. Such property is also important, as the retrosynthesis could involve rare reactions that haven’t been well studied in the literature.
For per category performance for reaction type conditional tasks, as well the effect of beam-size, please refer to Appendix C.
In Figure 9 we show the per-class performance when the reaction type is given as prior. As is shown Figure 6, the distribution of reaction types is not uniform, where some reactions only get less than 5% of the total data. In this case, it is important to have a flexible model that can take the reaction type into account. Training one model per each reaction class is not a good idea in this case due to the imbalance of distribution.
From Figure 9 we can see our performances are comparable to retrosim in all classes, while being much better than expertSys and seq2seq. Even in rare classes like class 9 or 10, we can still get best or second best performance. This shows the effectiveness and the flexibility of our GLN.
Beam size In Section. 6.1 we reported the top- accuracy with beam size of 50, since is at most 50. Here we study the performance of GLN using different beam sizes. Figure 12 shows the top- accuracy for different and different beam sizes. Overall the performance gets consistently better with larger beam sizes, for all top- predictions. We can also see that the top-1 accuracy improved about 10% from beam size 1 (, greedy inference) to beam size 3. Note that the curve of beam size flattened after top- predictions, since generally it didn’t produce more predictions than .
We also report the speed for inference in Figure 12. Such information during inference is averaged over 5,007 test predictions. The majority of the time is spent during applying the template via the call to RDKit, thus the time required grows up linearly with the beam size, as the number of RDKit calls grows linearly with the beam size.
Accuracy of In Figure 12 we show the accuracy of , which decomposes into the reaction center identification accuracy and the template selection accuracy related to that reaction center. Here the beam size is fixed to 50. Predicting the reaction center is relatively easy and GLN achieves 99% top-20 accuracy. These results indicate that the current bottleneck in performance is in the template selection part, which is reasonably good now but can definitely be further improved by capturing more reaction features.
The logic function comes with our GLN can be potentially applied to any rule based systems. For example, when combined with neuralsym  (we denote the modified one as -neuralsym), it further reduces the space of template selection. -neuralsym gets top-1 accuracy of 46.9% and 57.7% in reaction type unconditional and conditional cases, respectively. This is about 2% improvement over its vanilla performance.