MetaRF: Differentiable Random Forest for Reaction Yield Prediction with a Few Trails

Kexin Chen, Guangyong Chen, Junyou Li, Yuansheng Huang, Pheng-Ann HengarXiv 2022 · DOI · arXiv

Abstract

Predicting chemical reaction yields is a cornerstone of computer-aided synthesis planning but is frequently hampered by the high cost of data acquisition and the vastness of chemical space. We present MetaRF, a differentiable Random Forest framework that leverages meta-learning for few-shot yield prediction. By integrating an attention mechanism to weight decision trees and employing Model Agnostic Meta-Learning (MAML), MetaRF adapts to new chemical reagents with as few as five experimental trials. Our approach significantly outperforms traditional machine learning baselines across multiple high-throughput experimentation datasets, offering a robust solution for out-of-distribution chemical yield prediction.

Introduction

In drug discovery and organic chemistry, knowing if a reaction will produce a high yield is as critical as knowing the synthetic pathway itself. However, predicting yields is notoriously difficult because experimental data is expensive to collect, and standard machine learning models typically require thousands of samples to achieve accuracy. When a chemist introduces a "new chemical space"—such as a reagent or condition never seen by the model—standard models often fail due to out-of-distribution (OOD) errors. MetaRF addresses this by utilizing few-shot learning, enabling a model to learn the behavior of a new reagent from just a handful of experimental samples.

Methodology

The MetaRF framework consists of three integrated components designed to maximize learning efficiency from minimal data:

  1. Reaction Encoding: Chemical components (aryl halides, catalysts, additives, etc.) are converted into numerical vectors using Density Functional Theory (DFT) descriptors. These descriptors capture essential molecular, atomic, and vibrational properties, providing the model with foundational chemical insight.
  2. Differentiable Random Forest (MetaRF): Traditional Random Forests are non-differentiable, making them incompatible with gradient-based meta-learning. MetaRF overcomes this by treating the ensemble as a collection of fixed decision trees and adding an attention mechanism to assign weights to these trees. Using Model Agnostic Meta-Learning (MAML), the model optimizes these weights to create a starting state that can be rapidly fine-tuned for specific new reagents.
  3. Dimension-Reduction Based Sampling: To optimize the utility of the limited "shots" available, the framework employs TSNE for dimensionality reduction followed by the Kennard-Stone (KS) algorithm. This ensures that the few samples selected for experimental testing are the most representative and diverse within the chemical space.
Workflow of the MetaRF framework, illustrating reaction encoding, dimension-reduction based sampling, meta-training, and few-shot fine-tuning for new additives.

Experimental Setup and Datasets

The model was rigorously evaluated on three prominent chemical datasets to test its versatility:

  • Buchwald–Hartwig HTE: A high-throughput dataset containing 3,955 palladium-catalyzed cross-coupling reactions.
  • Buchwald–Hartwig ELN: A sparse, "real-world" dataset of 781 reactions derived from AstraZeneca’s electronic laboratory notebooks.
  • Suzuki–Miyaura HTE: A dataset of 5,760 reactions used to demonstrate generalization across different reaction types.

Key Results

MetaRF demonstrates superior efficiency and accuracy compared to standard Random Forest baselines, particularly in data-scarce scenarios. On the Buchwald-Hartwig HTE dataset, MetaRF achieved an $R^2$ of 0.648 using only 2.5% of the available data. In contrast, a standard Random Forest required 20% of the data to reach a comparable accuracy level ($R^2 = 0.654$).

Performance comparison between MetaRF and baseline models showing RMSE and R² improvements as the number of fine-tuning samples increases.

Furthermore, MetaRF excels at high-yield discovery. When identifying the top 10 reactions for a new reagent, MetaRF’s selections yielded an average of 93.7%, nearing the theoretical ideal of 95.5%, while the baseline model only reached 86.3%. The model also showed a consistent 20% improvement in Root Mean Square Error (RMSE) over the baseline when fine-tuning with 4 to 10 samples, proving that smart sampling combined with meta-learning is critical for OOD adaptation.

Conclusion and Future Work

MetaRF bridges the gap between the robustness of classical ensemble methods and the adaptability of modern meta-learning. By making ensemble weighting differentiable, the authors have created a tool that allows chemists to specialize a model for a new reagent in seconds. Future research may extend this methodology to other low-data chemical challenges, such as predicting enantioselectivity or optimizing conditions for entirely novel classes of molecules. While currently focused on cross-coupling, the framework's success suggests broad applicability across the chemical sciences.

Summary updated

Abstract

Artificial intelligence has deeply revolutionized the field of medicinal chemistry with many impressive applications, but the success of these applications requires a massive amount of training samples with high-quality annotations, which seriously limits the wide usage of data-driven methods. In this paper, we focus on the reaction yield prediction problem, which assists chemists in selecting high-yield reactions in a new chemical space only with a few experimental trials. To attack this challenge, we first put forth MetaRF, an attention-based differentiable random forest model specially designed for the few-shot yield prediction, where the attention weight of a random forest is automatically optimized by the meta-learning framework and can be quickly adapted to predict the performance of new reagents while given a few additional samples. To improve the few-shot learning performance, we further introduce a dimension-reduction based sampling method to determine valuable samples to be experimentally tested and then learned. Our methodology is evaluated on three different datasets and acquires satisfactory performance on few-shot prediction. In high-throughput experimentation (HTE) datasets, the average yield of our methodology's top 10 high-yield reactions is relatively close to the results of ideal yield selection.
BibTeX
@misc{chen2022metarf,
  author = {Kexin Chen and Guangyong Chen and Junyou Li and Yuansheng Huang and Pheng-Ann Heng},
  title = {{MetaRF: Differentiable Random Forest for Reaction Yield Prediction with a Few Trails}},
  year = {2022},
  eprint = {2208.10083},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2208.10083},
}
Figure