arXiv:2608.27429cs.AIAug 2026

Manuscript Offprint

arXiv:2608.27429

Mechanistic Reaction Prediction via Discrete Flow Matching on Graph-Structured Electron Occupation

Nguyen Xuan-Vu, Octavian Susanu, Daniel Armstrong, Philippe Schwaller

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Chemical reactions are fundamentally transformations in electron space, yet most machine learning approaches model them either through de novo generation of product molecules or through heuristic graph edits that operate directly on molecular topology. We introduce MAELLE (MechAnistic Edit fLow-matching on eLectron rEarrangements), which instead models reactions as discrete flow matching over electron occupation vectors. Concretely, we formulate the reactant-to-product mapping as a Continuous-time Markov Chain (CTMC) over the graph-structured integer-valued electron occupation space defined on all bonding, non-bonding, and hydrogen sites. To construct the interpolants between the reactants and products, we generalize the discrete flow matching mixture path to an edit-based formulation, where the electron moves are interpolated using Optimal Transport, yielding a mechanism-like set of moves without elementary step annotations. MAELLE achieves competitive performance on the USPTO-480K benchmark compared with leading reaction prediction models. Beyond in-distribution accuracy, we evaluate robustness across two out-of-distribution settings - structural complexity and reaction type - and find that MAELLE maintains strong performance where existing methods degrade. Finally, because the learned flow operates over the full electron redistribution, MAELLE naturally recovers mechanistic trajectories that align with known chemistry and can predict side products of a reaction.

1 Introduction

Predicting the outcome of a chemical reaction is one of the central problems at the interface of chemistry and machine learning, with consequences for drug discovery, materials design, and the broader question of how to realize a target molecule once it has been proposed [1, 2]. The space of possible reactions is larger than the already intractable space of drug-like molecules, and a single retrosynthetic plan may chain together a dozen or more steps, each of which must succeed for the route to be viable [3]. Reliable prediction, with calibrated uncertainty, is therefore a prerequisite for automating any meaningful portion of synthetic chemistry.

Reaction prediction has cycled through a succession of representations, each reflecting the dominant ML paradigm of its moment: fixed molecular fingerprints classified by similarity [4, 5, 6, 7]; SMILES-to-SMILES translation with sequence and Transformer models [8, 9]; hybrid graph-encoder/SMILES-decoder architectures [10, 11]; and, most recently, generative graph-edit approaches that produce the product by editing the reactant graph directly [12, 13].

All of these approaches treat reactions as opaque input-to-output mappings, offering no account of the underlying transformation, while chemists reason via arrow-pushing diagrams that track electron flow between donor and acceptor sites [14]. As black-box predictors, they are exposed to spurious shortcuts in USPTO – patent-level stylistic signatures [15] and substrate-level cues (e.g., a single free

Preprint.

a.

Figure

b.

d.

C.

e.

Figure 1: Conceptual overview of MAELLE: a. MAELLE's sampling process with mechanism-like trajectories that model the transition from reactants to products as CTMC. b. The three elementary actions on electrons, FLOW, DEL, and ADD, demonstrated on an oxidation and a reduction reactions. At training time: c. Electron actions are interpolated using OT; d. interpolant graphs are sampled by sampling a subset of electron moves and applying them to the reactant graphs. e. MAELLE model architecture and learning objective.

hydroxyl among protected ones telegraphing an alcohol-selective transformation). Top-k accuracy on standard benchmarks therefore conflates first-principles reactivity reasoning with exploitation of such shortcuts, making out-of-distribution evaluation a more faithful test [16, 17, 18].

A few recent works have sought to incorporate mechanistic reasoning into reaction prediction. Early work by Kayala et al. [19] and Kayala and Baldi [20] pioneered the prediction of reactions at the mechanistic level by learning electron-flow patterns, decomposing the problem into identifying reactive sites and predicting electron sources and sinks. Bradshaw et al. [21] later extended this direction with a GNN-based model that predicts elementary steps for reactions with linear electron flow (LEF) topology, though this restricts coverage to a subset of reaction mechanisms. More recently, Joung et al. [22] model electron redistribution via continuous flow matching over bond-electron (BE) matrices, but require mechanistic trajectories imputed from expert-curated templates [23, 24, 25], limiting scalability to new reaction types.

In this work, we introduce MAELLE (MechAnistic Edit fLow-matching on eLectron rEarrangements), which models reactions as discrete flow matching (DFM) over integer-valued electron occupation vectors defined on the molecular graph (Figure 1). MAELLE formulates reaction prediction as a Continuous-time Markov Chain (CTMC) in the electron space: given a reactant, the model learns a rate function that drives the electron occupation from the reactant state to the product state through a sequence of sparse, interpretable edit moves, without requiring elementary step annotations. The intermediate trajectory is constructed via optimal transport over electron sites, and the mixture path factorizes over an auxiliary move-state space, enabling tractable training through the discrete flow matching framework.

Our contributions are: (i) we generalize DFM to graph-structured electron spaces with three chemistry-aware edit operations (flow, deletion, addition), and lift the problem to an auxiliary move-state space derived from optimal transport over electron occupations, yielding a factorized mixture path with tractable training and no need for elementary-step labels; (ii) on USPTO-480K we are competitive with the best SMILES- and graph-edit baselines, and on out-of-distribution splits along molecular weight and reaction type we outperform all baselines; (iii) framing reaction prediction generatively gives MAELLE calibrated, ranked product predictions, enabling side-product prediction validated by LLM-as-judge plausibility.

Table 1: Comparison of reaction prediction approaches.

MethodInputOutputMech. step label-freeDirectional elec. re-dist.Broad coverageAtom conservative
Molecular Transformer [9]SMILESSMILES✓✕✓✕
Graph2SMILES [11]SMILESSMILES✓✕✓✕
Chemformer [26]SMILESSMILES✓✕✓✕
MEGAN [12]GraphGraph edits✓✕✓✕
GTPN [13]GraphGraph edits✓✕✓✓
NERF [27]GraphElectron re-dist.✓✕✓✓
FlowER [22]GraphElectron re-dist.χ†\chi^{\dagger}✓χ†\chi^{\dagger}✓
ELECTRO [21]GraphElectron re-dist.✓✓χ‡\chi^{\ddagger}✓
MAELLE (ours)GraphElectron re-dist.✓✓✓✓§\checkmark^{\S}

†^{\dagger} FlowER covers 86 expert-curated reaction types and requires a mechanistic dataset with imputed elementary steps.

‡^{\ddagger} ELECTRO is restricted to reactions with linear electron flow topology.

§^{\S} MAELLE is heavy-atom conservative because protonation and deprotonation are simplified.

References (46)