Skip to content

RxnCLF: Contrastive Transformation-Aware Reaction Foundation Model for Improved Reactivity Prediction

Source: arXiv:2608.06259 · Published 2026-08-06 · By Yiting Zheng, Cheng Fang, Anthony Donofrio, Haote Li

TL;DR

RxnCLF addresses the challenge of reaction yield prediction where labeled data are limited and reaction space is combinatorially large and sparsely populated. Existing reaction encodings based on strings, fingerprints, or disconnected graphs fail to capture the full chemical transformation, limiting predictive performance especially on complex substrates. This paper proposes RxnCLF, a self-supervised contrastive learning framework that learns transformation-aware reaction representations using a condensed reaction graph (CRG) which merges reactants and products into a single graph encoding explicit bond formation and cleavage. Pretrained on 1.7 million reactions from Pistachio, RxnCLF learns a compact latent space capturing reaction center information as well as broader structural context. When fine-tuned on multiple yield prediction benchmarks, including Buchwald-Hartwig and proprietary industrial datasets, RxnCLF consistently outperforms existing graph- and sequence-based baselines in R2 performance.

RxnCLF's key novelty lies in its chemically interpretable condensed graph representation combined with contrastive learning that builds a smooth, stable, and semantically meaningful latent space for reactions. Extensive analyses demonstrate superior search and retrieval capabilities in this latent space, under both in-distribution and out-of-distribution conditions. This confirms RxnCLF's ability to generalize well across reaction classes and supports downstream reaction informatics tasks such as regioselectivity and enantioselectivity prediction. Overall, the work presents a scalable reaction foundation model that successfully transfers large-scale unsupervised reaction knowledge to practical yield prediction with sparse labels.

Key findings

  • RxnCLF pretrained on 1.7 million Pistachio reactions achieves a KNN stability of 0.998 and Mean Reciprocal Rank (MRR) 0.986 in latent space retrieval quality, outperforming FP Difference (KNN stability 0.912, MRR 0.673) and RxnFP (KNN stability 0.999, MRR 0.959).
  • RxnCLF embedding extraction on 2 million reactions requires 15 minutes, faster than RxnFP's 390 minutes and FP Difference's 30 minutes.
  • RxnCLF yields the highest R2 when fine-tuned on four benchmarks: Buchwald-Hartwig (0.962 ± 0.003), Pd-catalyzed BH coupling (0.769 ± 0.016), proprietary C-N coupling (0.484 ± 0.020), and proprietary amide formation (0.428 ± 0.024), consistently outperforming baselines including Chemprop, GIN, and YieldBERT.
  • Latent space perturbation experiments show cosine similarity >0.99 between full graphs and subgraphs with side chains or reaction centers removed, indicating a stable but transformation-aware representation.
  • Out-of-distribution reactions from external datasets cluster appropriately in the RxnCLF latent space, preserving product similarity and same reaction type retrieval ratios.
  • RxnCLF better preserves scaffold and product similarity in retrieval compared to RxnFP and FP Difference, supporting more context-aware reaction embeddings.
  • RxnFP emphasizes reaction-center information more strongly leading to higher same-type retrieval fractions but lower product similarity, while RxnCLF achieves a balanced representation capturing both.
  • RxnCLF's reaction latent space is continuous, well-structured, and smooth under input perturbations, supporting reliable similarity search and transfer to downstream tasks.

