where Q dec and Kenc refer to the query and key matrices from the decoder and encoder, respectively. Attention matrix A ∈ R T out ×T in contains the attention weights between all tokens of both sequences. The most relevant attention matrix A * is defined as a collection of attention vectors at = [a1, a2, . . . , am]⊤ for each output (reactant SMILES) token i.e. A * = [a1, a2, . . . , an]. The attention vector at is extracted as the vector that contains the largest scalar (closest to 1) i.e. the strongest correlation between the output token to any of the input (product SMILES) tokens. Once matrix A * is obtained from the model, a column-wise summation is performed over the product SMILES token along with normalisation as: