Generative AI

Reasoning Through Molecular Synthetic Pathways with Generative AI

A recurring challenge in molecular design, whether for pharmaceutical, chemical, or material applications, is creating synthesizable molecules. Synthesizability assessment often requires mapping the synthesis pathway for a molecule: the sequence of chemical reactions needed to transform precursor molecules into the target product molecule. This post introduces ReaSyn, a generative model from NVIDIA designed for predicting molecular synthesis pathways that also addresses limitations in current approaches.

Why chain-of-thought reasoning matters for AI in chemistry

Large language models (LLMs) have become integral to daily life, powering applications from virtual assistants to complex problem-solving. Modern LLMs solve complex problems by generating a chain of thought (CoT), which is a series of intermediate reasoning steps that lead to a final answer. Combining CoT and test-time search methods, such as generating multiple CoT paths, are critical to the improved accuracy of recent LLMs.

Chemistry faces a similar challenge in molecular synthesis pathway prediction, where a pathway contains a series of intermediate synthesis steps. Pathway prediction is a critical step in drug, chemical, and materials development because a molecule, however promising, is only valuable if it can‌ be synthesized. ReaSyn is a novel generative framework that efficiently predicts molecular synthesis pathways. It uses a unique chain of reaction (CoR) notation, inspired by the CoT approach in LLMs, combined with a test-time search algorithm.

ReaSyn: treating synthetic pathways as CoR

A synthetic pathway follows a bottom-up tree structure: simple molecules, or building blocks (BB), are combined through chemical reactions (RXN) to produce intermediate products (INT), which in turn undergo further reactions to form increasingly complex molecules (Figure 1). This process is multi-step, with each reaction applied to reactants that may be either building blocks or intermediates. In practice, chemists deduce such pathways step-by-step, reasoning through each transformation to reach the final target molecule.

Construction of CoR notation by flattening synthetic trees into sequences composed of building blocks, reaction types, and intermediate products
Figure 1. CoR notation views synthetic pathways as CoT reasoning paths

ReaSyn captures this step-by-step reasoning through its CoR notation, inspired by the CoT approach in LLMs. In CoR, an entire synthetic pathway is represented as a linear sequence where each step explicitly includes the reactants, the reaction rule, and the resulting product. Reactants and products are encoded as SMILES (strings, wrapped with special tokens marking their boundaries), while each reaction is denoted by a single reaction-class token. This representation not only mirrors how chemists think about synthesis but also enables the model to receive intermediate supervision at every step for richer learning of chemical reaction rules and more reliable multi-step pathway generation.

ReaSyn's encoder-decoder Transformer architecture that encodes a target molecule and autoregressively decodes its synthetic pathway.
Figure 2. The overall framework of ReaSyn

Building on the CoR notation and its sequential design, ReaSyn operates as an autoregressive generative model (Figure 2) that treats synthetic pathways as reasoning chains—each step corresponding to a single chemical reaction. Just as CoT reasoning in LLMs produces intermediate steps before a final answer, ReaSyn incrementally constructs a pathway starting from simple building blocks to a target molecule. This enables it to reconstruct pathways for synthesizable molecules and to project unsynthesizable molecules into synthesizable chemical space, producing close synthesizable analogs that can be made in practice.

After the model predicts the reactants and reaction rules at each step, intermediate products can be easily obtained using a reaction executor such as RDKi. This intermediate information not only provides richer training signals for the model to learn chemical rules, but also guides the synthetic pathway generation process.

Enhancing pathway generation: applying LLM reasoning strategies

Viewing synthetic pathway generation as LLM reasoning also enables us to adopt additional LLM reasoning techniques such as reinforcement learning (RL) finetuning and test-time search. ReaSyn explores these two techniques for synthetic pathway generation.

How outcome-based RL finetuning improves exploration

There can be multiple pathways that lead to the same product molecule. ReaSyn benefits from sampling various synthetic pathways and getting feedback via GRPO). The outcome-based reward for a pathway is set to the molecular similarity between its end-product molecule and the input molecule. As the reward is only applied to the outcome, instead of the reasoning steps, the model is endowed with the ability to explore diverse synthetic pathways.

ReaSyn’s RL finetuning process that uses the GRPO algorithm with similarity to the target molecule as the reward
Figure 3. Reinforcement learning (RL) finetuning of ReaSyn using GRPO

Goal-directed search: guiding pathways

During generation, ReaSyn uses beam search, which maintains a pool of sequences being generated and expands them block-by-block (BB or RXN). The search enables ReaSyn to generate diverse pathways for a single input molecule, and guides the generation in a preferred direction by scoring the sequences through a reward function. In retrosynthesis planning, the reward function can be the similarity to the input molecule. In goal-directed optimization tasks, the reward function can be the desired chemical property.

ReaSyn’s block-wise beam search guided by a reward model
Figure 4. Goal-directed test-time search of ReaSyn

Generating synthetic pathways with ReaSyn

ReaSyn’s synthesizable projection is highly versatile: it enables retrosynthesis planning, suggests analogs for unsynthesizable molecules, supports goal-directed molecular optimization, and facilitates synthesizable hit expansion. Below, we examine its performance on these tasks.

Retrosynthesis planning

MethodEnamineChEMBLZINC250k
SynNet25.27.912.6
SynFormer63.518.215.1
ReaSyn76.821.941.2
Table 1. Retrosynthesis planning success rates (%)

Even given a vast synthesizable space, previous synthesizable molecule generation methods have struggled to cover this space extensively. ReaSyn shows a high success rate in generating synthetic pathways given synthesizable molecules, demonstrating its powerful explorability in the synthesizable chemical space.

Synthesizable goal-directed molecular optimization

MethodOptimization score
DoG-Gen0.511
SynNet0.545
SynthesisNet0.608
Graph GA-SF0.612
Graph GA-ReaSyn0.638
Table 2. Average synthesizable optimization scores of 15 PMO molecular optimization tasks

ReaSyn can project molecules generated by an off-the-shelf molecular optimization method to perform synthesizable goal-directed optimization. Combined with Graph GA, Graph GA-ReaSyn shows higher optimization performance than previous synthesis-based methods.

Synthesizable hit expansion: exploring molecule neighborhoods

The search scheme enables ReaSyn to suggest multiple synthesizable analogs for a given target molecule by projecting them differently. ReaSyn explores the neighborhood of given molecules in synthesizable space, and can be applied to hit expansion to find diverse synthesizable analogs of hit molecules (Figure 5).

Examples of generated molecules that maintain similarity to the input hit while exhibiting improved target properties compared to the input
Figure 5. Synthesizable hit expansion with ReaSyn

Empowering drug discovery with advanced reasoning

Most generative models create molecules that aren’t synthesizable in practice. ReaSyn builds on recent reasoning advances in LLMs, equipping scientists with an effective generative tool to project small molecules into the synthesizable chemical space. With its enhanced reasoning capabilities, diversity, and versatility, ReaSyn shows promise as a means for navigating combinatorially large synthesizable chemical space in real-world drug discovery.

Find out more about ReaSyn by reading our paper on arXiv and the code is available on GitHub.

Discuss (0)

Tags