Data-Efficient Graph Grammar Learning for Molecular Generation
Authors: Minghao Guo
Veronika Thost
Beichen Li
Payel Das
Jie Chen
Wojciech Matusik
Venue: ICLR 2022 Oral (2022)
Keywords: molecular generation
graph grammar
data efficient generative model

Abstract: The problem of molecular generation has received significant attention recently. Existing methods are typically based on deep neural networks and require training on large datasets with tens of thousands of samples. In practice, however, the size of class-specific chemical datasets is usually limited (e.g., dozens of samples) due to labor-intensive experimentation and data collection. Another major challenge is to generate only physically synthesizable molecules. This is a non-trivial task for neural network-based generative models since the relevant chemical knowledge can only be extracted and generalized from the limited training data. In this work, we propose a data-efficient generative model that can be learned from datasets with orders of magnitude smaller sizes than common benchmarks. At the heart of this method is a learnable graph grammar that generates molecules from a sequence of production rules. Without any human assistance, these production rules are automatically constructed from training data. Furthermore, additional chemical knowledge can be incorporated into the model by further grammar optimization. Our learned graph grammar yields state-of-the-art results on generating high-quality molecules for three monomer datasets that contain only ${\sim}20$ samples each. Our approach also achieves remarkable performance in a challenging polymer generation task with $only$ $117$ training samples and is competitive against existing methods using $81$k data points.


Published as a conference paper at ICLR 2022
GRAPH GRAMMAR LEARNING FOR MOLECULAR GENERATION
Minghao Guo', Veronika Thost?. Beichen Payel Das Jie Jie Chen?*, Wojciech Matusik
'MIT CSAIL, MIT-IBM Watson AT Lab, 'BBM Research
ABSTRACT
The problem of molecular generation has received significant attention recently Existing methods are typically based on deep neural networks and require train- ing on large datasets with tens of thousands of samples. practice, however, the size of class-specific chemical datasets is usually limited (e.g., dozens of sam- ples) due labor-intensive experimentation and data collection. This presents considerable challenge for the deep learning generative models to comprehen- sively describe the molecular design space. Another major challenge is to gen- erate only physically synthesizable molecules. This is non-trivial task for neu- ral network-based generative models since the relevant chemical knowledge can only be extracted and generalized from the limited training data. In this work, we propose a data-efficient generative model that can be learned from datasets with orders of magnitude smaller sizes than common benchmarks. At the heart of this method is a learnable graph grammar that generates molecules from a sequence of production rules. Without any human assistance, these production rules are automatically constructed from training data. Furthermore, additional chemical knowledge can be incorporated in the model by further grammar op- timization. Our learned graph grammar yields state-of-the-an results on gener- ating high-quality molecules for three monomer datasets that contain only ~22 samples each. Our approach also achieves remarkable performance in chal- lenging polymer generation task with only 117 training samples and is com- petitive against existing methods using 81k data points. Code is available attps:://ithiei com/ wwtp:/co///c//ccct// /aaaa///aa//aaaaaaaaaaaaaaaaaaaa efficient,
efficient_granmar grammar
INTRODUCTION
The rise of computational approaches has started have significant impact on the discovery ma- terials and drugs. Recent advances in machine learning, especially deep learning (DL), have driven rapid development on generating novel molecular structures (Maziarka et al. 2020, Xu et al. 2019) Hoffman et al. 2022). Various forms of generative models including generative adversarial networks
(De Cao & Kipf 2018; Maziarka et al. 2020), variational autoencoders (VAEs) (Jin et all 2018
2020 Liu et al. [018]] Sattarov et al. [209)), and reinforcement learning (You et al. 2018) have been exploited to represent the complicated molecular design space and generate new molecules. They typically formulate molecular generation as a problem of distribution learning, where the generative model first learns to reproduce the distribution of training set before generating new molecular structures. Generative models have also managed to integrate certain chemical constraints (e.g., valency restrictions) (Jin et al. 2018 Liu et al. 2018) and shown promising results on the com- mon benchmarks (Irwin et al.) 2012; Ramakrishnan al., 2014). However, DL-based generative models face serious limitation: they require large amounts of training data to achieve reasonable performance.
In practice, molecule data is not always abundant (Stanley et al.) 2021 Altae- et al., 2017; Subramanian et al. 2016)): for instance, the focus may on a specific type of molecules fulfilling certain ingredient requirements. Particularly in the context of polymers, large amounts of training data are not available, and therefore DL models use manually constructed or generated data (St. John eet al. 2019: Jim al.) 2020 Ma & Luo| 2020). Real data sets, as used in one of the ffte-of-the--n art papers on polyurethane property prediction, have as little as 20 samples (Menon et al.) 2019). In such scenarios, designing pure DL.-based model is challenging.

---

Published as a conference paper at ICLR 2022
Training Data
Graph Grammar
Generated Samples
Bottom-up Search
Grammar Production
potc- 0
pco
putc
2000
pcc-
Domain-specific Metries
Update Edge Weight Function Fo
Evaluation
Figure I: Overview. Given molecules and domain-specifh metrics to be optimized, we construct a graph grammar, which can serve generative model. The graph grammar construction process automatically learns the grammar rules by optimizing the metrics.
Recent renewed interest in formal grammars (Kaino 2019 Krenn et al. 2019 Nigam et al. 2021
Guo et al. 202T) provides an alternative to pure DL methods. In formal language theory, grammar is a set of production rules describing how to generate valid strings according to the language's 's syn- tax. A chemical grammar may thus be considered as interpretable and compact design model that simultaneously serves as a molecular representation and a generative model; even domain-specific constraints can be explicitly incorporated into the rules. Recent examples range from string- (Krenn et al., 2019) [Nigam et al. (02T) to hypergraph-base generative models do not rely on large training datasets and easily extrapolate to generate molecules outside the distribution of training samples. Yet, they have two major drawbacks. First, current approaches require that chemical grammars are manually designed by human experts (Krenn et al. 2019 Nigam et al. 2021 Dai et al. 2018). This a tedious process that heavily relies on expertise in chemistry. Moreover, the existing grammars also very fine-gu tine-graned (i.e., rules mostly attaching atoms) in order to cover the syntax of gen- eral molecules instead bias of given data (e.g., certain molecular substructures) into such grammars. The second drawback is that it remains challenging to integrate chemistry knowledge beyond simple constraints (e.g.. va- lency restrictions) into the grammar. Current grammar construction approaches fail capture more abstract or complex aspects such as the diversity or synthesizabilty of the generated molecules, which constrains their practicality. Solutions such as Kajino (2019) resort costly optimization on the level of molecules (or their latent representation) after the grammar is built or learned. For more detailed delimitation of related work, see Sec. [2]
(Kajino 2019) and polymer-specific
grammars (Guo et al.] 2021). Grammar-bane
specific dataset. Hence, is not straightforward how to incorporate the
In this paper, we propose generative model combining complex graph grammar construction with relatively simple and effective learning technique. particular, our grammar incorporates substruc- tures of varying sizes (i.e., above atom level) and the construction process directly optimizes various chemical metrics (c.g., distribution statistics and synthesizability) while satisfying specific chemical constraints (e.g., valency restrictions). Moreover, we have the benefits of symbolic knowledge repre- sentation: explainability and data efficiency. Our evaluation focuses on polymers, particularly their monomer building blocks. Thus, curate new, realistic polymer datasets gathered from literature that represent specific classes of monomers. Note that our model works for arbitrary molecules.
Framework. Figure 1 outlines our approach. Given molecules and domain-specifer metrics to be optimized, we iteratively construct and evaluate a graph grammar as our generative model. We consider the construction as a minimum spanning forest problem and combine it with optimization of the metrics, via a learnable function Fa determining which rules to construct.
Results. Our model successfully deals with extreme settings from DL perspective learning meaningful production rules based on only ~~0 samples (e.g.. of a specific class); this is of signif- icant importance
practical setting (Stanley et al.) 2021]] Altae-TTaaa et al. (017) but has been ignored so far. In particular, our model is able to generate members of a specific monomer class with a decent success rate. No previous state-of-the-an system achieves similar performance in our experiments. Generally, our approach works on training data that is orders of magnitude smaller than the amount needed by DL-based systems to produce meaningful results. Given ~00 samples, we achieve performance comparable to state-of-the-art systems trained on 81k samples, across wide range common and new evaluation metrics. Besides, our grammar optimization method can adjust any user-defined domain-specine metrics. The learned grammars can capture domain- specific knowledge explicitly, e.g., the characteristic functional groups a given class of polymers can be extracted from the production rules.
2

---

