Any-Property-Conditional Molecule Generation with Self-Criticism using Spanning Trees

Alexia Jolicoeur-Martineau, Aristide Baratin, Kisoo Kwon, Boris Knyazev, Yan Zhang · Submission to ICLR 2025 · Rejected

Generating novel molecules tailored to specific target properties is a holy grail in drug discovery and materials science. However, most generative models struggle to balance structural validity with the ability to condition on multiple, complex properties without requiring extensive retraining.

To address this, researchers have introduced STGG+, a new generative model that can design molecules tailored to any combination of target properties. By combining a modern Transformer architecture with a novel "self-criticism" mechanism—where the model predicts the properties of its own creations and filters for the best ones—STGG+ achieves state-of-the-art performance in generating valid, diverse, and property-accurate molecules.

The Challenge of Molecular Design

In practical applications, the goal isn't just to generate any valid molecule, but to find ones with specific characteristics, such as high solubility, low toxicity, or specific binding affinities. This is notoriously difficult for two main reasons:

  1. Structural Validity: Most molecular representations (like 1D strings) are fragile. A single misplaced character can result in a molecule that violates the laws of valency and is chemically impossible.
  2. Multi-Property Control: Real-world design requires balancing multiple, often conflicting, properties. Traditional models often require retraining if the target properties change. Furthermore, models often struggle to generate molecules with "out-of-distribution" (OOD) properties—values more extreme than anything seen in the training data.

Methodology: Introducing STGG+

The authors build upon Spanning Tree-based Graph Generation (STGG), a method that represents molecules as trees to ensure structural validity through clever masking of invalid "tokens" during generation. Their improved version, STGG+, introduces several key architectural and methodological innovations.

Architecture comparison between the original STGG and the new STGG+ model, highlighting the addition of property conditioning and modern Transformer components.
  • Modern Transformer Backbone: The original architecture is swapped for a state-of-the-art Transformer incorporating features like Flash-Attention-2, Rotary Embeddings, and SwiGLU to improve scalability and efficiency.
  • Any-Property Conditioning: By randomly masking property labels during training, the model learns to generate molecules based on any subset of available properties at inference time, eliminating the need for task-specific retraining.
  • Classifier-Free Guidance (CFG): Borrowed from image generation models like Stable Diffusion, CFG is used to "nudge" the model more strongly toward desired property values, which is especially useful for reaching extreme OOD targets.
  • Self-Criticism: This is the standout feature of STGG+. The model is trained with an auxiliary loss to predict the properties of the molecule it is currently building.
The self-criticism mechanism using a Best-of-K sampling strategy to select the generated molecule that best matches target properties.

During sampling, the model generates $k$ candidates and uses its internal "critic" to evaluate them. It then selects the molecule that best matches the target properties using a "best-of-$k$" strategy.

Performance and Key Insights

The model was evaluated across a diverse range of benchmarks, including standard datasets (QM9, Zinc250K), biological activity datasets (HIV, BACE, BBBP), and the highly complex Chromophore DB (averaging 35 atoms per molecule compared to 9 in QM9).

Key Results: * State-of-the-Art Fidelity: On the HIV, BACE, and BBBP datasets, STGG+ achieved top-tier scores for property alignment (MAE) and accuracy, frequently outperforming complex diffusion-based models. * Near-Perfect Validity: Thanks to its spanning tree representation and structural masking, the model consistently achieved ~100% molecular validity across most tasks. * Efficiency in Reward Maximization: On the QM9 reward maximization task, STGG+ achieved higher average rewards than specialized reinforcement learning methods (like GFlowNet) while using only ~11.5% of the training molecules. * Scaling to Complexity: In the Chromophore DB experiments, STGG+ successfully handled large, complex molecules that typically cause other models to fail.

Broader Takeaways: * 1D is Highly Competitive: While 2D and 3D graph-based models are popular, this paper reinforces that 1D string representations (like Spanning Trees) are highly competitive, more scalable, and benefit directly from advancements in Large Language Model (LLM) architectures. * The Critic Improves the Creator: Jointly training the generator and the property predictor allows the model to develop an internal "understanding" of chemistry that improves its generative accuracy. * Robustness to the "Impossible": STGG+ remains surprisingly stable even when asked to generate molecules with "impossible" property values (e.g., a QED score higher than the theoretical maximum), showing better graceful degradation than previous methods.

Limitations and Future Directions

While STGG+ represents a significant step forward, challenges remain. First, chemical validity does not guarantee synthesizability; a molecule may follow valency rules but still be impossible or prohibitively expensive to create in a lab. Second, the "self-critic" is only as good as its training data. For extremely high out-of-distribution values, the internal predictor can still make errors, leading to sub-optimal selections in the best-of-$k$ phase. Finally, future work should focus on conditioning models on more complex, computationally expensive properties that are directly relevant to late-stage drug discovery, moving beyond "easy" metrics like molecular weight or logP.

Summary updated

BibTeX
@misc{jolicoeurmartineau2024any,
  author = {Alexia Jolicoeur-Martineau and Aristide Baratin and Kisoo Kwon and Boris Knyazev and Yan Zhang},
  title = {{Any-Property-Conditional Molecule Generation with Self-Criticism using Spanning Trees}},
  year = {2024},
  eprint = {2407.09357},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.09357},
}
Figure