# Generative LLMs in Organic Chemistry: Transforming
## 4 The Data  
The dataset utilized in our experiments is derived from a comprehensive set of synthesis procedures found in USPTO and EPO patents issued between 1971 and 2022 [39]. The dataset was constructed through a unique methodology proposed in this article. This methodology combines machine learning algorithms and scripts to systematically extract and transform experimental procedures from these patents into structured actions. The pipeline involves two primary tasks: firstly, classifying patent paragraphs to accurately identify chemical procedures, and secondly, converting these procedures into a structured format. The datasets differs from the commonly used USPTO-50k [40] or USPTO-MIT [41] because it includes both reactants and products in SMILES format along with the synthesis procedures, which are in a simplified and machine-readable format. The second version of the publicly available dataset has been used, because it has been additionally improved by the removal of irregular action sequences. While the primary dataset encompasses various reaction classes, we employed the open-source software DataWarrior 5.5.0 [42] to isolate only esterification reactions. The selection of esterification reactions for isolation from the broader dataset was done because of the scope of the raw data, which include millions of instances, necessitating a focused subset for detailed analysis. Esterification, despite being a common class of chemical reaction, encompasses a variety of subtypes, each with distinct procedural steps, rendering the task of accurate procedure prediction challenging. This choice permits an in-depth exploration of a well-defined reaction type within a manageable dataset size, enabling the development and refinement of the ML algorithm for complex, real-world applications. The refined dataset comprises pairs of input and output instances. The inputs are represented as single lines of text, denoting reactants and products in SMILES (Simplified Molecular Input Line Entry System [43], used in chemistry to represent chemical structures simply and unambiguously) notation, whereas the outputs describe a series of actions and their respective parameters. The actions are limited and represented in a structured and simplified format: a solitary word signifies the action, succeeded by its specific parameters. The actions are: _Add, CollectLayer, Concentrate, Degas, DrySolid, DrySolution, Extract, Filter, FollowOtherProcedure, MakeSolution, Microwave, OtherLanguage, Partition, PH, PhaseSeparation, InvalidAction, Purify, Quench, Recrystallize, NoAction, Reflux, SetTemperature, Sonicate, Stir, Triturate, Wait, Wash,_ and _Yield_. The schema employed for action, parameter naming, and formatting was initially introduced by Lowe and subsequently refined by IBM, and it currently stands as the most exhaustive for this task. For our application, reactants and products have been tokenized and are denoted by $R1$, $R2$,..., $RNS$ for reactants and by $P1$, $P2$,..., $PNS$ for products. Such tokenization is efficient, does not require the reaction compounds to be copied over to the resulting procedure, and avoids potential errors in the notation. The input is case-sensitive due to the nature of SMILES notation, whereby aromatic atoms are denoted in lower-case letters, while aliphatic atoms are denoted in upper-case letters. The output is also case-sensitive because it makes it easier to discern between action names, compound names, abbreviations, and parameters (temperature, duration, etc.). Computer code can be used to extract relevant information from the procedures to conduct analysis and potentially apply them to a variety of robotic synthesizers. Therefore, the syntax is strict and any minor spelling errors in the words cause the whole word to be considered incorrect. A sample from the dataset is available in Table 1.  
The dataset comprises a total of 1200 samples. The data have been checked manually and corrected by a knowledgeable chemist where necessary.