AI-guided synthetic route search — building an optimal path from target molecule back to purchasable reagents via tree search
Retrosynthetic analysis, formalized by E.J. Corey in the 1960s, works backward from a target molecule toward simple, purchasable starting materials by iteratively "disconnecting" bonds. Framed as search, the target sits at the root of a tree; each path from root to a set of leaves represents a candidate synthetic route, and the number of theoretically possible routes for a typical drug-like molecule is far larger than can ever be enumerated by hand.
E.J. Corey introduced the concept of the "synthon" — an idealized structural fragment produced by a mental, formal bond disconnection of the target molecule, as opposed to the real chemical reagent ("synthetic equivalent") that would be used in the lab. A target molecule is decomposed synthon-by-synthon in reverse, each disconnection corresponding to the reverse of a real forward reaction (e.g. a retro-Diels-Alder, a retro-aldol, a retro-amide-coupling).
This reframes synthesis planning as a search problem: starting at a root node (the target), each "move" is a legal disconnection, each resulting state is a new set of simpler precursor molecules, and the goal is to reach a terminal state where every fragment is a commercially available, in-stock reagent — a leaf of the tree.
Corey formalized this into "LHASA" (Logic and Heuristics Applied to Synthetic Analysis) in the 1960s-70s, the first computer-assisted synthesis design program, encoding expert disconnection rules by hand. It proved the concept but scaled poorly — hand-coded rule sets could not keep pace with the combinatorial explosion of real chemical space.
A molecule with even 30 heavy atoms typically has dozens of chemically reasonable bonds that could be disconnected at each step, and each disconnection can be achieved by several different reaction types and reagent choices. Multiply this branching factor across a route of 5–8 sequential steps and the number of candidate complete routes grows combinatorially — commonly estimated in excess of 10¹² for a moderately complex drug-like target.
Expert chemists prune this space intuitively using experience: which disconnections lead to stable, isolable intermediates; which reactions are high-yielding and scalable; which starting materials are cheap and available in bulk. Encoding this intuition computationally — rather than relying on a human to explore the tree — is exactly the problem that modern retrosynthesis AI systems are built to solve.
A single drug-like target can have an estimated search space on the order of 10¹² candidate synthetic routes — far beyond what any chemist, or any brute-force algorithm, could exhaustively enumerate. Intelligent tree search is not a convenience here; it is a necessity.
Modern computer-aided synthesis planning (CASP) systems reframe retrosynthesis explicitly as a sequential decision problem suited to reinforcement learning: the "state" is the current set of unsolved molecules, the "action" is choosing a molecule and applying a one-step disconnection to it, and the "reward" is sparse — received only when a complete route to buyable starting materials is found, scaled by how good that route is.
This root-node framing is the entry point for everything that follows: a single-step retrosynthesis model proposes candidate actions (Stage 2), a search algorithm explores and expands the resulting tree (Stage 3), a stopping criterion recognizes when a branch is solved (Stage 4), and a scoring policy selects the best complete route among many (Stage 5).
A subtlety of retrosynthesis search distinguishes it from a simple game tree like chess or Go: each disconnection typically breaks one molecule into multiple precursor fragments, and every one of those fragments must independently be solved for the branch to count as complete. This makes the true structure an "AND-OR tree" rather than a plain OR-tree — an OR-node (the molecule; any one of several proposed disconnections can be chosen) alternates with AND-nodes (the resulting precursor set; every child must be solved).
This root node in Stage 1 is therefore the very first OR-node of a much larger AND-OR structure that Monte Carlo Tree Search must navigate — a detail that materially changes how value estimates need to be computed and propagated, since a branch is only as strong as its weakest simultaneous precursor.
At every node of the search tree, a trained single-step retrosynthesis model proposes a ranked list of plausible disconnections — reactions that could have produced this molecule from simpler precursors. Two dominant model families do this: template-based systems that match and rank pre-extracted reaction rules, and template-free neural models that generate precursor structures directly, token by token or graph edit by graph edit.
Template-based models extract reaction "templates" — generalized SMARTS patterns describing which bonds break and form — automatically from large reaction databases such as USPTO (US patent literature, ~1.8M reactions) or the commercial Reaxys database (tens of millions of reactions). Extracted template libraries commonly exceed 100,000 distinct rules.
Given a target molecule, the model (often a neural network, e.g. a graph convolutional or feed-forward network over molecular fingerprints) ranks which templates are applicable and predicts the resulting precursor set for each. Because templates are drawn from real literature precedent, template-based predictions are inherently interpretable and grounded in known chemistry — a key advantage for chemist trust and lab feasibility.
The weakness: template libraries can only reproduce reaction types seen in the training data. Truly novel bond disconnections, or reactions from underrepresented areas of chemical space, fall outside template coverage entirely.
Template-free models treat retrosynthesis as a sequence-to-sequence or graph-to-graph translation problem, learning to generate precursor molecules directly without any explicit rule library. The Molecular Transformer (Schwaller et al., 2019) applies the standard Transformer architecture from NLP to reaction SMILES strings, achieving ~90% top-1 accuracy on forward reaction prediction and demonstrating that chemistry can be learned as a translation task between molecular "languages."
For the harder, more ambiguous reverse direction (retrosynthesis — one product can map to many valid precursor sets), template-free single-step accuracy is typically lower, in the 45–65% top-1 range on standard benchmarks, though newer graph-edit and semi-template hybrid models continue to close this gap.
Template-free models generalize better to reaction types absent from any fixed template library, at the cost of occasionally proposing chemically implausible transformations that require downstream filtering.
Both model families output a ranked list — typically the top-10 or top-50 candidate disconnections per node — rather than a single prediction. This ranked list becomes the branching factor of the search tree that Monte Carlo Tree Search explores in the next stage.
A single-step model alone cannot solve a synthesis problem — it only proposes one disconnection at a time, without any notion of whether a resulting precursor is itself easy or hard to make. Turning a single-step model into a full retrosynthesis planner requires wrapping it in a multi-step search procedure that recursively applies it to every newly generated precursor, while tracking which branches are promising and which should be abandoned. That search procedure — Monte Carlo Tree Search guided by reinforcement learning — is the subject of the next stage.
With a single-step model able to propose disconnections at any node, the central algorithmic challenge becomes deciding which nodes to expand next, out of a tree that could otherwise branch out infinitely. Monte Carlo Tree Search (MCTS), guided by a learned value network, is the algorithm that made large-scale multi-step retrosynthesis planning computationally tractable — the same core idea used by AlphaGo, adapted to chemistry.
MCTS explores the retrosynthesis tree through repeated simulations, each following four phases:
1. Selection: starting at the root, descend the tree choosing children according to a policy that balances exploitation (nodes with high estimated value) against exploration (nodes visited rarely so far) — typically via a UCT (Upper Confidence bound applied to Trees) formula.
2. Expansion: at a leaf of the current search tree, the single-step retrosynthesis model (Stage 2) is called to generate new candidate child nodes — new sets of precursor molecules.
3. Evaluation: a value network estimates how "solvable" the new node is — roughly, how likely a short, high-yielding, cheap route exists from this set of precursors back to purchasable reagents — without having to actually search all the way down.
4. Backpropagation: the estimated value is propagated back up the path to the root, updating the running value estimates of every ancestor node, which then informs the next simulation's selection phase.
Repeating this loop hundreds to thousands of times concentrates search effort on the most promising regions of an otherwise intractably large tree.
The landmark 2018 Nature paper "Planning chemical syntheses with deep neural networks and symbolic AI" (Segler, Preuss, Waller) combined three neural networks with MCTS: an expansion policy network trained on ~12.4M reactions to propose likely disconnections, a rollout policy for fast simulation to a full route during search, and a value network trained via self-play-style reinforcement learning to estimate node quality — directly analogous to the policy and value networks in AlphaGo.
In blinded tests, chemists could not reliably distinguish AI-proposed routes from those published in the literature, and rated many AI routes as equally or more efficient. This was the first strong demonstration that deep learning plus tree search could match expert-level synthesis planning performance on real, non-trivial drug-like targets.
Segler et al. reported that their neural-network-guided MCTS solved target molecules roughly 30× faster than the traditional rule-based expert system it was benchmarked against, while finding routes that working chemists judged comparable in quality to published literature syntheses.
The exploration/exploitation trade-off has a very concrete chemical meaning in this setting. Pure exploitation — always expanding the currently best-valued node — risks tunneling deep into one narrow disconnection strategy that may later dead-end at an exotic, unpurchasable fragment. Pure exploration — spreading search evenly across many candidate branches — wastes computation on obviously poor disconnections and may never search deep enough to reach any purchasable building block.
Well-tuned MCTS implementations (as reflected in the "Exploration ↔ Exploitation" control in this simulation) bias search toward deep, focused expansion of high-value nodes while retaining enough exploration probability to occasionally sample a structurally novel branch — mirroring how an experienced chemist keeps a "backup route" in mind even while pursuing their primary hypothesis.
A branch of the search tree is only "solved" once every molecule at its terminal nodes is available for purchase — a commercially catalogued building block rather than a molecule that itself requires further synthesis. Checking this condition against large, regularly updated chemical inventory databases is what turns an open-ended search into one with a well-defined stopping rule and a finite, verifiable answer.
In practical retrosynthesis planning, a node is treated as solved — and expansion along that branch stops — the moment the molecule at that node matches an entry in a curated building-block inventory: a catalog of reagents that a chemist can simply order from a supplier rather than needing to synthesize. This check is typically a fast exact-structure or canonical-SMILES lookup against a pre-indexed database, taking milliseconds even against catalogs of tens of millions of compounds.
Without this stopping criterion, a search tree could in principle expand forever, recursively "synthesizing" precursors down to individual atoms. The building-block check is what converts an infinite search into a finite, well-posed planning problem with a concrete, actionable answer: an ordered list of reagents a chemist can buy today.
Several large commercial and public databases serve this role in real retrosynthesis tools:
• eMolecules — aggregates catalogs from hundreds of chemical suppliers, indexing more than 20 million purchasable compounds with pricing and delivery-time metadata.
• Enamine — beyond a large traditional in-stock building-block catalog (over a million compounds), Enamine's REAL Space on-demand virtual catalog covers billions of synthesizable-on-request molecules, though these carry longer lead times than true in-stock items.
• ZINC (ZINC15/ZINC20) — a free, public database aggregating purchasable compounds across many vendors, widely used both for virtual screening and as a stock-check reference in academic retrosynthesis tools such as AiZynthFinder.
Production planning tools typically combine multiple sources and apply additional filters — price ceiling, delivery-time ceiling, minimum purity — so that a node is only marked solved if a building block is not just theoretically purchasable, but practically obtainable within the project's real-world constraints.
AiZynthFinder, the widely used open-source retrosynthesis planner from AstraZeneca, ships with a pre-built stock-check module against a ZINC-derived building-block set — a node is pruned to a solved leaf the instant its molecule appears in that reference inventory, letting the MCTS search terminate branches almost as fast as it can expand them.
How strict or lenient the building-block check is has a large practical effect on route quality. A very permissive inventory (accepting any theoretically synthesizable compound) yields short routes on paper but may recommend "building blocks" with multi-month lead times or prohibitive cost. A very strict inventory (only same-day-shippable reagents) forces the search deeper, generating longer but more immediately actionable routes.
Modern planners increasingly weight the stopping decision by cost and lead time rather than treating it as strictly binary — feeding those same signals into the reward function used for final route scoring, which is the subject of the next and final stage.
A completed MCTS search typically discovers many distinct complete routes — root-to-leaves paths where every terminal node is a building block. The final task is choosing the single best route among them, using a reward function that combines route length, predicted reaction feasibility or yield, and the total cost of starting materials, so the recommendation reflects what a bench chemist would actually want to run.
Once the search tree contains one or more fully solved root-to-leaf routes, each is scored by a reward function that typically combines several factors into a single number: route length (fewer steps is generally preferred, since yield losses compound multiplicatively across steps), predicted per-step feasibility or yield (from the confidence score of the single-step model, or a separate reaction-outcome predictor), and the total cost and availability of the starting building blocks at the leaves.
A route with very high average per-node "value" (as tracked by the MCTS value network) but many steps may still score lower than a shorter, slightly less confident route, because compounding a 70% yield across seven sequential steps leaves an overall yield below 10%. Reward functions in production planners are tuned to reflect this real compounding cost of long linear syntheses.
The selected optimal route is presented to a chemist as an ordered sequence of reactions, from purchasable starting materials up to the target molecule (the reverse of the search direction), typically alongside the model's confidence at each step and links to literature precedent for the underlying reaction templates where available.
Because single-step models can occasionally propose chemically implausible transformations, most production pipelines run additional filters after route selection — checking for functional group incompatibilities across steps, verifying no protecting-group conflicts, and in the most rigorous setups, validating the top-ranked route computationally with a reaction-outcome predictor or, ultimately, in the physical lab.
In benchmark evaluations against sets of complex, real-world drug-like targets, AiZynthFinder-style neural-MCTS planners report finding at least one complete route to purchasable building blocks for roughly 80% or more of targets — a dramatic improvement over the coverage achievable with purely hand-coded, rule-based expert systems of the pre-deep-learning era.
Retrosynthesis planning tools have moved from academic curiosities to routine parts of medicinal chemistry and process chemistry workflows at pharmaceutical companies and CROs. AiZynthFinder (AstraZeneca, open-source) and ASKCOS (MIT) are widely used academic and semi-commercial platforms; IBM RXN for Chemistry offers a cloud-hosted transformer-based planner with integrated forward-reaction verification; Synthia (formerly Chematica, developed by Grzybowski and commercialized by Merck) was among the first rule-based expert systems to demonstrate AI-designed routes executed successfully in a real lab with minimal modification.
In practice, these tools rarely fully replace a chemist's judgment — they compress what used to be hours of manual literature searching and route brainstorming into a few seconds of automated search, surfacing several candidate routes for a chemist to evaluate, adapt, and ultimately execute at the bench.
| Product | Indication | Trial Design | Key Result |
|---|---|---|---|
| Rule-Based Expert Systems | Hand-encoded expert disconnection rules (e.g. early LHASA) | Symbolic pattern matching against manually curated reaction rule sets | Fully interpretable, grounded in explicit expert chemistry knowledge |
| Template-Based ML | Rules auto-extracted from reaction databases (USPTO, Reaxys) | Neural ranking of >100k extracted templates per target molecule | Literature-grounded predictions with strong interpretability |
| Template-Free Transformer | Sequence/graph translation, e.g. Molecular Transformer | Learns disconnections directly from reaction SMILES, no fixed rule library | Generalizes beyond seen templates to novel reaction types |
| MCTS + RL Hybrid | Multi-step planners: AiZynthFinder, ASKCOS, IBM RXN, Synthia | Single-step model + value network guiding Monte Carlo Tree Search | Full multi-step route discovery with ~80%+ target solve rates |