Probabilistic generative transformer language models for generative design of molecules

Lai Wei, Nihang Fu, Yuqi Song, Qian Wang, Jianjun Hu

TL;DR

Researchers have developed the Generative Molecular Transformer (GMTransformer), a probabilistic model that treats molecule design as a "blank-filling" task. Unlike traditional "black-box" generative models, this approach offers a more interpretable design logic and enables "tinkering"—the ability to modify specific parts of an existing molecule while maintaining chemical validity.

What Problem Does This Paper Address?

Designing new organic molecules for drugs or materials is a "needle in a haystack" problem. While deep learning models like Variational Autoencoders (VAEs) and Generative Adversarial Networks (GANs) have shown promise, they suffer from two major drawbacks:

  1. Interpretability: They are often "black boxes," making it hard for chemists to understand why a model suggested a specific structure.
  2. Modularity/Tinkering: Most models generate molecules from scratch. In the real world, chemists often want to "tinker"—taking a known molecule and swapping out a specific functional group to fine-tune its properties.

The authors aim to bridge this gap by using a language model architecture that can intelligently fill in the blanks of a molecular string.

Methods

The core of this work is the Blank Filling Language Model (BLM) applied to molecular representations. Instead of predicting the next character in a sequence (like a standard GPT), the GMTransformer operates on a "canvas."

The process follows a three-stage iterative loop:

  1. Choose a blank: The model looks at the current canvas (which contains tokens and placeholders/blanks) and selects which blank to fill.
  2. Pick a token: It selects a chemical token (an atom, bond, or branch) to place in that blank based on the surrounding context.
  3. Create new blanks: The model decides whether to insert new blanks to the left or right of the new token, allowing the molecule to "grow" dynamically.

The authors tested this using three different molecular "languages": SMILES (the industry standard), SELFIES (a newer, more robust representation), and DeepSMILES.

Datasets

The models were trained and evaluated using the MOSES (Molecular Sets) benchmarking platform.

  • Source Data: The dataset is derived from ZINK Clean Leads, containing approximately 4.6 million molecules filtered for lead-like properties (no charged atoms, specific ring sizes, and medicinal chemistry filters).
  • Property Training: For conditional generation (designing for specific traits), the authors used subsets of MOSES ranked by properties like logP (solubility), tPSA (surface area), and QED (drug-likeness).

Key Insights and Ideas

  • The "Tinkering" Potential: Because the model is designed to fill blanks, you can manually "mask" a part of a known drug molecule and ask the model to suggest chemically valid replacements. This mimics the natural workflow of medicinal chemists.
  • Representation Trade-offs: The choice of "language" matters immensely.
  • SELFIES achieved 100% validity because the language itself is designed to prevent impossible chemical structures.
  • SMILES models had lower validity (~85%) but were better at capturing complex biological/chemical distributions (measured by the FCD metric).
  • Emergent Chemistry Rules: By saving models at different training epochs, the authors showed that the Transformer gradually "learns" chemistry. Early on, it produces gibberish; by epoch 100, it has mastered valence rules and the complex syntax of molecular rings.

Key Results

The GMTransformer performed competitively against state-of-the-art baselines (like VAEs and AAEs) across several metrics:

  • Validity & Novelty: The GMT-SELFIES model achieved 100% validity and a high novelty score of 96.83%, meaning it generates valid molecules that aren't just copies of the training set.
  • Internal Diversity (IntDiv): The models scored ~0.87, indicating they generate a wide variety of chemical structures rather than collapsing into a few "safe" patterns.
  • Conditional Success: When tasked with generating "high-property" molecules, the model successfully shifted the distribution of the generated samples to match the "Top 50%" target sets for logP and QED.

Limitations and Future Work

While the "blank-filling" process is interpretable, the underlying Transformer is still a complex neural network. The authors note that while SELFIES guarantees validity, it surprisingly performed worse on the Fréchet ChemNet Distance (FCD)—a metric that measures how well the model captures biological and chemical relevance. This suggests that the "robustness" of SELFIES might sometimes come at the cost of capturing the nuanced "grammar" of real-world drug molecules.

Future work could involve training the model on even larger datasets or integrating it into an active learning loop where a chemist provides feedback on the "tinkered" suggestions in real-time.

Summary updated

BibTeX
@article{wei2023probabilistic,
  author = {Lai Wei and Nihang Fu and Yuqi Song and Qian Wang and Jianjun Hu},
  title = {{Probabilistic generative transformer language models for generative design of molecules}},
  journal = {J. Cheminformatics},
  year = {2023},
  doi = {10.1186/s13321-023-00759-z},
}
Figure