arXiv:2610.24744cs.AIOct 2026

Manuscript Offprint

arXiv:2610.24744

ReTRACE: Feedback-Guided LLM Agent in a Chemistry Harness for Retrosynthesis Planning

Jinxiang Xie, Yijian Zhang, Qingyuan Yi, Jianyi Wang, Hao Dong

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

Abstract

Computer-aided retrosynthesis has advanced through single-step prediction, tree search and route scoring, but complex targets still require judgement over the whole route, where stereochemistry, functional-group compatibility, cost and greenness interact. Here we present ReTRACE (REtrosynthesis with Tool-orchestrated Reasoning And Context-aware Evidence), an agent that places a large language model (LLM) in a chemistry harness that integrates molecular tools, complementary single-step prediction engines, a purchasable starting-material library, a route memory and a multi-criterion route evaluator. Routes are judged by a new metric that combines programmatic checks with adversarial LLM review, and its verdicts are compared with a synthetic chemist's. The agent learns continually from evaluator feedback during search, diagnosing weak routes and backtracking to revise them. With Claude Opus 4.8, at least one of the top 10 routes proposed by ReTRACE passed the audit for 87.4%, 95.0% and 86.7% of targets on the three benchmarks. Two prospective wet-lab syntheses show that ReTRACE route proposals can be converted into executable procedures after expert revision.

Keywords: retrosynthesis; computer-aided synthesis planning; LLM agent; route evaluation

1 Introduction

Retrosynthetic analysis is one of the central tasks of organic synthesis. Since Corey formalized the logic of working backwards from a target molecule to simpler precursors, 1−3^{1-3} route design has been treated as a strategic activity that depends on chemical judgement about which bonds to break, in what order and under what conditions. This judgement matters increasingly in drug discovery, where complex candidates often contain several heterocycles, stereocentres and sensitive functional groups. For such targets, an early retrosynthetic choice propagates through the whole route and affects selectivity, protecting-group burden, cost, safety and sustainability.

Computer-aided synthesis planning (CASP) has progressed substantially since early expert systems encoded reaction rules and retrosynthetic templates as searchable chemical knowledge. 1,2,4,5^{1,2,4,5} Current data-driven systems couple single-step retrosynthesis models with purchasable-compound libraries and tree search.

Single-step models fall into two broad families. Template-based models apply reaction rules extracted from known reactions and so remain chemically traceable, 6,7^{6,7} whereas template-free models learn the product-to-precursor mapping directly from reaction data and can propose transformations outside any template library. 8−13^{8-13} Combining models with different inductive biases improves single-step prediction further. 14^{14} These advances are essential, but a single-step model judges one

†^{\dagger}These authors contributed equally to this work. *Corresponding authors: Hao Dong and Jianyi Wang. E-mail: donghao@nju.edu.cn (Hao Dong); jianyiwang@gxu.edu.cn (Jianyi Wang).

disconnection at a time and cannot by itself tell whether that disconnection serves the route as a whole.

Search algorithms then assemble these single-step predictions into multistep routes. Examples include the modular ASKCOS platform, 15,16^{15,16} Monte Carlo tree search guided by a neural template policy 6,7^{6,7} and AND-OR graph search with a learned value function in Retro*. 17^{17} Hybrid platforms extend the same framework to enzymatic steps. 18^{18}

Plausible single-step disconnections are often plentiful, and the harder decision is which precursor to expand for a given target. Chemists make this decision by weighing mechanism, functional-group compatibility, precedent, availability and cost together, and these signals rarely reduce to a single number. A highly ranked Suzuki–Miyaura disconnection, for example, may be unattractive if the required organoboron partner is unstable or expensive. Existing search controllers can explore very large trees, but they usually compress this judgement into model probabilities, value estimates or a scalar route score. 6,7,17,19,20^{6,7,17,19,20} This makes search fast, but it is hard to apply route-wide constraints or to see why a branch was chosen.

Large language models (LLMs) offer another way to make these decisions. Recent systems use them to guide route search, 21^{21} to coordinate single-step tools through reinforcement learning, 22^{22} to check route constraints during search 23^{23} and to evaluate synthetic strategy in natural language. 24^{24} These systems build on chemistry agents in which the LLM selects and interprets expert tools while deterministic software supplies verifiable observations. 25,26^{25,26} Their results suggest that LLMs are most useful for strategy assessment, constraint reasoning and tool coordination, and that specialized single-step models remain necessary for proposing precursors.

