Abstract
Computer-aided synthesis planning (CASP) relies heavily on Transformer-based models to predict chemical reaction outcomes and retrosynthetic pathways. While highly accurate, these models suffer from significant inference latency due to their autoregressive nature. This paper presents a novel approach to accelerate these models by adapting "speculative decoding" with chemistry-specific heuristics. By leveraging the structural similarity between reactants and products, the authors achieved up to a 3.5x speedup in inference without any loss in prediction accuracy.
Introduction
In modern drug discovery and industrial chemistry, the Molecular Transformer has become the gold standard for predicting reaction products and retrosynthesis. These models treat molecules as sequences of text using the SMILES (Simplified Molecular Input Line Entry System) notation. However, because Transformers generate SMILES strings one token at a time, predicting a single molecule can require dozens or hundreds of sequential forward passes. This computational bottleneck limits the scalability of CASP systems when evaluating thousands of potential synthetic routes in real-time.
Methodology
To address this bottleneck, the researchers introduced two primary innovations: Chemically Specific Drafting and Speculative Beam Search (SBS).
Chemically Specific Drafting
Speculative decoding typically uses a small "assistant" model to draft potential tokens that a larger "judge" model then verifies. The authors observed that in chemical reactions, large fragments of the reactant molecules often remain unchanged in the final product.
Instead of training a separate assistant model, the authors used a "sliding window" to extract substrings directly from the input reactants to serve as drafts. This "Smart Drafting" approach focuses on substrings that begin with the most recently generated token, allowing the model to "jump" multiple steps ahead if the draft is accepted by the judge model.
Speculative Beam Search (SBS)
While standard speculative decoding is designed for greedy decoding (picking the single best token), industrial applications often require the top $N$ candidates (Beam Search). The authors developed Speculative Beam Search, a novel algorithm that maintains multiple candidate sequences (beams) while simultaneously using speculative drafts to accelerate token generation across all beams.
Experimental Results
The proposed methods were evaluated on industry-standard benchmarks, including USPTO MIT for product prediction and USPTO 50K for retrosynthesis.
- Inference Speed: For greedy decoding, the method achieved a 3.53x speedup at a batch size of 1. For retrosynthesis tasks requiring multiple candidates, Speculative Beam Search was approximately 2.1x faster than standard beam search.
- Accuracy Preservation: A critical advantage of speculative decoding is that it is mathematically guaranteed to produce the same output as the original model. The Top-1 accuracy on the USPTO MIT dataset remained at 88.4%, identical to the standard Molecular Transformer.
- Efficiency: "Smart Drafting" significantly reduced computational overhead compared to naive drafting, allowing the speedup to persist even as batch sizes increased, though hardware limits eventually create a plateau.
Discussion and Conclusion
The integration of speculative decoding with chemistry-specific heuristics represents a significant step forward for industrial CASP. By recognizing that the input SMILES string is a "gold mine" for predicting the output, the researchers bypassed the need for expensive assistant models.
While the current implementation faces scaling challenges at very large batch sizes due to GPU memory constraints, the authors suggest that combining this approach with techniques like KV-caching or quantization could further enhance performance. This work makes high-accuracy Transformer models much more practical for the high-throughput demands of modern chemical informatics.
Summary updated