Data-Efficient Graph Grammar Learning for Molecular Generation

Minghao Guo, Veronika Thost, Beichen Li, Payel Das, Jie Chen, Wojciech Matusik

Abstract

Deep generative models for molecular design typically require massive datasets, which are often unavailable for specialized chemical classes. We present Data-Efficient Graph Grammar (DEG), a framework that learns to construct molecules using a learnable graph grammar. By representing molecules as hypergraphs and optimizing production rules through reinforcement learning, DEG generates high-quality, synthesizable molecules from as few as 11 samples, significantly outperforming existing deep learning benchmarks in data-scarce regimes.

Introduction

Deep learning has revolutionized molecular generation, yet it remains constrained by a significant "data hunger." State-of-the-art models like Variational Autoencoders (VAEs) or Generative Adversarial Networks (GANs) typically require over 100,000 samples to learn the complex underlying rules of chemistry. However, in practical scientific discovery, researchers often target specific molecular classes—such as specialized monomers for high-performance polymers—where only a few dozen examples exist.

Training standard neural networks on such small datasets often leads to memorization or the generation of chemically invalid structures. Furthermore, ensuring that a generated molecule is synthesizable remains a major challenge. To address these issues, we introduce DEG, a method designed for high performance in data-limited environments.

The DEG Framework

DEG departs from treating molecules as simple strings or adjacency matrices. Instead, it utilizes a hypergraph representation and learns a set of production rules (a grammar) to assemble molecules from meaningful substructures.

Overview of the DEG framework: from training data to a learnable graph grammar and generated samples.

The construction of this grammar involves three key components:

  1. Bottom-up Search: The model starts with existing molecules and iteratively "contracts" hyperedges (groups of atoms and bonds) into non-terminal nodes. This process automatically extracts production rules that capture functional groups and chemical motifs.
  2. Learnable Potential Function: A neural network ($F_\theta$) assigns weights to possible contractions, guiding the model to learn which rules are most effective for generating high-quality molecules.
  3. Reinforcement Learning: The grammar is optimized using the REINFORCE algorithm to maximize domain-specific metrics, such as diversity and synthesizability, ensuring the generated samples are both novel and practical.

By working with subgraphs rather than individual atoms, DEG naturally preserves valency and captures the essential functional groups that define a molecule's behavior. Additionally, the resulting production rules are human-readable, providing a level of interpretability often missing in "black-box" deep learning models.

Experimental Results

We evaluated DEG on two scales: small, class-specific datasets (Acrylates, Chain Extenders, and Isocyanates with 11–32 samples) and a large-scale benchmark of 81,000 monomers.

On the small datasets, DEG demonstrated remarkable performance compared to established baselines like JT-VAE, HierVAE, and STONED. As shown in Table 1, DEG significantly outperformed these models in Membership (adherence to the target class) and Retro* Score (a measure of synthesizability).

Table 1: Performance comparison on the Isocyanate dataset. DEG shows superior synthesizability (RS) and class membership.

Specifically, on the Isocyanate dataset (only 11 training samples), DEG achieved a Retro Score of 27.2%*, while the next best baseline reached only 5.63%. Furthermore, when trained on just 0.15% of the large-scale monomer dataset (approximately 120 samples), DEG remained competitive with state-of-the-art models trained on the full dataset.

Conclusion

DEG provides a robust solution for molecular design in data-scarce environments. By combining formal graph grammars with reinforcement learning, it generates diverse, class-specific, and synthesizable molecules. Future work will focus on integrating property prediction models directly into the grammar optimization loop, enabling the targeted design of molecules with specific physical properties like heat resistance or elasticity.

Summary updated

BibTeX
@inproceedings{guo2022data,
  author = {Minghao Guo and Veronika Thost and Beichen Li and Payel Das and Jie Chen and Wojciech Matusik},
  title = {{Data-Efficient Graph Grammar Learning for Molecular Generation}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=l4IHywGq6a},
}
Figure