The subgraph patterns o T and r T i can include a varying number of atoms within the molecule. Often, the subgraph is constrained to the reaction centre and directly neighbouring atoms. This has the advantage of generalising the template to molecules with different functionalities. The main task of any template-based model is to rank all templates within the library to match the most relevant template to a given product (the target molecule). Mathematically, the model selects templates based on the probability P (T |O) = f (O f eat ), where O f eat refers to the chosen target molecule featurisation (e.g. ECFP fingerprint).