Published as a conference paper at ICLR 2022
2 RELATED WORK
Generative Models for Molecules. Existing models can be categorized based on their molecule representation. It is common to SMILES strings (Weininger 1988). Yang et al. (2017), Olive- crona et al. (2017), [Chetthmarakkshan et al.] (202)) |Schiff et al. (2021) y and (elmez--Bombree sequential manner. For in- stance, Gömez-Bombarelli et al. (2018) propose a VAE based on sequence-to-ssqueeece encoders andDai
al. (2018) use recurrent neural networks generate the strings
and decoders. Guuimaress et al. (2017), Sanchez-Lengellnng et al. (2017), and Dai all (2018) addi- tionally apply optimization objectives to enforce similarity or semantic correctness to generate valid SMILES. Alternatively, molecules can treated as graphs. [Simonovsky & Komodakis (2018), Ma et al. (2018), and De Cao & Kipi (2018) generate the graphs in single step, directly outputring adjacency matrices and node labels. GraphNVP (Madhawa et al., 2019) uses two steps to generate the node labels based the adjacency matrix; it exploits model to encode molecules and uses the same model whose layers are reversed to generate new molecules. You et al. 20; Li et al.
(2018); [Samanta al. (2020); Liu et al.) (2018); Liao et al. (2019); Jin et al. (2018 (020) build molecule graphs iteratively based on either atom nodes or substructures. For example, JA-VAE (Jin al. 2018 first generates tree and then expands some of its nodes by attaching substructures based on a vocabulary mined from given molecules; Similarly, Vie (Jin et al. (020)) also uses vocabulary, but improves upon the combinatorial attachment process by directly applying a multi- resolution representation, allowing for generating much larger and diverse molecules. All these methods depend on DL and require large training datasets. Moreover, the resulting models are usu- ally not interpretable. Our approach alleviates this obstacle and can deal with practically common setting of only dozens of available data points.
Generative Models using Graph Grammars. Our approach belongs to the class of models generat- ing new graphs based on the production rules of graph grammar. These models are non- non-parametric, interpretable, and can incorporate meaningful graph properties into the rules. One option is to use grammars that are manually designed by human experts (Dai et al. 2018 Nigam et al.. 202I). )). For instance, STONED (Nigam et al. (02T)) generates new molecules based on string-baset represen- tation of given molecules by replacing tokens (representing atoms) in accordance with the SELFIES grammar (Kremn et al. 2019). While the simplicity of this approach is attractive, the generated molecules are not necessary reasonable from a chemical perspective (e.g.. they might not be synthe- sizable). This problem can be overcome by mining the grammar from real data. Recently, several automatic techniques that explicitly construct a graph grammar have been proposed in the context of large-scale graphs to facilitate understanding and analysis (Sikdar et al., 2019 Aguinaga et al., 2018 Hibshman et al.) 2019). These works are domain-indeeenndnt and do not allow specialization of the constructed grammar to reflect domain Speecfc knowledge. Closest to our method is MHG 2019)). framework that constructs molecular hyperedge-eeplacement grammar based on Aguinaga et al. (2018). From the given data, MHG learns a fine-grained grammar where the rules iteratively attach single atoms and therefore incorporates hard chemical constraints (e.g.. valency restrictions). MHG then applies VAE conditioned on the grammar to the molecules' tree decom- positions in order to also learn soft constraints (e.g., stability). Finally, it uses Bayesian optimization to guide molecule generation. The fine-gras mne-grained rules in MHG allows for rich diversity. However, our experiments show that these rules make it hard to capture distribution-specifff properties, e.g., characteristic substructures of a specific molecular class. Such a drawback limits the practical use of MHG. In contrast, our approach focuses on subgraphs instead of individual atoms only. It directly incorporates domain-specific knowledge into grammar construction and therefore avoids compli- cated prosessiocssigg to achieve high generation performance.
3 PRELIMINARIES
Molecular Hypergraph. Molecules can naturally be represented as graphs by taking the atoms as nodes and the bonds as edges. We particularly use a hypergraph representation. Given a molecule M, the hypergraph HM = (V, EH) consists of a set of nodes V and a set of hyperedges ER; a hyperedge can join more than two nodes. Given regular molecular graph, we construct hyper- graph by including all nodes and adding hyperedges as follows: a hyperedge is added for each bond that joins only two nodes, and for each individual ring (including aromatic ones) that joins all nodes (more than 2) in the ring. Consider Figure ((a) where we add two hyperedges of the latter kind, one for each ring.
3

---

Published as a conference paper at ICLR 2022
N=C=O
O=C=N
pi:
pat
e3
pe:
Htyperedge
Single
Osyyge
Nitagen Nade
Initizl Node
Carbon Alom
(a) Hypergraph representation of naphthalene disoocyanate
(b) Production miles of a learned gruph grammar
2xps
2xp2
Generation process of naphthalene dissocyanate using the graph grammnr in (b)
Figure 2:
Examples molecular hypergraph, one of our possible graph grammars for it, and an application of the grammar for generating new molecules.
Formal Grammar. A grammar G = (V, P.)) has a finite set N of non-terminal symbols, an initial symbol X. and finite set of terminal symbols E. describes how to build strings from language's alphabet using set of production rules p {prli 1...., k) of form LHS - RHS. where LHS is short for left-hand side and RHS right-hand side. Based on such a grammar, string (of terminal symbols) is generated starting at X. by iteratively selecting rules whose left- hand side matches non-terminal symbol inside the current string and replacing that with the rule's right-hand side, until the string does not contain any non-terminals.
Minimum Spanning Forest (MSF). A minimum spanning tree (MST) is a subset of the edges of connected, edge- weighted undirected graph that connects all the vertices, without any cycles and with the minimum possible total edge weight. Minimum spanning forest the union of MSTs for set of unconnected edge-weighter undirected graphs.
4 GRAPH GRAMMAR LEARNING WITH DOMAIN-SPECTIE OPTIMIZATION
Graph Grammar. We focus on formal grammar molecule graphs instead of strings, gruph grammar. As shown Figure both left and right-hand side of each production rule are graphs. These graphs contain non-terminal nodes (shadowed squares) and terminal nodes (colored circles), representing atoms. The white nodes are anchor nodes, which do not change from the left to the right-hand side. Molecule graph generation based on graph grammar is analogous the with string-based grammars described in Sec. (see also Figure ()). To determine a production rule p: is applicable each step, we use subgraph matching (Gentner) 1983) to test whether the current graph contains a subgraph that is isomorphic to the rule's left-hand side. Since the subgraphs are usually small scale, the matching process is efficient in practice.
Overall Pipeline. As shown in Figure T the input to our algorithm consists of a set of molecu- lar structures and set of evaluation metries (e.g., diversity and synthesizablity). The goal to learn graph grammar which can be used for molecule generation. To this end, we first consider hypergraph. The grammar construction a bottom-up procedure, which iter-
each molecule atively creates production rules by contracting hyperedges (shown in Figure 3 The hyperedges to contract are determined by parameterized function Fe, implemented as a neural network. We simultaneously perform multiple randomized searches obtain multiple grammars which are eval- uated with respect to the input metrics. This approach learns how to create a grammar that samples molecules maximizing the input metrics. Hence, domain-speciff knowledge can be incorporated to the grammar- baasedd---aeeddd generative model. The grammar construction and learning process are described in detail in the following Sec. 4.1 and 4.2 The final molecule generation is detailed in Appendix
4

---

Published as a conference paper at ICLR 2022
Potential Function
Potential Function
Potential Function
Folf(e))
Fo(f(c))
Sample
X
D1
P2
D3
P4
p
D1:
Re
p2:
p
x
Constructed Graph Grammar
Overview of bottom-up grammar construction. We optimize the iterative, bottom-up grammar construction by learning how to create grammar that samples molecules fitting input metrics. Specifically we learn which edges to select for contraction in each iteration step using a neural network Fø. We perform this construction on all input molecules simultaneously.
Figure 3:
4.1 BOTTOM-UP GRAMMAR CONSTRUCTION
We describe at a high-level our grammar construction approach (shown in Figure 3). A bottom-up search builds up production rules from the finest-grained level that comprises individual hyperedges in the molecular hypergraph. We construct a grammar by iteratively sampling a set of hyperedges and contracting them into an individual node. The sampling algorithm described more detail in Sec. 4.2 For each contraction step. production rule is constructed and added to the grammar and we obtain a new hypergraph with fewer nodes and edges. We simultancously perform the hyperedge selection and rule construction for all input molecules until all hyperedges are contracted. Without the loss of generality, we describe the construction process for a single molecule.
At iteration {e: E Egli = 1,.., m). Let V = (ott) E Vli = 1,..., n be the nodes joined by these hyperedges. We then extract all connected components with respect these hyperedges. Next, convert each connected component (()) nodes are those nodes from that are connected to nodes from aub,4 in the original graph H but that do not occur in ( sub.e themselves. We also provide notation for the relevant edges:
consider the current graph HM,t En) and sample m hyperedges E;
sub.t = (v Fi into a production rule. The anchor (f)
v(O) ane.t
(v|(s, v) E Eu, v(( sub,
V(O) sub.eh:
E ( Paner {(s, w)|s
v-0 ann,et
v(0)
sab,
Then we construct the production rule LHS + RHS with non-terminal node R on the left:
LHS = H(V,, E,), V, (R*)U v(i
ane,t E, = ((RR,( vu)u iue Vll
(1)
(ii RHS = HVRR, ER), VR sud,r U v(i)
ane,t ER = (i) U E
When all connected components have been converted into production rules, we update the original hypergraph to HM.+1 by replacing each connected component with the non-terminal node R The above process continues until the hypergraph only consists of one single non-terminal node. For this finally constructed rule, use the initial node X instead of R* on the left-hand side.
Our proposal has several properties: (1) As a generative model, the grammar can reproduce all input molecules. (2) Since the production rules are constructed from subgraphs of real molecules, valency conditions are naturally obeyed and all generated molecules are thus valid. (3) The generation not only interpolates the training data but also extrapolates generate molecular structures outside the distribution of previously seen examples. (4) The constructed grammar roughly follows Chomsky normal form [Comsky 1959) and hence is easy to parse and serve for explanation.
5

---

Published as a conference paper at ICLR 2022
4.2 OPTIMIZING GRAMMAR CONSTRUCTION
So far, we have left open a critical question: how to optimize the grammar for the input metrics? Since the grammar construction is completely determined by the sequence of hyperedge sets lected, we can convert the optimization of the grammar into the optimization of the hyperedge se- lection sequence; in particular, note that there are no hyperparameters in addition. Thus, the variable of the optimization problem is the selection sequence with objective to maximize the input metrics.
We formulate the search for a sequence of hyperedge sets an MSF problem. The bottom-up grammar construction process can be considered as search for spanning forest for all input graphs. Note that instead of the structure of MSF itself, we focus on the order of hyperedges added to the MSF. The order of hyperedges is determined by an edge-weight function F EH - IK mapping each hyperedge in every considered molecule hypergraphs to a scalar value. Optimizing the hyperedge selection is equivalent to optimizing the edge weight function. Note that this kind of function is similar to the concept of potential function in the field of graphical models (Barber (012) Our goal here is to learn a potential function F-)) that maximizes the given evaluation metries.
We define our edge weight function as a parameterized function of hyperedge features as F(e; Fo(f(e)), where f.) is feature extractor function for individual hyperedges e, and 0 are the parameters of FF-) to be optimized. There is no specific restriction on the choice of f()) so we use pretrained neural network in our experiments. Our optimization objective is max, E, AgMi, where M, is the value of the i-th input grammar metric, and X is the weight of the i-th metric. Since most grammar metrics can only be obtained by evaluating a set of molecules generated by the grammar, it is impossible to get the gradient of M, with respect to the parameters 0 via the chain rule. We address this problem by formulating the process of MSF construction as Monte Carlo (MC) sampling. To obtain the gradient of non-differentiable evaluation metrics, we draw inspiration from basseb learning (Donti et al.) 2017] Chen al.) 2019) and reinforcement learning, by using REINFORCE (Williams, 1992) to optimize the potential function. Specifically, we define a random variable X : Ω - I on each hyperedge, where X = 1 (X = 0) means the hyperedge is (not) selected. In each iteration of grammar construction, X follows Bernoulli distribution, based on the probability ((e; 0) to sample e:
(2) where (-) is the sigmoid function. For o(e; 0), the larger the weight of edge e, the lower the proba- bility of e being sampled in the current iteration, which matches the target of MSF. We sample X for each hyperedge and construct grammar production rules iteratively
X ~ Bernoulli 0)),
described in Sec. [. Sup- pose that the constructed grammar is G. Since G is determined by the sampled order of hyperedges,
we have p()) p(C(X)) p(X) II, o(e 00)x (1- ((e(") 1 where C(-) is grammar construction process, ef" is the j j-th hyperedge selected in the t-th iteration, and X the concatenation of selected hyperedges along all iterations. The optimization objective is:
max Ex
Σ (x)
(3)
We estimate the expectation with MC sampling and REINFORCE, approximating the gradient with respect as:
VOEX Σ
Xx)
Σ (.Px(()MMM
Ex Aooolo
(4)
N
V V (ovooo(((()))MM(
We then apply gradient ascent in order to maximize the objective. Note that M,(X) is normalized to zero mean for each sampling batch to reduce variance in training. The grammar construction, evaluation, and optimization process is repeated until 0 converges the iteration number exceeds a preset limit. Our approach reduces the complexity of the optimization variable space from being combinatorial (all possible orderings of selected hyperedges) to the dimension of the parameter 6. Such complexity is also much lower than other deep neural network generative models that are directly trained the molecule dataset.

---

Published as a conference paper at ICLR 2022
5 EVALUATION
Our evaluation investigates the following five questions:
How do SOTA models for molecule generation perform realistic small monomer datasets?
Is our approach effective in generating specific types of monomers that are synthesizable?
How do the models perform on larger monomer datasets?
Can our approach learn to weigh and optimize different metries according to user needs?
Can our grammar's explainability support applications, such functional group extraction?
5.1 EXPERIMENT SETUP
Data. We use three small datasets, each representing specific class of monomers, which we curate manually from the literature: Acrylates, Chain Extenders, and Isocyanates, containing only 32, 11, and 11 samples, respectively (printed in Appendix G For comparison and for pretraining baselines, we also use large collection of 81k monomers from St. John et al. (2019) and al. (2020) !
Evaluation Metrics. We consider commonly used metrics in the literature (Polykovskiy et al.) 2020) and new ones for assessing both individual sample quality and distribution similarity:
Salddty/Uniquenes/Noelly Percentage of chemically valid/unique/novel molecules. Diversity: Average pairwise molecular distance among generated molecules, where the molecular distance is defined as the Tanimoto distance over Morgan fingerprints (Rogers & Hahn 2010).
Chamfer Distance (Fan et al., 2017): Distance between two sets of molecules, wherein the usual pairwise Euclidean distance is replaced by the Tanimoto distance.
Retro" Score (RS): Success rate of the Retro" model (Chen et al., 2020) which was trained to find retrosynthesis path build molecule from list of commercially available one
Membership: Percentage of molecules belonging to the training data's 's monomer class.
We propose the last three as metrics. We define the Chamfer Distance for molecules account for "external" diversity between generated data and training data as quantitative indicator of the generative model's extrapolation ability. Ideally, generated molecules should not be too close to any training molecule. Hence, a larger distance is more desired. Note that the commonly used metries of existing distances only focus on similarity to the training data. Furthermore, we include the Retro" Score as a metric estimating sample synthesizability since the commonly used SA Score (Ertl & Schuffenhauer 2009) does not adequately assess more recent molecules (Polykovskiy al.) 2020). For our small datasets, we check class membership well. Since polymer's 's class is usually determined by its monomer types, is essential that a generative model can generate class members.
Baselines. We compare to various approaches: GraphNVP, JT-VAE, HierVAF, MHG, and STONED; for descriptions see See. 2 We call our method DEG, short for Data-Efficien Graph Grammar. Appendix B provides the implementation details.
5.2 RESULTS ON SMALL, CLASS-SPECIHIC POLYMER DATA
Results. Table T shows the results on the Isocyanate data; due to lack of space the other two tables in Appendix C.1 Observe that GraphNVP has rather poor performance. The VAEs and existing grammar-bass based systems perform reasonably well on some metrics, but have low scores on the RS and Membership metries. In contrast, our method significantly outperforms the other methods in terms of Membership and Retro" Score on all three datasets. It also achieves the best or comparable performance on all other metrics.
Discussion. Our evaluation shows that learning on monomer datasets, especially when the dataset size small, is much more challenging than larger datasets as used in the related work (Irwin al.) 2012 Ramakrishnan et al.) 2014). GraphNVP shows poor performance since it uses molecular graph adjacency matrix as model input, which is extremely sparse for our relatively large monomer structures. The vocabulary-based JT-VAE and HierVAE perform reasonably well. However, when
pads. eartse.moeeaaa eeuueeesse........ ccmm
We also tested other generative models (De Cao & Kipf 2018 Dai et al. 2018 but did not get any meaningful result over our monomer datasets, possihly hecause these methods tailored smaller molccules.

---

Published as a conference paper at ICLR 2022
Table 1: Results on Isocyanates, best bold, second-best underlined; we omit Novelty since all meth- ods achieved 100%; the few valid molecules generated by GraphNVP did not allow for reasonable evaluation on some metrics (-).
Method
Valid
Unique
Div.
Chamfer
RS
Memb.
Train data
100%
100%
0.61
0.00
100%
100%
GraphNVP
0.16%
0.00%
0.00%
JT-VAE
100% %
5.8%
0.72
0.85
5.50%
66.5%
HierVAE
100 %
99.6%
0.83
0.76
1.85%
0.05%
MHG
100% %
75.9%
0.88
0.83
2.97%
12.1%
STONED
100 %
100% %
0.85
0.86
5.63%
79.8%
DEG
100% %
100 %
0.86
0.87
27.2%
96.3% %
the dataset is small, VAE is not able to mine a vocabulary that would allow it to generate many unique molecules. The more diverse vocabulary of HierVAE clearly solves this shortcoming, but the low Membership score shows that does not capture monomer class specifics. trammar-based methods can better capture class-specific molecule characteristics than DL-based methods and have higher Membership scores. However, they perform poorly on RS. Specifically, MHG has fine fine-grained rules that simply attaches atoms. This leads to high diversity but the rules hardly capture domain-specific characteristics. The STONED method iteratively replaces atoms based the SELFIES grammar and only performs interpolation and exploration based on training data, making it hard to embed build-in overall results show that: 1) Our learned, substructure-basse grammar successfully captures class specifics a critical evaluation criterion which has been ignored so far. 2) Other critical, domain- specific metrics such as RS can successfully be optimized during grammar learning. Our score is 25x higher than the others. More importantly, the optimization is done in-situ during grammar construction, and hence avoids post post-processing. 3) Our method the only one that constantly achieves stable performance. Altogether, these results clearly differentiate us from the others.
general,
knowledge in the generative model. The
5.3 RESULTS ON LARGE POLYMER DATASET
Our method developed to model specific classes of complex molecules (e.g., classes of differ- ent monomers or polymers) and is expected to deal with most practical scenarios with only a few dozen samples for training. However, as mentioned above, monomer data itself is different from the molecules used in related works. Therefore, we also investigate how our method performs on large monomer datasets comparing with existing methods Since our approach is relatively complex, but more data- eifaa-efficien,, we apply it 0.15% subset. Details are provided in Appendix B
Results. Table B in the appendix shows the results. In summary, some SOTA systems such as SMILESVAE and GraphNVP fail capture any distribution specifics and mostly generate invalid molecules. VAF and grammar-based baselines (MHG, STONED) perform poorly with respect to the former but their sample quality is reasonable. HierVAE performs extremely well on all metrics except Chamfer distance. Our approach can generally compete with the latter (only trained on 0.15% data) and achieves better sample quality, especially Chamfer distance twice as high.
Discussion. Monomer data turns out to be much more challenging compared to the common datasets. Generally, DL-based methods achieve better performance in terms of distribution statistics, while grammar- based models (including ours) have better sample quality. It is reasonable since DL- based methods are all based on distribution learning while grammar-bass based methods are more focused on modeling chemical rules. Our approach is the only grammar- grammar-based based system performing well on distribution statistics, which highlights the importance of grammar construction. Fine-grained gram- mars that either iteratively attaches single atoms (MHG), only performs input data interpolation (STONED) cannot fit training data more specifically. Our sample quality is among the best. Fur-
*The data was also used in al. 2020 but grammar- hased systems were compared.
8

---

Published as a conference paper at ICLR 2022
Oym Aurd 0.25, Agm 3gm
0.75
A5
DoCaN
OcCoN
L5,
RS
Ag 0.5
Agm0
Os0aN
Necaa
OoDON
No000
0.30
Diversity
(a) Analysis on Isocyanate dataset
0, Aon Aye
0.75,
A 1,39
DS (%)
2.Ag
Diversity
(b) Analysis on Acrylate dataset
Figure 4: Left: Analysis of balance factor X. We choose different combinations of X; for two optimization objectives: Diversity and RS, showing clear trade-off between the two objectives. Right: Examples generated by our learned graph grammar. Our graph grammar can generate novel complex molecular structures that do not exist in the training dataset (e.g., cyclooctane).
thermore, we also show that with more training data (0.3% of the whole dataset), our method can achieve better performance.
5.4 ANALYSIS
Optimizing for Specific Metrics, Balance Factor X. We study the effect weighing the impor- tance of metrics according to needs. We choose 9 different combinations for two optimization objectives: Diversity and RS. A ranges from 0 to 2 with 0.25 as interval, while X2 ranges from 4 to O with 0.5 as interval. Figure depicts results for Isocyanates and Acrylates. We that À fulfills its purpose, as the performance of the two objectives can well controlled. In our study, we use Å = 1, A2 for balanced trade-off between Diversity and RS
Explainability Supports Applications, Functional Group Extraction. In Appendix F we show production rules of three graph grammars learned from three small polymer datasets. For each grammar. there is clearly rule capturing the functional group that characterizes the dataset's cor- responding monomer class. For example, ps the relevant production rule for Isocyanates. Since functional groups must be present in all monomers of this type, the relevant rule is easily obtained by selecting the rule shared by all inputs.
Generated Examples. Figure also shows examples generated using our grammars learned on Isocyanates and Acrylates. Though we have only 32 and 11 training samples respectively, our graph grammar can be used to generate novel and complex molecules. For example, cyclooctane is not contained in the training data but our grammar can generate it by sequentially applying two partial ring formation rules. For more generated examples the other datasets, see Appendix C.2
CONCLUSIONS
We propose a data-efficient generative model combining graph grammar construction with domain- specific optimization. Our grammar incorporates substructures varying size and the construction directly optimizes various chemical metrics. Extensive experiments on three small size polymer datasets and large polymer dataset demonstrate the effectiveness our method. Our system the only that is capable of generating monomers in specific class with high success rate. It will be useful to incorporate property prediction models with our graph grammar for generating superior molecular candidates for practical use.

---

Published as a conference paper at ICLR 2022
ACKNOWLEDGEMENT
This work is supported by the MIT-IBM Watson Lab, and its member company, Evonik.
REFERENCES
Salvador Aguinaga, David Chiang, and Tim Weninger. Learning hyperedge replacement grammars for graph generation. IEEE transactions on pattern analysis and machine intelligence, 41(3): 625-638, 2018.
Han Altae-Tran Bharath Ramsundar, Aneesh S Pappu, and Vijay Pande. Low data drug discovery with one-shot learning. ACS central science, 3(4):283-293, 2017.
David Barber. Buyesian reasoning and machine learning. Cambridge University Press, 2012.
Richard Bickerton, Gaia Paolini, Jérémy Besnard, Sorel Muresan, and Andrew Hopkins. Quantifying the chemical beauty of drugs. Nature chemistry, 4(2):90-98, 2012.
Binghong Chen, Chengtao Li, Hanjun Dai, and Song. Retro*: learning retrosynthetic planning with neural guided a search. In International Conference Machine Learning, pp. 6608-1616.
PMLR, 2020.
Di Chen, Yada Zhu, Xiaodong Cui, and Carla P Gomes. Task-based learning via task-oriented prediction network with applications in finance. arXiv preprint (eXiv:1910.093300 2019.
Vijil Chenthamarakshan, Payel Das, Samuel Hoffman, Hendrik Strobelt, Inkit Padhi, Kar Wai Lim, Benjamin Hoover, Matteo Manica, Jannis Born, Teodoro Laino, et al. Cogmol: target-specific and selective drug design for covid- 19 using deep generative models. Advances Neural Information Processing Systems, 33:4320-4332, 2020.
Noam Chomsky. On certain formal properties of grammars. Information and control, 2(2):137-167, 1959.
Hanjun Dai, Yingtao Tian, Bo Dai, Steven Skiena, and Song. Syntax-directed variational autoen- coder for structured data. arXiv preprint 1xXiv:880.008700 2018.
Nicola De Cao and Thomas Kipf. Molgan: An implicit generative model for small molccular graphs. arXiv preprint 1rXiv:1805.11977 2018.
Priya L Donti, Brandon Amos, and J Zico Kolter. Task-based end-to-end model learning in stochastic optimization. arXiv preprint arXiv: (003v:/700.055220 2017.
Peter Ertl and Ansgar Schuffenhauer. Estimation of synthetic accessibility score of drug-like molecules based on molecular complexity and fragment contributions. Journal of cheminfor- matics, 1(1::1-11, 2009.
Haoqiang Fan, Hao Su, and Leonidas J Guibas. point set generation network for 3d object recon- struction from a single image. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 605-613, 2017.
Dedre Gentner. Structure-mapping: A theoretical framework for analogy. Cognitive science, 7(2):
155-170, 1983.
Rafael Gómez-Bombarell Jennifer N Wei, David Duvenaud, José Miguel Hernández-Lobato. Benjamín Sänchez-Lengeling, Dennis Sheberla, Jorge eguilera-lparraguine Timothy Hirzel, Ryan P Adams, and Alán Aspuru-Guzik. Automatic chemical design using data-driven contin- uous representation of molecules. ACS central science, 4(2):268-22 276, 2018.
Gabriel Lima Guimaraes, Benjamin Sanchez-Lengeling Carlos Outeiral, Pedro Luis Cunha Farias, and Alán Sapuru-Guzik Objective-reinforee generative adversarial networks (organ) for se- quence generation models. arXiv preprint arXiv: 1705. 10843, 2017.
10

---

Published as a conference paper at ICLR 2022
Minghao Guo, Wan Shou, Liane Makatura, Timothy Erps, Michael Foshey, and Wojciech Ma- tusik. Polygrammar: Grammar for digital polymer representation and generation. arXiv preprint arXiv:2105.05278, 2021.
Justus Hibshman, Satyaki Sikdar, and Tim Weninger. Towards interpretable graph modeling with vertex replacement grammars. 2019 IEEE International Conference on Big Data (Big Data), pp. 770-779. IEEE, 2019.
Samuel C Hoffman, Vijil Chenthamarakshann Kahini Wadhawan, Pin- Yu Chen, and Payel Das. Opti- mizing molecules using efficient queries from property evaluations. Nature Machine Intelligence, 4(1):21-31, 2022.
Weihua Hu, Bowen Liu, Joseph Gomes, Marinka Zitnik, Percy Liang, Vijay Pande, and Jure Leskovec. Strategies for pre-training graph neural networks. arXiv preprint arXiv:190s. 12265, 2019.
John J Irwin, Teague Sterling, Michael M Mysinger, Erin S Bolstad, and Ryan G Coleman. Zinc: free tool to discover chemistry for biology. Journal of chemical information and modeling, 52 (7)17777-768,, 2012.
Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Junction tree variational autoencoder for molecular graph generation. International conference on machine learning, pp. 2323-23332 PMLR, 2018
Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Hierarchical generation of molecular graphs using structural motifs. In International Conference on Machine Learning, pp. 4839 4848. PMLR, 2020.
Hiroshi Kajino. Molecular hypergraph grammar with its application to molecular optimization. In International Conference on Machine Learning, pp. 3183-3191. PMLR, 2019.
Mario Krenn, Florian Häse, A Nigam, Pascal Friederich, and Alán Aspuru Aspuru-Guzik. Selfies: robust representation of semantically constrained graphs with an example application in chemistry. arXiv preprint arXivv1905.1377 2019.
Yujia Li, Oriol Vinyals, Chris Dyer, Razvan Pascanu, and Peter Battaglia. Learning deep generative models of graphs. arXiv preprint wxXiv:/803.03324 2018.
Renjic Liao, Yujia Li, Yang Song, Shenlong Wang, Charlic Nash, William L Hamilton, David Du- venaud, Raquel Urtasun, and Richard Zemel. Efficient graph generation with graph recurrent attention networks. arXiv preprint 1rXiv: 2019.
Qi Liu, Miltiadis Allamanis, Marc Brockschmidt, and Alexander L Gaunt. Constrained graph vari- ational autoencoders for molecule design. arXiv preprint 1805vv:880509000 2018.
Ruimin Ma and Tengfei Luo. Pilm: benchmark database for polymer informatics. Journal of Chemical Information and Modeling, 60(10):468444690, 2020.
Tengfei Ma, Jie Chen, and Cao Xiao. Constrained generation of semantically valid graphs via /809.886300 arXiv:/809.0200
regularizing variational autoencoders. arXiv preprint arXiv:
2018.
Kaushalya Madhawa, Katushiko Ishiguro, Kosuke Nakago, and Motoki Abe. Graphnvp: An invert- ible flow model for generating molecular graphs. arXiv preprint wwX.v:1905..16000 2019.
Eukasz Maziarka, Agnieszka Pocha, Jan Kaczmarczyk, Krzysztof Rataj, Tomasz Danel, and Michat Warchot. Mol-cyclegan: generative model for molecular optimization. Journal of Cheminfor- matics, 12(1):1-18, 2020.
Aditya Menon, James A Thompson-Colón, and Newell R Washburn. Hierarchical machine learn- ing model for mechanical property predictions of polyurethane elastomers from small datasets. Frontiers in Materials, 6:87, 2019.
AkshatKumar Nigam, Robert Pollice, Mario Krenn, Gabriel dos Passos Gomes, and Alan Aspuru- Guzik. Beyond generative models: superfast traversal, optimization, novelty, exploration and discovery (stoned) algorithm for molecules using selfies. Chemical science, 2021.
11

---

Published as a conference paper at ICLR 2022
Mareus Olivecrona, Thomas Blaschke, Ola Engkvist, and Hongming Chen. Molecular de-novo design through deep reinforcement learning. Journal of cheminformatics, 9(1):1-14, 2017.
Daniil Polykovskiy, Alexander Zhebrak, Benjamin Sanchez-Lengeling, Sergey Golovanov, Oktai Tatanov, Stanislav Belyaev, Rauf Kurbanov, Aleksey Artamonov, Vladimir Aladinskiy, Mark Veselov, et al. Molecular sets (moses); a benchmarking platform for molecular generation models. Frontiers pharmacology, 11:1931, 2020.
Raghunathan Ramakrishnan, Pavlo O Dral, Matthias Rupp, and Anatole Von Lilienfeld. Quantum chemistry structures and properties of 134 kilo molecules. Scientific data, 1(1):-7,, 2014.
David Rogers and Mathew Hahn. extended-conneccio tion and modeling, 50(5):742-754, 2010.
fingerprints. Journal of chemical informa-
Bidisha Samanta, Abir De. Gourhari Jana, Vicenç Gómez, Pratim Kumar Chattaraj. Niloy Ganguly, and Manuel Gomez-Rodriguez, Nevae: A deep generative model for molecular graphs. Journal of machine learning research. 2020 Apr; 2/ (114): 1-33, 2020.
Benjamin Sanchez-Lengeling, Carlos Outeiral, Gabriel Guimaraes, and Alan Aspuru-Guzik. Opti- mizing distributions over molecular space. an objective-reinforceed generative adversarial network for inverse-design chemistry (organic). 2017.
Boris Sattarov, Igor Baskin, Dragos Horvath, Gilles Marcou, Esben Jannik Bjerrum, and Alexandre Varnek. De novo molecular design by combining deep autoencoder recurrent neural networks with generative topographic mapping. Journal of chemical information and modeling, 59(3): 1182-1196, 2019.
Yair Schiff, Vijil Chenthamarakshan, Samuel Hoffman, Karthikeyan Natesan Ramamurthy, and Payel Das. Augmenting molecular deep generative models with topological data analysis rep- resentations. arXiv preprint arXiv:2106.0444 04464, 2021.
Michael D Shultz. Two decades under the influence the rule of five and the changing properties of approved oral drugs: miniperspective. Journal of medicinal chemistry, 12(4):170111714, 2018.
Satyaki Sikdar, Justus Hibshman, and Tim Weninger. Modeling graphs with vertex replacement grammars. 2019 IEEE International Conference on Data Mining (ICDM), pp. 558-567. IEFE, 2019.
Martin Simonovsky and Nikos Komodakis. Graphvae:
Towards generation of small graphs using variational autoencoders. International conference on artificial neural networks, pp. 412-422. Springer, 2018.
Peter St. John, Caleb Phillips, Travis W Kemper, A Nolan Wilson, Yanfei Guan, Michael F Crow- ley, Mark R Nimlos, and Ross E Larsen Message-passing neural networks for high-throughput polymer screening. The Journal of chemical physics, 150(23):234111 2019.
Megan Stanley, John F Bronskill, Krzysztof Maziarz, Hubert Misztela, Jessica Lanini, Marwin Segler, Nadine Schneider, and Marc Brockschmidt. Fs-mol: A few-shot learning dataset of molecules. 2021.
Govindan Subramanian, Bharath Ramsundar, Vijay Pande, and Rajiah Aldrin Denny. Computational modeling of 3-secretase I (bace-1) inhibitors using ligand based approaches. Journal of chemical information and modeling, 56(10): 1936 1949, 2016.
David Weininger. Smiles, chemical language and information system. introduction method- ology and encoding rules. Journal of chemical information and computer sciences, 28(1):31-36, 1988.
Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning, Machine learning, 8(3):229 226, 1992.
Youjun Xu, Kangjie Lin, Shiwei Wang, Lei Wang, Chenjing Cai, Chen Song, Luhua Lai, and Jian- feng Pei. Deep learning for molecular generation. Future medicinal chemistry, 1166):567-597, 2019.
12

---

Published as a conference paper at ICLR 2022
Xiufeng Yang, Jinzhe Zhang, Kazuki Yoshizoe, Kei Terayama, and Koji Tsuda. Chemts: efficient python library for de novo molecular generation. Science and technology of advanced materials, 18(1):922-976, 2017.
Jiaxuan You, Bowen Liu, Rex Ying, Vijay Pande, and Jure Leskovec. Graph convolutional policy 2018.
network for goal-directed molecular graph generation. arXiv preprint
13

---

Published as a conference paper at ICLR 2022
A DETAILS ON THE MOLECULE GENERATION
Given a learned grammar, we condition the generation strategy based on (non)terminal symbols in the rules: during molecule generation, we exponentially increase the probability of those production rules without non-terminal symbol on the right-hand side based on the iteration number. Formally, the probability to select a certain production rule r at iteration t is p(r) = Z-! exp(atxr,). where I, is a binary value indicating whether rule r contains only terminal symbols on the right- side, and Z is normalization factor. We used a 0.5 in our experiments, since it reduces the generation time sufficiently while maintaining satisfactory diversity.
Note that we initially experimented with uniform random sampling of rules during testing. However, the possibility of generating arbitrarily large molecules (i.e., by choosing production rules with non-terminal symbol on the right-hand side more likely) sometimes resulted in a never-ending generation process, a problem in practice.
B DETAILS ON THE IMPLEMENTATION
Evaluation Metrics. For the large polymer dataset, we consider 4 additional evaluation metrics, measuring distribution statistes of the generated molecules, which are commonly used in DL-based methods. The metrics are:
Octanol- Water Partition Coefficient (logP): A ratio of a chemical's concentration in the octanol
phase to its concentration in the aqucous phase of a two-phase octanol/water system.
Synthetic Accessibility Score (SA) Estimate of how hard or easy it is to synthesize given molecule based on the molecule's s fragments (Ertl & Schuffenhauer 2009).
Quantitative Estimation of Drug-likeness (QED): Estimate of how likely molecule is to be viable drug candidate, meant to capture aesthetics in medicinal chemistry (Bickerton et al.) 2012). Molecular Weight (MW): Sum of atomic weights in molecule. Differences in the histograms for the generated and real data may reveal bias towards generating lighter or heavier molecules.
Note that, while SA Score and QED not considered useful sample quality heuristics for more recent molecules, they are still useful as distribution statistics (Polykovskiy et al. 2020 Shultz 2018
Baselines. For STONED, as suggested by the authors, we first generate the chemical space for each sample in the datase Then we take all samples scoring higher than 0.8 and randomly sample the remaining ones to obtain our 10k samples. For MHG, we learn a hypergraph grammar on the dataset following the paper's implementation and generate molecules by randomly sampling and deploying production rules. For other baselines we mainly use the settings suggested in the original papers. For the experiments on the small datasets, SMILESVAE, GraphNVP and HierVAE are pretrained on the large dataset and thereafter fine-tuned on specific small dataset; the other baseline implementations do not support pretraining, hence we train them from scratch on the small datasets.
Our System. For our approach, we choose a pretrained graph neural network (Hu et al. 2019) as our feature extractor f()). Note that we do not finetune its parameters during training and it can be replaced by any plug-and-pl and-pla feature extractors. For the potential function Fe. we use two-layer fully connected network with size 300 and 128. For the optimization objectives, we consider two metrics: diversity and RS. For hyperparameters, we MC sampling size as 5. We use the Adam optimizer to train the two-layer network with learning rate 0.01. We trained for 20 epochs.
We train the model and construct grammar on each dataset separately from scratch. For the large polymer dataset, we only use 117 training samples to optimize the grammar. This is motivated by the fact that only 436 different motifs exist in the training dataset as stated in Jin al. (020). We can then construct subset consisting of 436 molecules that can cover these 436 motifs by random sampling. We then sample from this subset get the training set for our method. For the basic setting of our method, we sample 117 training molecules. We also consider the scenario with more data, where we extend the former set to 239 samples.
After training, we generated 10k samples per dataset for evaluation. For the large polymer dataset, besides the naively generated 10k samples, we further construct another set of generated molecules
fies
14

---

Published as a conference paper at ICLR 2022
Table 2: Results on Acrylates and Chain Extenders (best bolded, second-best underlined). The low validity of molecules generated by GraphNVP did not allow for reasonable evaluation on some metries (-).
Dataset
Method
Valid
Unique
Div.
Chamfer
RS
Member
Train data
100%
100%
0.67
0.00
100%
100%
GraphNVP
0.00%
JT-VAR
100 %
0.50%
0.29
0.86
4.9%
48.64%
Acrylates
HierVAE
100%
99.7%
0.83
0.89
3.04%
0.82%
MHG
100%
86.8%
0.89
0.84
36.8%
0.93%
STONED
99.9%
99.8%
0.84
0.88
11.2%
47.9%
DEG
100%
100 %
0.86
0.92
43.9%
69.6 %
Train data
100%
100%
0.80
0.00
100%
100%
GraphNVP
0.01%
Chain
JT-VAE
100 %
2.3%
0.62
0.78
2.20%
79.6%
Extenders
HierVAE
100%
99.8%
0.83
0.91
2.69%
43.6%
MHG
100%
87.4%
0.90
0.85
50.6%
41.2%
STONED
100%
99.8%
0.93
0.87
6.78%
61.0%
DEG
100%
100
0.93
0.94
67.5%
93.5%
Table 3: Results on the large polymer dataset (best bold, second-best underlined). The low validity of molecules generated by GraphNVP and SMILESVAE did not allow for reasonable evaluation on some metrics (-). Our method DEG was trained 0.15% and 0.3% of the train data. DEG (fitting)
evaluated using the selected 10k samples via the fitting process described in Appendix B
Distribution Statisties (4)
Sample Quality (1)
Method
logP
SA
QED
MW
Valid
Unique
Div.
Chamfer
Train data
0.12
0.02
0.002
2.98
100%
100%
0.83
0.00
SMILESVAE
9.63
2.99
0.19
751.6
0.01 %
GraphNVP
2.94
0.65
0.03
435.6
0.23%
JT-VAE
2.93
0.32
0.10
210.1
100%
83.9%
0.88
0.50
HierVAE
0.50
0.08
0.02
42.45
100%
99.9%
0.82
0.32
MHG
9.20
1.91
0.10
380.3
100%
100%
0.91
0.56
STONED
2.43
0.81
0.07
179.9
99.9%
100%
0.83
0.45
DEG (0.15% fitting)
1.80
0.25
0.02
69.0
100% %
100 %
0.82
0.60
DEG (0.15%)
5.52
0.51
0.20
334.2
100 %
100%
0.86
0.62
DEG (0.3%, fitting)
1.93
0.23
0.02
70.2
100%
100%
0.85
0.62
DEG (0.3%)
5.64
0.41
0.19
311.4
100%
100% %
0.88
0.63
to have a fair comparison with DL-based methods on distribution statistics. We perform a fitting process selecting 10k data points from 100k generated samples using the same learned grammar in order to get a better performance on distribution statistics. Specifically, we calculate the four evalu- ation metrics of distribution statisties for both the training dataset and the 100k generated samples;
15

---

Published as a conference paper at ICLR 2022
each data point can have corresponding 4-dimensional vector. We perform k-means clustering of all the vectors of the training dataset with & = 10, 000. Then we partition the 4-dimensional space into & regions using Voronoi diagram and treat each region 'equal mass', For each region, sam- ple one data point from our generated samples that lie the region. Thus, we construct a set 10k generated samples and evaluate it the same way as the other methods.
C ADDITIONAL RESULTS
C.I QUANTITATIVE RESULTS
We report the results on the Acrylate and Chain Extender datasets in Table Since SMILESVAE cannot achieve reasonable validity for all three small datasets, we omit the tables. Our method significantly outperforms the others in terms of Retro" Score and Membership, while achieving best or comparable performance across all other metrics.
The results for the large polymer dataset reported in Table 3 As common practice (Jin al,, 2020 Polykovskiy et al.] (2220). we compute Frechet distance hetween property distributions of molecules in the generated and sets for distribution statistics. All but our two new evaluation metrics are computed using MOSES (Polykovskiy et al. 2020). Since the building blocks of polymer data in this dataset are from special database (St. John al. 2019), which differs significantly from the emolecule database Retro" is trained on, we do not report RS as it is less meaningful. Our method achieves remarkable performances across all evaluation metrics. Note that we only use 117 data points while the others are fully trained on the whole dataset.
C.2 EXAMPLES GENERATED RESULTS
(a) Examples generated by the graph grammar learned on large polymer dataset
NH2
HN
OH
OH
H&N
NHo
(b) Examples generated by graph grammar learned on Chain Extender dataset
Figure 5: Examples of generated results using our learned graph grammar.
D SWITCHING THE FEATURE EXTRACTOR
In order to demonstrate the plug-and-ple capability of our system's feature extractor, we provide experimental results where we use most embeddings from the deepchem package As it can be seen in Figure 6 this simple feature extractor yields higher performance than the pretrained GNN at the start of the optimization, but cannot improve further through the whole learning process. In order to obtain a reasonable optimized grammar, an ideal feature extractor should capture both the local and
htttps: (we just concatcnated atom and bond features)
reaothedocs. htt.i/////a//////eeeeeee// httpsssttapp_eeeeeeeeeeee wwwereecce/eatturreeeeoo iers.
html
16

---

Published as a conference paper at ICLR 2022
the global information of the hyperedges in the hypergraph. Hence, the GNN fits better purpose of grammar construction.
Diversity Score
RS Score
Simple Embedding Pretrained
Simple Embedding Pretrained
Epoch
20
Epoch
20
Figure 6: Comparison with simple feature extractor on Isocyanates.
E DEMONSTRATION OF STABILITY OF REINFORCE
Since REINFORCE is known to have large variance, we provide results on the stability of our proposed DEG. We run our algorithm with three random seeds on the Isocyanates data. The ex- perimental results are shown in Figure / The diversity scores are relatively stable across the three random seeds. The scores vary more the end of optimization. We also show convergence curves for the other three datasets in Figure g
three experiments converge to a similar value around
0.35
Diversity Score
RS Score
Exp
0.05
0.6
20
20
Epoch
Epoch
Figure Analysis of stability of proposed DEG.
2.44
Oplimizatio Objective.
Oplimizatio Objjcctive
Optimization Objective
1.1
Epoch
20
Epoch
70
Epoch
Acrylates
(b) Chain Extenders
(c) Polymer Datasct (0.15%)
Figure 8: Convergence curves on three datasets.
17

---

Published as a conference paper at ICLR 2022
F LEARNED GRAPH GRAMMAR
(a) Examples production rules Iearned from Isocyanates datasct
(b) Examples of production rule learned from Acrylates dataset
(c) Examples of production rule learned from Chain Extenders datuset
Figure 9: Examples of production rules from our learned graph grammar.
G OUR DATASETS
G.1 ISOCYANATES
MDI (CC (=C=)) =C1
MDI CCC-NCI-CC |ct.:p/eeeeeoocccc.....cccccccc.
(C=C4) 1
MDI oocpap/..ccccllaaaccccccccocooaa
CC4=C
C=C (CCC)CCCCC (===O)))) N=C=O) N=C=0 N=C=O
HDI O=C-NNcccCCCN--CO0
HDI O-C-NNCCCCCCCCCCCCCCCCCCCC
HDI O=C-NCCCCCCCCCCCCCCCCOCCCC
HDI OccNCCCCECCCCCCCCCCCCCCC
IPDI CC1 (CC (CC (CN- (C==C(C=C CN=C=O) N=C=O
(C1) (CC)
TDI
HMDI O=C=Nc1ccG (CC20CC (CC2) N=C=0) CC1
LDI CCOC (C (N=C=O) CCOCN=C=O)
G.2 ACRYLATES
Benzyl Acrylate
(=C0)
Phenyl Acrylate
Phenyl Methacrylate CC
2-Phenylethyl Acrylate
C-CC (-001-C-00
n-Octyl Methacrylate (=C))
Sec-Butyl Acrylate
CCC (-)) C+C
Benzyl Methaerylate CC (=C) 0001-0000--1
Pentaftuorophenyl
C=CC (o
18

---

Published as a conference paper at ICLR 2022
iso-Butyl methacrylate
CC (=)))
n-Dodecyl methacrylate
sec-Butyl methacrylate
ccc (c)))(()))((
n- n-Propyl methacrylate CCCoC
e.J.scrrimetyyylyycooeee/// methacrylate cC1cc (CC (C1) (=))))
iso-Decyl acrylate CC (C) cccccccoC (=0) C=C
n- n-Propyl acrylate CCCOC (=O) C=C
2- 2-Methoxyethyl acrylate COCCOC (=0) C=C
2- P-Phenoxyethyl methacrylate cc (=C) c [=000000000
n-Hexyl acrylate CCCCCCOC (=0) C=C
2-n- ---Buxxxttthl mattoxeylyymmethacryllaa cCccoccoc (=O)
Methyl Methacrylate CC (=C) C (=O) OC
Methyl Acrylate COC (=O) C=C
Butyl Arylate CCCCOC (-0) C-C
2-
2-Ethoxyethyl methacrylate cCoCCoC (=0) (-)) C
Isobornyl methacrylate cC (=C) c (C1 (C2 (C)
2-Ethylhexyl methacrylate ccccc (CC) coc
Neopentyl glycol propoxylate diacrylate
cc (C) (cococoa (=0) C=C) COCCCOC C=C
1,6-Hexanediol diacrylate C=CC (=0) occecccoa (=0) C=C
Pentaerythritol triacrylate C=CC (=O) OCC (CO) (COC (=O) C=C) COC (=0) C=C
Irimethhlolpropane propoxylate triacrylate
CCC (COCCCOC (=0) C=C) (COCCCOC (=0) C=C) cocccoc (=0) C=C
Di(trinethylolrropane) tetraacrylate CCC (COCC (CC) (COC (=O) C-C) coc (=0) C=C) (COC (=0) C-C) COC (=0) C=C
Dipentaerythritol pentaacrylate
C=CC (=0) OCC (CO) (COCC (COC (=0) C=C) (CCC (=0) C= Coc C=C) COC (=0) C=C
Dipentaerythritol hexaacrylate
C=CC (=O) OCC (COCC (COC (=0) C=C) (COC C=C)
(COC (=0) C=C) COC (=0) C=C
G.3
CHAIN EXTENDERS
EG
OCCO
1,3-BD (C)
BD OCCCCO
AE-H-AE OCCNC (=O) NCCCCCCNC (=0) NCCO
AE-L-AE OCCN10 (=0) NC (C1 (=0) CCCONC (=0) NCCO
D-E-D Ocloce (co1) ) cCC (-0) occoc ( (-0) CCclccc (ccl)
LYS oc (-O) (N) CCCCN
L-Om (=0) C (N) CCCN
Pip
N1CCNCC1
AFD delcec SSc2cco N
MDA Nelcce (cc1) Cc2cce N
19


Reviews:
[{"review_id": "bhOZlJVyWY5", "reviewer": "Reviewer_oHTg", "summary": "", "questions": "", "limitations": "", "rating": 8, "confidence": 4, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "This paper proposes a generic solution for learning to generate graphs in an extreme few-shot manner where only dozens of examples are provided, which is pretty common in the polymer/monomer domain. The method is general and can have a large impact on the graph learning community. Although technically the proposed method is similar to some previous work like MHG[1], it cleverly preserves the class-specific properties by operating on subgraphs instead of individual atoms. Also, the idea of learning a grammar search algorithm using RL instead of directly learning the grammar is novel and interesting in the domain. The proposed method is well-supported by experiments on datasets of different scales.\n\nThe paper is well-structured overall but there is still room for improvement. The notation in section 4 is a bit unclear. In section 4.1 the subscripts are usually used for denoting the number of iteration, and the superscripts are used for different connected components. While in section 4.2 right before Equation (3) we see there is $e_t^{(j)}$, where the meaning of superscript $(j)$ is unclear. And $t$ here is used both for denoting the current iteration and the total number of iterations. Also if I understand correctly, $X$ is a binary matrix, and instead of $p(X)=\\prod_t\\prod_j \\phi(e_t^j;\\theta)$, it should be $p(X)=\\prod_t\\prod_j \\phi(e_t^j;\\theta)^{X_{tj}} (1-\\phi(e_t^j;\\theta))^{1-X_{tj}}$?\n\nFor the experiment section, both Appendix A and Table (3) contain critical information for understanding the experiment setting and results, and so they should be put earlier in the main text. \n\nQuestion:\n\n1. The paper proposes a clean algorithm for learning grammar. But in practice, there must be a lot of hyperparameters to tune, such as the number of production rules, the maximum/minimum length of a single production rule, etc.? How do you decide these parameters? Do you do any pruning for the production rules?\n\n2. The main text does not mention how to generate molecules using the learned grammar rules. Do you sample the production rules uniformly randomly during testing? If yes, do you plan to learn a policy for generating molecules? How to jointly learn the generation policy together with the rule search policy?\n\n3. The space of grammar rules is combinatorial as mentioned in section 4.2. How does RL circumvent that and learn a reasonable policy?\n\n4. Why do you only use diversity and RS as the optimization objectives, as mentioned in Appendix A?\n\n[1] Hiroshi Kajino. Molecular hypergraph grammar with its application to molecular optimization. In International Conference on Machine Learning, pp. 3183–3191. PMLR, 2019.", "summary_of_the_paper": "This paper proposes a sample efficient hypergraph grammar learning algorithm for generating molecules. The bottom-up search algorithm conducts iterative contraction according to a learned policy, where in each iteration, several hyperedges are sampled, contracted into a single node, and written into a production rule as part of the final grammar. The search policy is being trained using RL where the rewards are given by evaluating a set of molecules generated by the policy. The proposed method is evaluated on a small and a large monomers dataset and outperforms existing molecule generation algorithms in terms of the synthesizability and the membership rate.", "summary_of_the_review": "Overall, this paper makes decent contributions in both technical and empirical aspects, and therefore I recommend accepting the paper provided that the authors correct the writing issues.", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "extra_scores": {"correctness": "4: All of the claims and statements are well-supported and correct.", "technical_novelty_and_significance": "3: The contributions are significant and somewhat new. Aspects of the contributions exist in prior work.", "empirical_novelty_and_significance": "4: The contributions are significant, and do not exist in prior works."}, "extra_text": {}}, {"review_id": "NlQV_46EQmm", "reviewer": "Reviewer_Qrrj", "summary": "", "questions": "", "limitations": "", "rating": 8, "confidence": 3, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "This is a pretty solid contribution. Although the paper is written clearly, I admit I had trouble trying to understand the method initially, but once I got the big picture, everything lined up nicely. The methodology in itself (generative learning through graph grammars) is not new, and the proposed model presents some similarities to the HMG model of Kajino. However, it draws from previous methods in a clever way and addresses most of their limitations (for example, the production rules involve substructures instead of single atoms). This, in my opinion, is a plus. The main advantage of this model is its data efficiency, which the experiments corroborate nicely. Nonetheless, I have a few points I would like the authors to address before I give complete acceptance. \n\n1) It is unclear to me what is the computational cost of constructing the grammar and training the model since generating the production rules involves graph matching (and although you affirm this isn't an issue). How does your training/grammar inference cost compares to other approaches? \n\n2) \"we also show that with more training data (0.3% of the whole dataset), our method can achieve better performance\". I might have missed it, but where is this shown?\n\n3) Why are some results in the tables underlined? You should explain it in the captions.\n\n4) This is more of a request for clarification. How is the final set of grammar rules chosen? If I understood correctly, the bottom-up construction process generates a lot of near-duplicates, as well as potentially useless production rules, especially during the initial iterations. Is there any pruning process after the optimization has been performed, or just everything is kept?\n\n5) How many rules does the grammar construction process produce in the datasets you evaluated?", "summary_of_the_paper": "The paper presents a data-efficient graph grammar-based approach to molecular generation (with a focus on polymer generation). The model requires that the molecule be represented as a hyper-graph. The productions of the grammar are basically rules for contracting connected nodes into a single node (a non-terminal symbol), which are later expanded during generation. Each rule is essentially derived from a random sample of the hyper-graph edges: the grammar is produced by iteratively contracting the nodes incident to the edges into non-terminal nodes until the hyper-graph consists of a single non-terminal node. This procedure is applied simultaneously to all the graphs of the training set. Once a grammar is obtained, it is optimized by maximizing some desired metrics (such as diversity). The optimization is non-differentiable since it requires generated graphs to evaluate the objective function, and thus the authors resort to approximate the gradient's expectation using MC sampling and the REINFORCE score function estimator.\nThe experiments aim at showing that the proposed model is data-efficient (achieving strong performances using a small fraction of the molecules used by competitors), capable of extrapolation (since it can produce molecules outside of the training set), and explainable (since it is shown to identify functional groups which characterize the family of generated molecules).\n\n", "summary_of_the_review": "I am decidedly leaning towards acceptance. In my opinion, this is a strong contribution that deserves to appear at ICLR. I will most likely raise my score to an 8 after the authors will answer my questions and modify the text accordingly where needed.", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "extra_scores": {"correctness": "4: All of the claims and statements are well-supported and correct.", "technical_novelty_and_significance": "3: The contributions are significant and somewhat new. Aspects of the contributions exist in prior work.", "empirical_novelty_and_significance": "3: The contributions are significant and somewhat new. Aspects of the contributions exist in prior work."}, "extra_text": {}}, {"review_id": "8CkwYrAF1xi", "reviewer": "Reviewer_4wRv", "summary": "", "questions": "", "limitations": "", "rating": 8, "confidence": 3, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "The proposed method is novel and opens potential for new line of research in graph grammar. I personally find the submission to be clear and well-written. Overall, I am positive and would like to give a \"accept\". \n\nHowever, I have few more comments that I hope to help improve the paper. Several of them are around the modeling choices and some of them are to clarify my understanding of the practical usefulness of the proposed method.\n\n1. The proposed method uses pretrained graph neural network to generate the sampling weights and claim that this can be replaced by any plug-and-play feature extractor. Can the authors provide data to support this claim? If this is actually true, I would suggest to use the simplest feature extractor to keep the proposed method clean.\n2. Is the REINFORCE algorithm stable across random seeds? My hunch is that they are not. Can the authors provide error bars in for their data? Can the authors provide convergence curves to demonstrate the learning? \n3. While the proposed method is efficient, I have the impression that it does not scale up well to more data (the authors have to subsample the training set for the experiments in Table 3). My first request is for the authors to report the actual computation time for the proposed method on the experiments they have done. Second, aside from the computational challenge, can the proposed algorithm benefit from more data? If so, can we estimate how much we can gain by including the whole training set of the large polymer dataset?", "summary_of_the_paper": "This paper introduces a new grammar-based generative model for the molecule generation task. The graph grammar is defined as a set of production rules that operate on module graphs (i.e. the molecule graphs are not linearized as done in some previous work). The graph grammar is learned by iteratively contracting hyperedges (i.e.  edges that can connect multiple nodes, defined by simple chemistry-inspired rules) into non-terminal nodes and the submission proposes to learn how to sample the hyperedges by a REINFORCE algorithm that optimizes for several molecule generation metrics. \n\nThe evaluation is done both on small and large molecule generation datasets. Notably, the proposed method achieves strong performance while being very data-efficient.", "summary_of_the_review": "I find the proposed method to be novel and effective. the paper is clear and well-written. I have a few comments around modeling designs but I think the comments are addressable. ", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "extra_scores": {"correctness": "3: Some of the paper’s claims have minor issues. A few statements are not well-supported, or require small changes to be made correct.", "technical_novelty_and_significance": "4: The contributions are significant, and do not exist in prior works.", "empirical_novelty_and_significance": "3: The contributions are significant and somewhat new. Aspects of the contributions exist in prior work."}, "extra_text": {}}, {"review_id": "31fYlo5LMBe", "reviewer": "Reviewer_LtXp", "summary": "", "questions": "", "limitations": "", "rating": 8, "confidence": 4, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "main_review": "Strength:\nThis method is very data efficient given grammar-based learning. \nThe hypergraph contraction-based production rule learning process is very novel (at least from my perspective).\n\nWeakness:\nIt seems like the model can only work on a small set of molecules to generate the rules due to the computational complexity.\nThe way this model learns the production rule is actually very related to a domain called task-based learning, where people tend to optimize their model towards some non-differentiable evaluation metrics. \nThe authors should reference some of those works, e.g. \n\"Task-Based Learning via Task-Oriented Prediction Network with Applications in Finance\", \n\"Task-based End-to-end Model Learning in Stochastic Optimization\".", "summary_of_the_paper": "This paper proposed an interesting grammar learning-based data-efficient molecule generation model. \nThe key idea of this method is to learn a set of production rules via a hyper-edge selection process that optimizes a set of evaluation metrics. \nThis method achieves impressive performance on extremely small datasets and achieves competitive performance compared with end-to-end models trained on a large dataset. \n", "summary_of_the_review": "Due to the novelty of this data-efficient grammar-based molecule generation method and its impressive performance, I recommend to accept this paper.", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "extra_scores": {"correctness": "4: All of the claims and statements are well-supported and correct.", "technical_novelty_and_significance": "4: The contributions are significant, and do not exist in prior works.", "empirical_novelty_and_significance": "3: The contributions are significant and somewhat new. Aspects of the contributions exist in prior work."}, "extra_text": {}}]

Author rebuttal:

Meta-review: This paper presents an approach to learn graph grammars for molecule generation in a very data-efficient way.  The approach combines bottom-up grammar construction by contracting graph substructures and evaluation-driven learning of the parameters in grammar construction in order to optimize metrics of interest.  This paper is well written and the graph grammar learning approach is novel and can potentially have impact beyond just generating molecules.  All reviewers unanimously recommended acceptance of this paper.

A few things emerged in the reviews and discussions with authors, regarding in particular the computational cost and scalability of the approach and the actual molecule sampling process after learning.  I hope the authors can clarify these in the paper, and as the authors said in the discussion that exploring a more expressive model that uses learned probabilities on the production rules can make the model more powerful, which is a promising direction for the future.
Decision: Accept (Oral)