# Generative LLMs in Organic Chemistry: Transforming
## 5 Applied Machine Learning Approaches  
In the field of computational chemistry, the critical task of translating molecular representations into a machine-readable format is a prerequisite for the application of machine learning techniques. This transformation is crucial, especially given that the methodologies we evaluate necessitate a numerical input. Therefore, such inputs require vectorization. The utility of supervised machine learning methodologies is well-established in the domain of predictive modelling, particularly in scenarios where there is a clear mapping from input to output. In the context of our study, which aims to predict organic chemistry procedures, the supervised learning paradigm serves as an appropriate framework for training models on the curated dataset. Consequently, we have explored several vectorization approaches and tested three machine learning algorithms, each accompanied by a selection of hyper-parameters to optimize their performance for our task. **FLAN-T5 Model. ** The model FLAN-T5-base (created by Google) [44] is an evolved variant of the T5 [45] architecture that can vectorize SMILES strings into contextually rich representations that may capture the chemical semantics embedded within them. The T5's foundational transformer architecture employs the SentencePiece tokenizer [46], which breaks down words into subwords or tokens. Each of these tokens is then vectorized into context vectors of varying lengths, depending on the model scale used. In our case, context vectors are refined within the token's vicinity, a process intrinsic to the T5 learning paradigm, where embeddings are adjusted to reflect the token's contextual relevance. These vectors, once concatenated, maintain the discrete boundaries between tokens while forming a comprehensive sequence representation [47]. For SMILES notations, the tokenization may differ from natural language processing, potentially involving individual characters as tokens. Regarding the sequence and context vector lengths, FLAN-T5-base uses a 512-element context vector with an embedding dimension of 786. The maximum output length was also set to 512. This FLAN-T5 model was further fine-tuned on a domain-specific dataset, focusing on esterification reactions. The fine-tuning process was not conducted from scratch but was based on models that were pre-trained by Google. The FLAN-T5-base model was fine-tuned using [PERSON]'s library [48]. Predominantly, a text-to-text transformer model is premised on the idea that most NLP tasks can be framed as a text-to-text problem, where both the input and output are sequences of text [49; 50; 51]. The model leverages an encoder-decoder structure, using a stack of self-attention mechanisms. Fine-tuning is important to adapt the generalized knowledge of pre-trained models to specific, often narrower, domains or applications. This process usually involves additional training epochs on a target dataset, allowing the model to specialize and achieve higher performance metrics in specific tasks. The model used in this study has been fine-tuned with different sizes of datasets, with a learning rate of 0.00005, which has been found to lead to optimal results at around epoch 60 in most cases. A batch size of 4 has been used with four gradient accumulation steps, resulting in an effective batch size of 16. **OpenAI's GPT models. ** OpenAI's GPT models utilize an architecture known as transformers, which are pivotal for their language generation capabilities [52; 53]. The core idea behind these models is the use of embeddings, similar to FLAN-T5 embeddings, to convert words or tokens into continuous vector spaces. The models utilize attention mechanisms, particularly self-attention, to weigh the importance of different words in a sentence, allowing them to generate coherent and contextually relevant text. The larger the model, GPT-3 or GPT-4 being examples of large models, the more capacity it has to store relationships in its embeddings.