REINFORCE is a policy-based algorithm that only relies on one reward value at the end of the episode (a.k.a return): a particularly favourable property considering a partially complete SMILES string may be invalid or not have a relevant or associated calculable reward. REINVENT is an extension of this algorithm that utilises two networks and therefore two policy functions: a prior that is fixed based on the pre-trained neural network 𝜋 𝑝𝑟𝑖𝑜𝑟 and an agent network that is updated to maximize the reward 𝜋 𝑎𝑔𝑒𝑛𝑡 . The loss function used in REINVENT is shown in Equation , it can be considered a reward shaping of REINFORCE that couples the two policies, such that agent policy does not drift too far from the initially learnt prior policy. The extent to which the prior policy is considered in relation to the reward for a given molecule is controlled by 𝜎. This loss function is then used to update agent such that the probability distribution of actions given a state is learned to maximize the final reward.