Recent gains in LLM capability create new opportunities for coordinating heterogeneous chemistry tools over long-horizon route planning. In software engineering, LLM agents now call tools over many rounds and revise their actions from execution feedback, 27^{27} and the length of tasks they can complete has grown rapidly. 28^{28} Chemistry poses an additional problem. A general-purpose LLM can discuss functional groups and synthetic strategy, but on its own it is unreliable at precise molecular operations such as writing valid SMILES, conserving atoms or computing quantitative scores. For long-horizon route planning, the environment built around the model, which we call its harness, therefore matters alongside the model itself. The harness determines which tools the model can call, what it remembers and what feedback it receives.

We developed ReTRACE (REtrosynthesis with Tool-orchestrated Reasoning And Context-aware Evidence) by building such a harness around an LLM for multistep retrosynthesis (Figure 1a). The harness has three parts. The tools supply what the model cannot do reliably itself: RDKit molecular operations, template-based and template-free single-step engines, purchasability lookup and route scoring, all called through deterministic gates that reject invalid structures in code. The route memory sits outside the context window and keeps partial routes, past decisions and abandoned branches across hours of search. The feedback comes from a route evaluator that scores feasibility, cost and greenness. Final routes are judged separately by a new metric that pairs programmatic structural checks with step-by-step and adversarial LLM review, and we compare this audit with the judgements of a synthetic chemist.

Within this harness the agent learns from feedback on two time scales. During a run, the evaluator's sub-scores show where a route is weak, and the agent uses them to backtrack to a specific step or to change its disconnection strategy (Figure 1c). As a run submits more scored routes, the best score so far and the chance that at least one route passes the audit both rise and level off after about eight routes (Figure 1d). Across runs, the harness records states, actions, tool returns and outcomes as trajectories that can be used to update the model itself.

ReTRACE is designed as an assistant that leaves experimental judgement to chemists. Users can steer it in natural language towards cheaper, greener or better-precedented routes. Because the route memory persists on disk, the sessions can be resumed, chemists can supply feedback or constraints, and the agent can continue planning with a human in the loop. Because the harness is modular, new expert tools, such as enzymatic single-step predictors, can be added without changing a An LLM coordinates heterogeneous chemistry tools inside a harness and responds to route-level score feedback

Figure

b Adjudicating conflicting single-step proposals

Figure

C Diagnosis and backtracking after an unfavourable score

Figure

d Score feedback within a run

Figure

Figure 1. ReTRACE harness, two decision instances from real search trajectories and the response to score feedback within a run. a, An LLM coordinator works inside a harness of heterogeneous chemistry tools, deterministic gates that check every tool call, tool result and saved route, and a route memory that carries partial routes, past decisions and abandoned branches into the next round. Route scores return to the coordinator as feedback within a run. Ranked routes are judged by Audit@k as passed or failed, and selected routes go to chemist review and wet-lab synthesis. b, Adjudicating conflicting single-step suggestions. The coordinator keeps both a late-stage nitro reduction and a glycidyl N-alkylation open, checks whether the electrophile can be purchased and expands the shared lactam core with both engine classes before choosing. c, Diagnosis and backtracking. Route B scores 0.75 against 0.80 for the best route. The coordinator attributes the gap to lower cost and feasibility from the added steps, saves route B as an alternative and backtracks to shorten the linear sequence. Monologues in b and c are verbatim excerpts from run trajectories. d, Score feedback within a run in 670 completed Retro*-190 runs. Mean score of the best route so far (dark green) and of the j-th scored route (light green; left axis), and percentage of runs in which at least one of the first j scored routes passed the audit (grey, dashed; right axis).

the coordinator.

This work makes four contributions. First, a large-scale audit of single-step engines shows that they contribute complementary candidates, in line with recent evidence for model ensembling. 14^{14} This finding motivates a harness that keeps heterogeneous evidence and lets the LLM weigh it at route level. Second, we build that harness and compare ReTRACE with classical and LLM controllers on three route-level benchmarks under a new metric whose verdicts we check against a synthetic chemist. Third, we examine how the agent learns from evaluator feedback, within a run through decision trajectories and a tool ablation, and across runs through a first attempt to train the model on harness trajectories. Fourth, two prospective wet-lab syntheses test whether ReTRACE routes can be turned into executable procedures after expert revision.