FusionRetro: Molecule Representation Fusion via In-Context Learning for Retrosynthetic Planning

Songtao Liu, Rex Ying, Zuobai Zhang, Peilin Zhao, Jian Tang, Lu Lin, Dinghao Wu, Zhao, Peilin, Wu, Dinghao

Abstract

Retrosynthetic planning aims to devise a complete multi-step synthetic route from starting materials to a target molecule. Current strategies use a decoupled approach of single-step retrosynthesis models and search algorithms, taking only the product as the input to predict the reactants for each planning step and ignoring valuable context information along the synthetic route. In this work, we propose a novel framework that utilizes context information for improved retrosynthetic planning. We view synthetic routes as reaction graphs and propose to incorporate context through three principled steps: encode molecules into embeddings, aggregate information over routes, and readout to predict reactants. Our approach is the first attempt to utilize in-context learning for retrosynthesis prediction in retrosynthetic planning. The entire framework can be efficiently optimized in an end-to-end fashion and produce more practical and accurate predictions. Comprehensive experiments demonstrate that by fusing in the context information over routes, our model significantly improves the performance of retrosynthetic planning over baselines that are not context-aware, especially for long synthetic routes.

Introduction

Retrosynthetic planning—the process of working backward from a target molecule to identify a sequence of reactions using commercially available starting materials—is a cornerstone of organic chemistry. Traditional AI-driven approaches typically employ a decoupled strategy: a single-step model predicts reactants for a specific molecule, while a search algorithm (such as A* or MCTS) explores the space of possible paths.

A significant limitation of these methods is their "context-blindness." Single-step models generally only consider the immediate product to predict reactants, ignoring the chemical history of the synthetic route. This lack of context can lead to chemically inconsistent or impractical planning. Furthermore, standard evaluation metrics like "search success rate" can be misleadingly high, often failing to reflect whether the proposed starting materials could realistically produce the target molecule in a laboratory setting.

The FusionRetro Framework

To address these challenges, we introduce FusionRetro, an end-to-end framework that treats the synthetic route as a reaction graph. This approach enables "in-context learning" for chemistry by incorporating contextual information from the entire synthetic path. The core process consists of three steps:

  1. Encode: Molecules within the reaction graph are converted into high-dimensional embeddings using standard encoders, such as Transformers or Graph Neural Networks (GNNs).
  2. Aggregate (Fusion): Instead of treating molecules in isolation, FusionRetro employs an attention mechanism to fuse a molecule's embedding with the embeddings of its ancestors in the synthetic route. This allows the model to retain the chemical context of the entire path.
  3. Readout: The decoder predicts reactants for the current step using a combination of the original molecule representation and the fused, context-aware representation.
The FusionRetro framework: encoding molecules, constructing a reaction graph, and fusing representations for better prediction.

Model Architecture

The FusionRetro architecture is built upon a Transformer backbone. A dedicated Fusion Layer is integrated between the encoder and decoder to manage the flow of information from the reaction graph. This design allows the model to dynamically attend to relevant historical steps in the synthesis, improving the accuracy of reactant prediction in complex multi-step scenarios.

Detailed architecture of FusionRetro, showing the integration of Fusion Layers between the Encoder and Decoder to facilitate in-context learning.

Experimental Evaluation

We evaluated FusionRetro using the USPTO-full dataset to construct a new benchmark, RetroBench, which contains 58,099 high-quality synthetic routes. To provide a more realistic assessment of planning capability, we introduced the set-wise exact match metric. Unlike traditional metrics that check individual steps, this metric verifies if the entire set of proposed starting materials matches the ground truth.

Key Results

  • Superior Accuracy: FusionRetro outperformed all template-free baselines, achieving a 37.5% top-1 accuracy on RetroBench, compared to 31.3% for a standard Transformer.
  • Enhanced Planning: When integrated with search algorithms like Retro*, FusionRetro achieved significantly higher search success rates than context-unaware models.
  • Robustness to Depth: While standard models often see a sharp decline in accuracy as the number of synthetic steps increases, FusionRetro maintains higher performance on longer, more complex routes.

Conclusion

FusionRetro demonstrates that chemical reactions in a sequence are not independent; information regarding previous reagents and functional group compatibility provides vital clues for subsequent steps. By leveraging in-context learning through reaction graph fusion, FusionRetro provides a more accurate and practical tool for retrosynthetic planning, particularly for complex molecules requiring extensive synthesis paths. Future work will explore more advanced graph-based attention mechanisms and fine-tuning on even larger chemical datasets.

Summary updated

Abstract

Retrosynthetic planning aims to devise a complete multi-step synthetic route from starting materials to a target molecule. Current strategies use a decoupled approach of single-step retrosynthesis models and search algorithms, taking only the product as the input to predict the reactants for each planning step and ignoring valuable context information along the synthetic route. In this work, we propose a novel framework that utilizes context information for improved retrosynthetic planning. We view synthetic routes as reaction graphs and propose to incorporate context through three principled steps: encode molecules into embeddings, aggregate information over routes, and readout to predict reactants. Our approach is the first attempt to utilize in-context learning for retrosynthesis prediction in retrosynthetic planning. The entire framework can be efficiently optimized in an end-to-end fashion and produce more practical and accurate predictions. Comprehensive experiments demonstrate that by fusing in the context information over routes, our model significantly improves the performance of retrosynthetic planning over baselines that are not context-aware, especially for long synthetic routes. Code is available at https://github.com/SongtaoLiu0823/FusionRetro.
BibTeX
@inproceedings{liu2023fusionretro,
  author = {Songtao Liu and Rex Ying and Zuobai Zhang and Peilin Zhao and Jian Tang and Lu Lin and Dinghao Wu and Zhao, Peilin and Wu, Dinghao},
  title = {{FusionRetro: Molecule Representation Fusion via In-Context Learning for Retrosynthetic Planning}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=BTRKmm4HXxv},
}
Figure