Each method in this class first establishes a reaction template library by experts or explicit rules. Then, given a product, they select an appropriate template from the library to generate reactants. Many efforts have been made by i) achieving a trade-off between the size and the diversity of the template library and ii) proposing an effective and efficient matching rule. The LocalRetro in simplifies the reaction templates by merely representing the changes of atoms and bonds and thus reduces the size of the library. The RetroComposer in considers the combinations of existing templates, such that some complicated reactions can be matched with the combinations. The GLN captures the relations between the products and the templates by a subgraph matching algorithm. As aforementioned, the main drawback of the template-based methods is their poor generalization power -they cannot predict unseen reactions uncovered by the template library.