Improving Molecular Graph Generation with Flow Matching and Optimal Transport

Xiaoyang Hou, Tian Zhu, Milong Ren, Dongbo Bu, Xin Gao, Chunming Zhang, Shiwei SunarXiv 2024 · DOI

Abstract

Generating high-quality molecular graphs remains a significant challenge due to the discrete nature of chemical structures and the complexity of their underlying distributions. We present GGFlow, a generative framework that leverages discrete flow matching and optimal transport to create efficient and stable generative trajectories. By "straightening" the path between noise and data, GGFlow achieves state-of-the-art performance on molecular benchmarks with significantly fewer sampling steps than traditional diffusion models.

Introduction: The Challenge of Molecular Design

Designing novel therapeutic molecules requires searching a chemical space estimated at $10^{33}$ possibilities. While diffusion models have emerged as a powerful tool for graph generation, they face two primary obstacles:

  1. Sampling Inefficiency: Diffusion models typically rely on stochastic differential equations (SDEs), resulting in "curvy" trajectories that require hundreds or thousands of steps to sample accurately.
  2. Discrete Constraints: Molecules must adhere to strict valency rules. Continuous noise models often struggle to respect these discrete boundaries, leading to invalid structures that necessitate complex post-processing.

Methods: Straightening the Generative Path

GGFlow addresses these issues through three key technical contributions:

Discrete Flow Matching (DFM) with Optimal Transport

Unlike the stochastic paths in diffusion, GGFlow utilizes flow matching to transform a prior distribution into the data distribution via ordinary differential equations (ODEs). By integrating Optimal Transport (OT) based on Hamming distance, the model identifies the most direct, linear path between noise and the target molecule.

Comparison of generative trajectories: Diffusion (left) exhibits noisy, inefficient paths; Flow Matching (center) provides deterministic paths; Flow Matching + Optimal Transport (right) achieves the 'straightest' and most efficient trajectories.

GraphEvo: Edge-Augmented Transformer

To better capture the interdependencies within a molecule, the authors developed GraphEvo. This architecture employs a triangle attention mechanism, enabling edges (bonds) to communicate directly. This is vital for chemical stability, where the state of one bond is often contingent on its neighbors.

Goal-Guided Reinforcement Learning

For conditional generation tasks, GGFlow employs a Reinforcement Learning (RL) framework. This allows the model to fine-tune generative trajectories toward specific chemical properties (e.g., solubility) without sacrificing the diversity of generated samples.

Datasets and Evaluation

The framework was evaluated on two major molecular benchmarks:

  • QM9: 134,000 small organic molecules (up to 9 heavy atoms).
  • ZINC250k: 250,000 drug-like molecules (up to 38 atoms). Additionally, generic graph datasets (Ego-small, Community-small, and Grid) were used to assess the model's versatility across different topologies.

Key Insights

  • Linearity Improves Efficiency: The use of Optimal Transport to pair noise with data points creates a linear probability path. This "straightening" allows GGFlow to outperform diffusion models while requiring only half the sampling steps (500 vs. 1000).
  • Intrinsic Validity: GGFlow achieves nearly 100% validity on the QM9 dataset without external correction algorithms, indicating a deep learned understanding of chemical valency.
  • Robust Guidance: Framing property-directed generation as an RL problem provides a more stable alternative to the finicky guidance mechanisms used in traditional diffusion models.

Key Results

GGFlow sets a new state-of-the-art (SOTA) across multiple metrics, including Frechet ChemNet Distance (FCD) and structural similarity (NSPDK).

Quantitative performance of GGFlow compared to state-of-the-art baselines on QM9 and ZINC250k datasets. GGFlow achieves superior validity and distributional accuracy with fewer sampling steps.

On the ZINC250k dataset, GGFlow achieved superior results in 500 steps, whereas many diffusion baselines required 1000 steps. In conditional tasks, the RL-guided GGFlow achieved a Mean Absolute Error (MAE) of 0.672, significantly outperforming guided versions of models like DiGress (1.092).

Limitations and Future Work

The primary bottleneck for GGFlow is the $O(N^3)$ complexity of the triangle attention mechanism in GraphEvo. While effective for small to medium molecules, this scaling poses challenges for larger structures like proteins. Future research will focus on optimizing these attention mechanisms and exploring multi-objective RL for complex drug design scenarios.

Summary updated

BibTeX
@misc{hou2024improving,
  author = {Xiaoyang Hou and Tian Zhu and Milong Ren and Dongbo Bu and Xin Gao and Chunming Zhang and Shiwei Sun},
  title = {{Improving Molecular Graph Generation with Flow Matching and Optimal Transport}},
  year = {2024},
  eprint = {2411.05676},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.05676},
}
Figure