At training time, for forward reaction prediction and retrosynthesis, the model generates either SMILES or IUPAC outputs with equal probability. To explicitly specify the output representation, we appended a flag at the end of each input sequence: "S" for SMILES output and "I" for IUPAC output. Examples of input and output sequences used in the training set are provided in the Supporting Information. All models were trained using a cross-entropy loss function.