By converting the tokenized input from a vector of binary variables to real-valued numbers in this way, gradient-based molecular optimisation can be achieved. As SELFIES is 100% chemically robust, the optimised representation will always decode to a valid molecule and, provided the mapping between molecular strings and their properties is sufficiently accurate, will return a structure with improved functionality.