Navigating Chemical Space with Latent Flows

Guanghao Wei, Yining Huang, Chenru Duan, Yue Song, Yuanqi Du

TL;DR

ChemFlow is a new framework that treats molecule discovery as a dynamical system, navigating the latent space of generative models using vector fields inspired by physical partial differential equations (PDEs). By incorporating priors like wave and heat equations, it enables more efficient, diverse, and controllable exploration of the vast chemical space for drug and materials design.

What Problem Does This Paper Address?

The "chemical space"—the set of all possible drug-like molecules—is estimated to contain between $10^{23}$ and $10^{60}$ compounds. While deep generative models like Variational Autoencoders (VAEs) can learn to represent this space, simply sampling random molecules is insufficient for practical discovery. Researchers need to navigate this space to find molecules with specific properties (e.g., high binding affinity, low toxicity) while maintaining structural diversity.

Previous approaches were often limited: linear traversals assume the latent space is simpler than it actually is, while standard gradient-based optimization can get stuck in local minima or produce "out-of-distribution" molecules that are chemically nonsensical. ChemFlow addresses these gaps by providing a unified, physically grounded framework for latent space traversal.

Methods

The core idea of ChemFlow is to model the movement through latent space as a "flow" governed by a vector field. The authors introduce a dynamical system perspective where they learn a potential energy function $\phi$ whose gradient defines the direction of travel.

Key technical innovations include:

  • Physical PDE Priors: Instead of simple linear paths, ChemFlow can incorporate dynamics from physics:
  • Hamilton-Jacobi Flows: Based on optimal transport theory to find the "shortest path" to a target property.
  • Wave Flows: Use second-order wave equations to produce highly diverse and realistic trajectories.
  • Langevin Dynamics: Inspired by the Fokker-Planck equation, this allows for global optimization, helping the search process escape local minima.
  • Supervised vs. Unsupervised Guidance:
    • In supervised settings, a surrogate model (property predictor) guides the flow toward desired traits.
  • In unsupervised settings, the authors introduce Jacobian structural change guidance. This identifies directions that cause the maximal change in the generated molecule's structure, which often correlates with significant property changes even without explicit labels.
The ChemFlow framework unifies supervised property prediction and unsupervised structural change to navigate latent space.

Datasets

The models were trained and evaluated using three major molecular datasets:

  • MOSES: A benchmarking platform for molecular generation.
  • ZINC250K: A subset of the ZINC database containing ~250,000 commercially available compounds.
  • ChEMBL: A large database of bioactive molecules with drug-like properties (~2.4M molecules).

Molecules were represented using SELFIES strings, a robust alternative to SMILES that ensures generated strings almost always correspond to valid chemical structures. The authors evaluated eight properties, ranging from simple physicochemical metrics (plogP, QED) to complex protein-ligand docking scores (ESR1, ACAA1).

Key Insights and Ideas

  • Unification of Paradigms: The authors show that previous methods like linear traversal and gradient descent are actually special cases of their flow-based framework.
  • The Power of Langevin Dynamics: For global optimization, Langevin Dynamics (LD) proved exceptionally effective. By adding a noise term (simulating "temperature"), the model can push the entire distribution of molecules toward better property values more effectively than deterministic methods.
  • Unsupervised Discovery via Jacobian Control: One of the most striking findings is that you can find meaningful property-changing directions without any property labels. By simply looking for where the generator's output is most sensitive to latent changes (the Jacobian), the model identifies key structural levers that chemists care about.
  • Latent Norm Correlations: The authors discovered a strong correlation between the norm (length) of latent vectors and molecular properties like Synthetic Accessibility (SA). This suggests that the "geometry" of the learned latent space inherently encodes chemical complexity.

Key Results

  • Optimization Performance: Langevin Dynamics (LD) consistently outperformed baselines in shifting the distribution of molecules toward higher property values. As seen in the convergence plots, LD achieves faster and greater improvements in properties like plogP compared to standard gradient flow.
  • Docking Success: ChemFlow successfully generated ligands with high binding affinities for target proteins ESR1 and ACAA1, producing realistic 3D docking configurations.
Figure 2: Visualization of generated ligands docked against target ESR1 and ACAA1.
  • Distribution Shifts: The framework demonstrated the ability to smoothly transition a population of molecules from low-property regions to high-property regions while maintaining structural validity.
Distribution shifts for plogP optimization across different flow types, highlighting how Langevin Dynamics effectively pushes the entire mass toward higher values.

Limitations and Future Work

The authors acknowledge that this is a preliminary study focused on small molecules. A major next step is scaling these latent flows to larger, more complex systems like proteins or crystals. Additionally, while the flows are smooth, the underlying VAE latent space can still be "patchy," leading to Out-of-Distribution (OoD) issues during long optimization runs. Future work may involve extending this framework to other data modalities, such as natural language or multi-modal scientific data.

Summary updated

Abstract

Recent progress of deep generative models in the vision and language domain has stimulated significant interest in more structured data generation such as molecules. However, beyond generating new random molecules, efficient exploration and a comprehensive understanding of the vast chemical space are of great importance to molecular science and applications in drug design and materials discovery. In this paper, we propose a new framework, ChemFlow, to traverse chemical space through navigating the latent space learned by molecule generative models through flows. We introduce a dynamical system perspective that formulates the problem as learning a vector field that transports the mass of the molecular distribution to the region with desired molecular properties or structure diversity. Under this framework, we unify previous approaches on molecule latent space traversal and optimization and propose alternative competing methods incorporating different physical priors. We validate the efficacy of ChemFlow on molecule manipulation and single- and multi-objective molecule optimization tasks under both supervised and unsupervised molecular discovery settings. Codes and demos are publicly available on GitHub at https://github.com/garywei944/ChemFlow.
BibTeX
@inproceedings{wei2024navigating,
  author = {Guanghao Wei and Yining Huang and Chenru Duan and Yue Song and Yuanqi Du},
  title = {{Navigating Chemical Space with Latent Flows}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=aAaV4ZbQ9j},
}
Figure