Ordering network Despite VQGAE's ability to generate molecules from given fragment vector indices, it requires that these indices should be arranged in a "canonical" order learned by GRU for successful generation. To address this issue, a model called an ordering network was trained to predict the canonical order of randomly arranged fragment indices from the VQGAE codebook. The architecture used fragment indices as input, with each index associated with an embedding vector. The embeddings were then processed through six self-attention blocks, identical to those used in the VQGAE. The target output was the "canonical" position of the fragment index in the vector for the decoder. The loss function was used as a binary cross-entropy. The output of network can be seen as pseudo-permutation matrix. Different from permutation matrix, in the "pseudo" version the sum of values in columns were not equal to one. For extraction of canonical positions of fragment vectors, we also implemented a beam search-like algorithm. The main goal of this algorithm is to find the combinations of unique positions with the highest sum of predicted probabilities.