Methodology — deep read

  1. Threat model & assumptions: The paper focuses on the machine learning challenge of predicting chemical reaction yields and representations rather than adversarial attacks. The main assumption is that labeled reaction data are scarce and costly, and the reaction space is combinatorially large and sparsely populated, necessitating scalable unsupervised representation learning.

  2. Data: The model is pretrained on 1.7 million reactions from the Pistachio commercial database, cleaned for duplicates, unassigned reactions, and multiple product cases. Downstream evaluation uses four datasets: Buchwald-Hartwig (4,608 reactions), Pd-catalyzed BH coupling (4,088 reactions), and two proprietary high-throughput experimentation (HTE) datasets for C-N coupling (~29,000 reactions) and amide formation (~26,000 reactions).

  3. Architecture/algorithm: RxnCLF constructs a condensed reaction graph (CRG) by merging atom-mapped reactants and products into a single graph, encoding bond changes explicitly. The graph neural network encoder is a Graph Isomorphism Network (GIN) producing 512-dimensional embeddings. Two augmented views of each CRG are generated via subgraph removal based on masking atoms either randomly, restricted to reaction center, or side chains. Contrastive learning using the NT-Xent loss encourages embeddings of augmented views of the same reaction to align, while pushing different reactions apart.

  4. Training regime: Pretraining involves sampling batches of N atom-mapped reactions, applying subgraph augmentations, then training the GIN encoder plus a projection layer with NT-Xent contrastive loss. Hyperparameters such as masking 25% of atoms were used. Details on epochs, optimizer, batch size, or hardware are not clearly stated. Fine-tuning on yield prediction tasks uses supervised mean squared error loss with standard 80/5/15 train/val/test splits, early stopping, and 5 random seeds.

  5. Evaluation protocol: Reaction latent spaces (RxnCLF, RxnFP, FP Difference) are compared using KNN stability (neighborhood overlap under noise), hubness (skewness in neighbor frequency), and mean reciprocal rank (MRR) over 50k query reactions from Pistachio. Query retrieval quality is assessed by product and scaffold Tanimoto similarity and reaction type agreement on 500 sampled queries. Perturbation analysis compares embedding distances between full reactions and variants with reaction center or side chain atoms removed. Yield prediction results report test R2 scores averaged over multiple runs. Out-of-distribution generalization is assessed by projecting external datasets into the learned latent space.

  6. Reproducibility: Source code or model weights are not explicitly mentioned as released. The Pistachio dataset is commercial and not public. Pretrained weights were used for downstream tasks but no frozen models or scripts are discussed. Exact details on random seeds, optimizer, and training duration are sparse.

Example end-to-end: Given a reaction with atom mapping, the CRG is constructed unifying reactants and products into one graph encoding bond changes. Two masked augmented graphs are generated for that reaction. These are fed into the GIN encoder sharing weights, producing embedding vectors. The contrastive loss aligns these embeddings with each other (positive pairs) while pushing embeddings of other reaction graphs (negative pairs) apart. After pretraining on millions of reactions, the model produces a latent space where similar reactions cluster. For yield prediction, the pretrained encoder is fine-tuned with a prediction head on labeled reaction data using MSE loss, achieving significantly higher R2 than baselines.

Technical innovations

  • Use of condensed reaction graph (CRG) representation that unifies reactants and products into a single graph encoding explicit bond formation/cleavage for richer transformation modeling, improving over disconnected graphs or SMILES strings.
  • A novel application of graph contrastive learning with subgraph removal augmentations tailored to reaction graphs to learn a transformation-aware and chemically interpretable reaction latent space.
  • Demonstration that large-scale self-supervised pretraining on 1.7M unlabeled reactions builds a robust foundation model for improved downstream reaction yield prediction with sparse labels.
  • Comprehensive reaction latent space evaluation combining metrics like KNN stability, hubness, mean reciprocal rank, and out-of-distribution projection reveals smooth, structured, and transferable reaction embeddings.

Datasets

  • Pistachio — 1.7 million reactions — proprietary commercial dataset
  • Buchwald-Hartwig — 4,608 reactions — public literature benchmark
  • Pd-catalyzed BH coupling — 4,088 reactions — academic benchmark
  • Proprietary C-N coupling — approx. 29,000 reactions — industrial HTE data
  • Proprietary amide formation — approx. 26,000 reactions — industrial HTE data

Baselines vs proposed

  • Chemprop: R2 = 0.617 (Buchwald-Hartwig) vs RxnCLF: 0.962
  • GIN: R2 = 0.930 (Buchwald-Hartwig) vs RxnCLF: 0.962
  • YieldBERT: R2 = 0.951 (Buchwald-Hartwig) vs RxnCLF: 0.962
  • Chemprop: R2 = 0.726 (Pd-catalyzed BH) vs RxnCLF: 0.769
  • GIN: R2 = 0.597 (Pd-catalyzed BH) vs RxnCLF: 0.769
  • YieldBERT: R2 = 0.659 (Pd-catalyzed BH) vs RxnCLF: 0.769
  • Chemprop: R2 = 0.469 (Proprietary C-N) vs RxnCLF: 0.484
  • GIN: R2 = 0.471 (Proprietary C-N) vs RxnCLF: 0.484
  • YieldBERT: R2 = 0.397 (Proprietary C-N) vs RxnCLF: 0.484
  • Chemprop: R2 = 0.395 (Proprietary amide) vs RxnCLF: 0.428
  • GIN: R2 = 0.358 (Proprietary amide) vs RxnCLF: 0.428
  • YieldBERT: R2 = 0.418 (Proprietary amide) vs RxnCLF: 0.428

