For the task of SELFIE token prediction, Spectro employs a sparse categorical cross-entropy loss function, implemented using tf.keras.losses.sparse_categorical_crossentropy. This loss function is well-suited for SELFIE token prediction as it efficiently handles multi-class classification problems, aligning with the nature of token prediction for molecules represented as text. The sparse categorical cross-entropy loss is defined as, SCCE(y, ŷ) = -