Electron flow matching for generative reaction mechanism prediction obeying conservation laws

Joonyoung F. Joung, Mun Hong Fong, Nicholas Casetti, Jordan P. Liles, Ne S. Dassanayake, Connor W. Coley

TL;DR

This paper introduces FlowER, a novel deep generative model that predicts chemical reaction mechanisms by focusing on electron redistribution. Crucially, FlowER enforces mass and electron conservation, overcoming a major limitation of previous models that often "hallucinate" atoms or violate fundamental chemical laws. This leads to more physically consistent and interpretable predictions, enabling better reaction design and discovery.

What Problem Does This Paper Address?

Predicting chemical reactions is a cornerstone of chemistry, but current data-driven models often struggle with a fundamental principle: mass conservation. This means they can predict impossible outcomes, like creating or destroying atoms, which limits their reliability for chemists. Existing models often treat reactions as black boxes, predicting the final product without understanding the step-by-step mechanistic process. This lack of mechanistic insight hinders our ability to design new reactions or understand why certain outcomes occur. The authors aim to bridge this gap by developing a model that not only predicts reaction outcomes but also generates physically consistent, step-by-step mechanisms that adhere to conservation laws.

Methods

The core innovation is the use of flow matching, a modern generative modeling technique, to frame reaction prediction as an electron redistribution problem. Instead of predicting products directly, FlowER models the continuous flow of electrons from reactants to products. This is achieved by representing molecules and their electron configurations using a Bond-Electron (BE) matrix.

Key methodological aspects include:

  • Flow Matching for Electron Redistribution: The model learns a mapping that transforms the electron distribution of reactants (prior) to that of products (target). This inherently enforces conservation.
  • BE Matrix Representation: This matrix captures the number of shared electrons between atoms and lone pairs, providing a detailed electronic state representation.
  • Graph Transformer Architecture: A deep learning architecture is used to process the BE matrix and atom features, predicting changes in electron distribution.
  • Conditional Flow Matching (CFM): This technique allows the model to learn the complex transformation by conditioning on reactant-product pairs, making the learning tractable.
  • Sum-Safe Rounding and Validity Fixes: Post-processing steps are employed to convert continuous BE matrix predictions back into discrete, chemically valid molecular structures while ensuring electron conservation.

Datasets

  • USPTO-Full Dataset: A large dataset of approximately 1.1 million experimentally demonstrated reactions from patents was used as the foundation.
  • Mechanistic Dataset: The authors developed a new dataset by imputing mechanistic pathways for a subset of USPTO-Full reactions. This dataset comprises 1,413,515 elementary reaction steps across 252 reaction classes and 185 distinct mechanisms.
  • External Databases: Data from RMechDB and PMechDB were integrated to augment the dataset.

Key Insights and Ideas

  • Conservation as a Foundation: The paper strongly argues that enforcing fundamental laws like mass conservation is not just about accuracy but also about building trust and interpretability in AI models for chemistry.
  • Electron Flow as a Mechanistic Language: Reframing reactions as electron flow provides a natural link to traditional arrow-pushing mechanisms, making the model's predictions more intuitive for chemists.
  • Generative Models for Mechanistic Exploration: Flow matching's probabilistic nature allows FlowER to propose multiple plausible reaction pathways, akin to exploring branching mechanistic networks.
  • Data Efficiency Through Mechanistic Understanding: By focusing on elementary steps and conservation, FlowER demonstrates remarkable performance even with very limited fine-tuning data for new reaction types.

Key Results

  • High Conservation Rates: FlowER achieves near-perfect validity, heavy atom conservation, proton conservation, and electron conservation, significantly outperforming sequence-based models (e.g., Graph2SMILES) which often violate these principles.
  • Accurate Mechanistic Prediction: FlowER recovers complete mechanistic sequences and demonstrates strong top-k step and pathway accuracies, comparable to or exceeding existing methods.
  • Generalization to Unseen Reactions: With only 32 examples, FlowER can be fine-tuned to achieve high accuracy on previously unseen reaction types, showcasing impressive sample efficiency.
  • Interpretability and Chemical Intuition: The model's predictions align with textbook chemistry principles and enable thermodynamic feasibility estimations.
  • Resolution of "Hallucinatory" Failures: FlowER avoids common errors like predicting impossible atoms or incorrect electron counts, leading to more reliable predictions.

Limitations and Future Work

  • Handling of Continuous Variables: While FlowER represents catalysts and agents in the BE matrix, it doesn't explicitly account for continuous variables like temperature or concentration.
  • Dataset Biases: The model's performance can be influenced by biases in the training data, as seen with certain bases where specific reaction types were underrepresented.
  • Fine-tuning Challenges: Transamidation proved to be a particularly challenging reaction type for fine-tuning, suggesting areas for further model improvement.

Future work could involve expanding the dataset to address biases, incorporating more explicit handling of reaction conditions, and further developing the model's ability to predict complex multi-step reactions. The authors also suggest that FlowER's conservation-aware formulation makes it ideal for seamless integration with downstream quantum chemical calculations for automated feasibility assessments.

Summary updated

Abstract

Central to our understanding of chemical reactivity is the principle of mass conservation, which is fundamental for ensuring physical consistency, balancing equations, and guiding reaction design. However, data-driven computational models for tasks such as reaction product prediction rarely abide by this most basic constraint. In this work, we recast the problem of reaction prediction as a problem of electron redistribution using the modern deep generative framework of flow matching. Our model, FlowER, overcomes limitations inherent in previous approaches by enforcing exact mass conservation, thereby resolving hallucinatory failure modes, recovering mechanistic reaction sequences for unseen substrate scaffolds, and generalizing effectively to out-of-domain reaction classes with extremely data-efficient fine-tuning. FlowER additionally enables estimation of thermodynamic or kinetic feasibility and manifests a degree of chemical intuition in reaction prediction tasks. This inherently interpretable framework represents a significant step in bridging the gap between predictive accuracy and mechanistic understanding in data-driven reaction outcome prediction.
BibTeX
@inproceedings{joung2025electron,
  author = {Joonyoung F. Joung and Mun Hong Fong and Nicholas Casetti and Jordan P. Liles and Ne S. Dassanayake and Connor W. Coley},
  title = {{Electron flow matching for generative reaction mechanism prediction obeying conservation laws}},
  booktitle = {Nat},
  year = {2025},
  url = {https://openreview.net/forum?id=2pnyajRGJo},
}
Figure