Figures from the paper

Figures are reproduced from the source paper for academic discussion. Original copyright: the paper authors. See arXiv:2608.06259.

Fig 1

Fig 1: Overview of RxnCLF training. The process consists of three stages. a: A reaction is converted from atom-mapped

Fig 2

Fig 2: Visualization of the three latent spaces, colored by the four most frequent HazELNut reaction superclasses. a. FP

Fig 3

Fig 3: Evaluation of reactions retrieved from the three

Fig 4

Fig 4: Top-5 similar reactions retrieved from three latent spaces for a given query reaction. Product similarity scores are

Fig 5

Fig 5: Latent space visualization of, a. the in-distribution

Fig 6

Fig 6: OOD evaluation: a. product Tanimoto similarity be-

Limitations

  • Pretraining and evaluation rely on commercial Pistachio data, limiting public reproducibility and potentially biasing representations toward proprietary reaction space.
  • Details on training hyperparameters, such as number of epochs, batch size, optimizer settings, and hardware used, are sparse or absent, complicating exact reproduction.
  • Out-of-distribution evaluation is limited to a few public and proprietary reaction datasets; broader reaction classes and more diverse conditions might reveal different generalization behaviors.
  • The model depends on reliable atom mapping as input to construct CRGs; errors in atom mappings could impact representation quality but this is not systematically studied.
  • Evaluation focuses on yield prediction; other downstream tasks such as regioselectivity, enantioselectivity, or reaction condition optimization are discussed but not empirically demonstrated here.
  • The proprietary proprietary datasets used for industrial scale evaluation contain data noise and missing reagent information, possibly affecting the observed performance gains.

Open questions / follow-ons

  • How does RxnCLF performance generalize to entirely new reaction classes or rare transformations absent in Pistachio or fine-tuning sets?
  • To what extent can RxnCLF representations support other reaction informatics tasks beyond yield prediction, such as selectivity or condition optimization, and what modifications may be needed?
  • How robust is the model to errors or uncertainties in atom mapping input, and can it be improved to handle noisy or partially mapped reactions?
  • Would incorporating reagent or condition information more explicitly into the CRG or contrastive framework further enhance predictive accuracy and interpretability?

Why it matters for bot defense

This work introduces an advanced representation learning framework for chemical reactions that effectively models transformation-level information through a graph-based contrastive learning approach. For bot-defense and CAPTCHA practitioners, the key takeaway is the demonstration that domain-specific structured representations combined with self-supervised contrastive pretraining on large unlabeled datasets can substantially improve downstream supervised prediction tasks where labeled data are sparse and input spaces are combinatorial.

The principles of RxnCLF—such as consolidating disjoint input elements into unified graph structures, designing augmentation strategies that preserve semantic consistency, and evaluating embedding spaces for stability and meaningful similarity—can inform the design of more robust and interpretable machine learning models in other challenging pattern recognition domains. Although chemistry-specific, the methods exemplify scalable foundation modeling, highlighting the value of large-scale, task-agnostic pretraining followed by efficient fine-tuning. Practitioners aiming to detect complex bot patterns or circumvent CAPTCHAs might consider analogous contrastive learning and graph-based representations of behavioral transformations to encode interaction sequences or state changes, drawing inspiration from RxnCLF's success at capturing structural transformation semantics.

Cite

bibtex
@article{arxiv2608_06259,
  title={ RxnCLF: Contrastive Transformation-Aware Reaction Foundation Model for Improved Reactivity Prediction },
  author={ Yiting Zheng and Cheng Fang and Anthony Donofrio and Haote Li },
  journal={arXiv preprint arXiv:2608.06259},
  year={ 2026 },
  url={https://arxiv.org/abs/2608.06259}
}

Read the full paper

Articles are CC BY 4.0 — feel free to quote with attribution