Abstract
<jats:p>Predicting which products can be made from a set of building blocks underpins library design, analogue generation, and synthesis-constrained generative modelling. Reaction templates encoded as SMARTS patterns are the standard tool for this forward synthesis enumeration task. However, existing approaches force a trade-off between chemical coverage, specificity, and the computational cost of applying large template sets at scale. We present SmartReact, an open-source Python library that resolves this trade-off through a template set built on SMARTS-RX, a hierarchical functional group ontology. The same ontology that gives each template a precise chemical environment also drives exact pre-filtering of incompatible reactant pairs, keeping enumeration fast as the template library grows. Every prediction is traceable to a named reaction template and an explicit set of functional group requirements, making results directly interpretable by chemists and straightforward to validate or audit. New reaction types can be incorporated by specifying a SMARTS pattern and its functional group requirements, making the library easy to extend. A case study enumerating 524,911 unique products in under a minute from 1,000 building blocks demonstrates real-world utility at scale.</jats:p> <jats:p> <jats:bold>Scientific Contribution:</jats:bold> SmartReact contributes both a large, expert-refined SMARTS reaction template library and a scalable open-source Python package designed to use it efficiently. The library’s 9,594 templates spanning 36 medicinal chemistry reaction types are grounded in the SMARTS-RX functional group ontology, giving them high chemical specificity and non-redundancy that auto-extracted libraries lack. The same ontology drives exact pre-filtering of incompatible reactant-template combinations, yielding a 43-fold algorithmic speedup that combines with near-linear parallel scaling and a classify-once API to reach over 11,000-fold throughput relative to single-core brute-force matching on a 32-core server. </jats:p>