NEURALDECIPHER -REVERSE-ENGINEERING ECFP FINGERPRINTS TO THEIR MOLECULAR STRUCTURES
Protecting molecular structures from disclosure against external parties is of great relevance for industrial and private associations, such as pharmaceutical companies. Within the framework of external collaborations, it is common to exchange datasets by encoding the molecular structures into descriptors. Molecular fingerprints such as the extended-connectivity fingerprints are frequently used for such an exchange, because they typically perform well on quantitative structure-activity relationship tasks. ECFPs are often considered to be non-invertible due to the way they are computed. In this paper, we present a reverse-engineering method to deduce the molecular structure given revealed ECFPs. Our method includes the Neuraldecipher, a neural network model that predicts a compact vector representation of compounds, given ECFPs. We then utilize another pre-trained model to retrieve the molecular structure as SMILES representation. We demonstrate that our method is able to reconstruct molecular structures to some extent, and improves, when ECFPs with larger fingerprint sizes are revealed. For example, given ECFP count vectors of length 4096, we are able to correctly deduce around 60% of molecular structures on a validation set (112K unique samples) with our method.Keywords molecular fingerprints • extended-connectivity fingerprint (ECFP) • reverse-engineering • fingerprint security • QSAR • ADMET
Introduction<!>Methods<!>Neuraldecipher model<!>Datasets<!>ECFP data<!>Results<!>Degeneracy analysis<!>Example molecule pairs<!>Results and Discussion<!>Cluster<!>Conclusion<!>E Analysis of hash collision
<p>The data protection and privacy of molecular structures are of crucial importance for industrial and private sectors, especially for the pharmaceutical industry. As the process of drug discovery is known to last at least a decade (10-20 years) [1][2], pharmaceutical companies have utilized computational methods in the early stage to accelerate the generation of promising drug candidates that are active against a biological target and the enrichment of chemical libraries for subsequent screening and analysis.</p><p>Molecular descriptors and fingerprints play a central role in computer-aided drug discovery, i.e. in-silico de novo drug design, as they capture chemical information of the molecular structure as a vector of numbers that can be utilized for predictive modeling in several cheminformatic tasks [4]. In quantitative structure-activity (QSAR) modeling, the aim is to model the relationship between compound and biological or physico-chemical endpoints. One biological endpoint is usually the binding affinity of a drug candidate against a protein target. Because drug candidates with high binding affinity can still fail in later phases of clinical trials due to poor pharmacokinetic and toxicological (ADMET) profiles, modeling ADMET endpoints such as solubility or melting point, is nowadays also considered in in-silico de novo drug design at early stages [5]. Securely exchanging chemical data without revealing the molecular structure is especially nowadays of great importance, as sharing data such as fingerprints and/or measured endpoints between research groups within academia Given an ECFP representation (here exemplary as bit-vector), we predict the corresponding cddd-representation and utilize the fixed decoder network from Winter et al. [3] to obtain the SMILES representation. Trainable parameters for the Neuraldecipher are displayed as blue arrows, while black arrows correspond to operations that are fixed and not optimized during training.</p><p>or private sectors through collaborations is often accomplished to improve drug discovery. An example for a large-scale collaboration is the MELLODY (Machine Learning Ledger Orchestration for Drug Discovery) project 1 (2019-2022), an IMI project by the European Union with a total funding of 18.4M EUR including collaborations between pharmaceutical companies, research groups from universities but also small and medium-sized enterprises.</p><p>Reconstructing the molecular structure that matches given chemical property values is a traditional (optimization) problem and often referred to as inverse-QSAR. One of the most commonly used molecular fingerprints in QSAR is the circular extended-connectivity fingerprint (ECFP) [6]. The ECFP has found many scientific applications starting from virtual screening and similarity search [7] [8] to biological target prediction [9], proteochemometric modeling [10] and ADMET endpoint modeling [11]. The topological ECFP representation is a refinement of the Morgan Algorithm [12] and usually hashed and folded into a fixed size 1024, 2048 or 4096 sparse bit or count vector to further utilize for predictive modeling tasks. During the fingerprint creation, the ECFP algorithm considers the atom environment, based on the maximum number of atomic neighbors, i.e. bond diameter d, and iteratively hashes the concatenated (unique) features to a new integer feature. Since the hash function is mapping randomly and uniformly to a 2 32 -size space of integers, the ECFP are often considered to be non-invertible [13]. In this paper, we describe a method to reverse-engineer the extended-connectivity fingerprint and deduce the molecular structure of the compound. Related work analyzes to what extent chemical descriptors can be shared until molecular structures can be reverse engineered. Those studies focused on the disclosure of physico-chemical properties and topological indices. In Masek et al. [14], the authors use an iterative genetic algorithm (GA) to suggest molecular structures that have the same chemical descriptor value(s) as a target compound. The genetic algorithm proceeds with suggested structures that match the descriptor value(s), i.e. minimize the total fitness function, which takes several descriptor values into account. The authors, however, test their method only on 100 selected target compounds and only consider descriptors describing molecules that adhere to the Lipinski rule of Five, or combination of BCUT descriptors [15] and the MACCSkey fingerprint [16]. Using their genetic algorithm, they obtained a high number of false positivesmolecular structures that match the descriptor values but are in fact not the real molecular structure. A similar approach to Masek et al., but not in the context of deducing molecular structures, is done by Winter et. al [17]. In their work for optimizing compounds in a drug discovery endeavor, the authors combine in-silico prediction of molecular properties with an in-silico optimization algorithm to suggest molecules that satisfy, or even positively improve, the desired characteristics defined by the user. Falon et al. [18] proposes a stochastic and deterministic reverse-engineering algorithm to deduce the molecular structure from simple topological indices such as shape [19] and connectivity [20] indices, the Wiener [21] and Balaban J and J t distance indices [22] as well as their developed atomic signature descriptor [23]. In their analyses, the authors define the degeneracy as the number of structures having the same descriptor value in a given chemical database. From a computational point of view, descriptors with a high degeneracy are assumed to be safe to exchange, as those descriptors correspond to an 1-to-N mapping. This intuition becomes obvious when the molecular weight (MW) is exchanged. Given the molecular weight, many possible molecular structures can be deduced. Similar to the work of Masek et al. [14], combining more chemical descriptors can improve the success rate of deciphering the true molecular structure. In their studies however, only 1000 compounds out of PubChem [24] were randomly selected for reverse-engineering and their best method achieves a reconstruction accuracy of 12.2%. Recent work from Kotsias et al. [25] and Maragakis et al. [26] in conditional de novo drug design utilize the ECFP representation of compounds as input (seed) with additional bioactivity labels to narrow and navigate the generative process towards chemical regions of interest. They train a generative model to sample novel compounds that satisfy the bioactivity condition and are to some degree similar to the input ECFP seed. Their study reveals that the trained generative models are able to sample compounds that correspond to the input seed. The motivation of our work differs from [25] and [26], as we want to train a model that learns the relationship between ECFP and its corresponding molecular structure, in contrast to the aforementioned work, that aims to generate new compounds, and by chance can reconstruct the compound that corresponds to the input ECFP.</p><p>Our contributions are two fold. First, we describe the Neuraldecipher (illustrated in Figure 1), a method to decipher the circular extended-connectivity fingerprint (ECFP) [6] to their molecular structure as SMILES representation [27] by formulating the reverse-engineering task as a machine learning (ML) problem. Next, we show how our method is performing on several configurations for the ECFP, based on selected length k of the fingerprint and bond diameter d. These studies attempt to answer the question, to what extent ECFP can be securely shared, until our proposed method can fully reconstruct the molecular structure on unknown fingerprints.</p><!><p>One computational way to achieve the reconstruction would be to compare the given ECFP sample against a large accessible chemical library, where the mapping from ECFP to SMILES representation is known. The molecular structure could then be deduced by either performing an identity check of a given ECFP and the corresponding chemical library, and then returning those samples which match the target ECFP. If the ECFP representation cannot be found in the chemical library, the ECFP should be screened against that chemical library by computing pairwise similarities between the target ECFP and each sample of the reference library. A similarity measure could be the Tanimoto similarity of the respective ECFP pair. Deducing the molecular structure is then achieved by beturning those pairs with highest Tanimoto similarity τ satisfying a defined treshold, e.g. τ > 0.90.</p><p>We formulate the reverse-engineering task as a machine learning problem with the goal to predict the molecular structure given an observed ECFP sample. Our reverse-engineering method is a two-step approach and utilizes the continuous and data-driven molecular descriptor (cddd) [3], a neural network model for the generation of lower-dimensional vector representation of molecular structures. This model utilizes a recurrent autoencoder trained on the task of translating SMILES representation of compounds into their canonical form. Translation works as follows: first, the encoder model translates the input SMILES representation into the cddd-representation, a 512−dimensional dimensional vector representation for compounds, that have been shown to be effective on QSAR prediction and virtual screening tasks [3]. Second, the decoder network translates the cddd into the canonical SMILES representation. The SMILES notation is a representation that encodes the topological molecular graph into a linear string of symbols. Our goal for reverse-engineering is to predict the corresponding cddd vector, given an input ECFP sample. Once we have predicted the cddd vector, we can deduce the molecular structure by utilizing the fixed decoder network, which returns the SMILES representation. Our proposed method has the advantage that we obtain a regression model that is able to predict the molecular structures of ECFP samples more efficiently in a one-shot scenario, as opposed to an autoregressive model that predicts the SMILES representation given an input ECFP. By utilizing the pretrained CDDD model, the Neuraldecipher does not have to learn its own representation of chemical structures and to reconstruct SMILES strings with the correct syntax.</p><!><p>The Neuraldecipher model is a standard feedforward neural network with fully connected layers. Let F ⊂ Z k be the ECFP-space with dimension k, where k is the length of the folded extended-connectivity fingerprint. Depending on bit or count extended-connectivity fingerprints, the entries of the ECFP are either populated with {0, 1} or positive integers Z. The CDDD-space C is a bounded and compact 512-dimensional space, i.e. C ⊂ [−1, 1] 512 . The Neuraldecipher f θ is a regression model, mapping from ECFP-space to the corresponding CDDD-space, i.e. f θ : F → C, where θ is the set of trainable model parameters. Figure 1 illustrates the general reverse-engineering workflow. The training of the Neuraldecipher is done via minimizing the distance l(d) = l(cddd true − cddd predicted ), where l is the logarithmic cosine-hyperbolic function, which is a similar loss function as the L 2 squared-error loss. The logarithmic cosine-hyperbolic function is defined as</p><p>, where d = cddd true − cddd predicted .</p><p>The number of hidden layers and corresponding hidden neuron units depend on the length of the input ECFP, i.e. k and will be discussed in the results Section 3. We used ADAM optimizer with initial learning rate of 10 −4 and 5 • 10 −4 as weight decay coefficient. We trained the Neuraldecipher model for 300 epochs with a batch-size of 256. The learning rate was updated and multiplied by 0.7 according to a plateau scheduler with a patience of 10 epochs with respect to the validation metric. Additionally, we applied early stopping with a patience of 50 epochs with respect to the validation metric. Throughout all training experiments, the validation metric was the loss on a validation set.</p><!><p>The data used in this study were extracted from the ChEMBL25 database [28] and consists of 1, 870, 461 molecular structures. We used RDKit [29] to retrieve the canonical SMILES representation and removed stereochemistry. We also removed duplicates and filtered with RDKit using the same criteria as in [3]: only organic molecules, molecular weight between 12 and 600 Da, more than 3 heavy atoms and a partition coefficient logP between −7 and 5. Furthermore, we stripped the salts and only kept the largest fragments. After this procedure, our processed dataset contains 1, 526, 990 unique canonical SMILES representation. Yet, across many applications, machine learning models often fail to generalize when tested on data distributions different from training data [30]. In order to check whether our model is not overfitting and motivate a real-world scenario, we clustered the processed SMILES dataset into 10 groups. The clusters were obtained by first computing the MACCSkey fingerprint [16] for each SMILES representation using RDKit, and then utilizing sklearn's [31] KMeans clustering implementation on the MACCSkey fingerprints. To obtain training and validation set, we computed the average pairwise distances between each of the 10 cluster centroids. The validation cluster was then selected by retrieving the cluster (in our case, cluster 7) whose centroid was on average the most distant to the other cluster centroids. Finally, our training set consist of 1, 414, 658 samples and validation set of 112, 332 samples. We call this splitting procedure cluster split. To evaluate how our model performs on a random split, we randomly divided the processed dataset into training and validation set with the same validation set size as in the cluster split scenario. Training of the model is done with the training set and model selection is based on the evaluation on the validation set.</p><p>We also test our model on two unseen sets that have no overlap with the training set. The first set is the filtered ChEMBL26 temporal split (with 55, 701 unique compounds) and the second set consists of compounds from one of our internal databases (with 478, 536 unique compounds). The ChEMBL26 temporal split contains compounds that are novel in the ChEMBL26 database 2 , when compared to ChEMBL25. For the internal set, we randomly sampled 500, 000 compounds from one of our processed databases that have no overlap with the ChEMBL25 set. We applied the same preprocessing filter as done before for both sets. Dataset statistics for the processed, internal and temporal sets are listed in Table 1 and distribution plots displayed in Figure 2.</p><!><p>To analyze to which extend ECFPs can be securely exchanged, we created ECFP bit and count vectors for the lengths k ∈ {1024, 2048, 4096, 8192, 16384, 32768}. The bond diameter d was selected as d = 6, leading to ECFP 6,k bit-and count fingerprints. Since the collision of bits/counts with increasing fingerprint size decreases, more information about the molecular structure is preserved in the ECFP. Following this thought, our hypothesis is that deciphering molecular structures on larger ECFP size becomes more accurate.</p><p>To gain insight on how the model is performing on fingerprints created with different bond diameters, we calculated ECFPs of length 4096 and bond diameters {4, 8, 10}.</p><p>CDDD data To train and validate our method, we obtained the cddd vector representation by utilizing the encoder network of Winter et al. [3] for each unique SMILES representation in our processed datasets, i.e. training and validation set (Table 1).</p><!><p>For each ECFP setting introduced earlier, we conducted a hyperparameter search by defining possible parameters and searched for the optimal parameters using grid-and random search with a maximal number of 200 trials. We refer to Supplementary Information (SI) A for description of the hyperparameter optimization and report the general model architecture and training procedure in the following. Each hidden layer consists of three consecutive operations: affine linear transformation, batch-normalization, and ReLU activation. We applied at least 3 hidden layers and decreased the hidden neuron units to 512, followed by the output layer with 512 neurons and applied tanh non-linearity as output activation, since the cddd-vectors are bounded within [−1, 1]. For a detailed view on the Neuraldecipher architecture, see SI Section A. All models were implemented in pytorch [32].</p><!><p>One natural question that arises with any molecular descriptor or fingerprint is the degeneracy. Recall that molecular weight as descriptor has a high degeneracy, since many compounds can correspond to a certain molecular weight. As the ECFP algorithm iteratively maps atomic environments to features, we believe that the computed ECFP sets from our processed dataset (1.4M compounds) contains many unique samples with increasing bond-diameter d. To analyze and confirm the aforementioned, we computed the degeneracy for each configuration and show the degeneracy analysis for the bit ECFPs with length 4096 and increasing bond diameter d in Figure 3.</p><p>The horizontal axis states the degeneracy, i.e. it flags the presence of duplicate, triplicate, and so on. Since we want to count the number, how often duplicates, triplicates, and so on, occure, we excluded the degeneracy of 1, i.e. the number of unique ECFP samples that occure only one time in the processed dataset. A degeneracy of 3 means that 3 different substructures have the same ECFP. Since this can happen multiple times, the vertical axis counts the occurences of each degeneracy within the processed dataset. As the bond diameter d increases for the ECFP d,4096 bit-vectors, the number of unique samples increases, i.e. the degeneracy counts for duplicates, triplicates, etc. decrease. A higher bond diameter in the ECFP algorithm leads to more uniqueness as more substructures are captured when iterating over larger atom environments (see Table 2).  1, 005 6</p><p>The number of non-unique samples for a fixed diameter d = 6 and increasing vector length k does not differ much, as the ECFPs (folded into fixed-length vectors of size k) represent the same substructure in a larger fingerprint vector.</p><p>We refer to the Supplementary Information B for a detailed list of non-unique samples in each setting. Since the cddd-representation benefits from an one-to-one mapping given SMILES in contrast to the ECFPs, an interesting bound to analyze is the distance between encoded cddd representations, where the mapping from ECFP to SMILES is non-unique (we call that set of SMILES tuples S d ). Generally, the impact of the non-uniqueness from ECFPs can compromise the training of the Neuraldecipher in two scenarios. In the first preferable scenario, the (average) distance between cddd's encoded from S d tuples is low. That means low distortion in the corresponding CDDD-space when learning the mapping from ECFP-space to CDDD-space. The second scenario includes a larger average distortion and could degrade the training of the Neuraldecipher, since learning the mapping from ECFP-space to CDDD-space is perturbed as the model encounters ECFP samples that map to diverse cddd representations. To analyze the two possible scenarios, we retrieved the set of SMILES S d that includes tuples (i.e. duplicates, triplicates, etc. see Figure 3), of SMILES representation that map to the same ECFP. We retrieved the corresponding cddd's for each tuple set of S d , and calculated the average cosine distance of each pair in the tuple sets. Figure 4 illustrates the results for the ECFP 6,1024 bit-vector setting.</p><!><p>Figure 4: Mean cosine distance between cddd-representations that belong to the same set of SMILES that map to the same ECFP representation. On average, the cosine distance is small with 0.0417.</p><p>The ambiguity of binary ECFPs with different SMILES representation does not cause a large distortion in the corresponding CDDD-space, as the unsupervised learned representation maps structurally very similar SMILES into close space as indicated in the average cosine distance of 0.0417. The right plot in Figure 4 illustrates two randomly selected pair of molecules for the first scenario (low distortion, i.e. cosine distance ≤ 0.05) and second scenario (high distortion, i.e. cosine distance ≥ 0.20). However in the second scenario, the binary ECFP can misleadingly map to a representation, where the molecules are more different (the molecule pair in the second row of Figure 4 has a cosine distance of 0.3335) . Since the binary-ECFP only captures presence of certain atomic environments (and not counts, as opposed to count-ECFP) the molecules in the second row of the right plot in Figure 4 correspond to the same ECFPs but refer to different cddd-representations with larger distortion.</p><!><p>We trained seperate Neuraldecipher models on a cluster and random split, for each ECFP setting. The ECFP setting was determined by bond diameter d, fingerprint length k and exposure of bitor count ECFPs.</p><p>After training, for the final evaluation on the validation, internal and temporal dataset, we predicted the corresponding cddd-vectors and retrieved the SMILES representation by utilizing the decoder network from Winter et al. [3].</p><p>Varying the length k for fixed diameter d = 6. The results for the ECFP 6,k bit-vectors with increasing length k, trained on cluster and random split are listed in Table 3. The Reconstruction columns in Table 3 correspond to the accuracy of binary string matching between true input SMILES representations and deduced SMILES representations. Hence, the reconstruction refers to the accuracy of correctly deducing the exact molecular structure given the ECFP 6 -bit vectors. The Tanimoto columns state the average Tanimoto similarity between true input SMILES and deduced SMILES representations. To compute the Tanimoto similarity, we retrieved the ECFP 6,1024 -bit fingerprints of true and deduced SMILES and utilized RDKit's Tanimoto similarity implementation. We included the Tanimoto similarity as proxy for the goodness of reverse-engineering, since our model might fail to fully deduce the exact molecular structure but is still able to reconstruct (structurally) similar compounds that resemble the true compound, which could be optimized in a subsequent task. Considering that we are using the decoder network to retrieve the reconstructed SMILES representations of predicted cddd-representations, the validity of reconstructed SMILES, i.e. if the string representation follows the SMILES grammar, is of great importance, especially in generative modeling, see [33]. In all experiments, the SMILES validity on the test datasets (validation, internal, temporal), was most of the time around 98%. We refer to the Supplementary Information C for a detailed view of the validity for each configuration. All metrics were computed using the validation (Val.), temporal (Temp.) and internal (Inter.) datasets, which the models have not seen during training. As expected, models trained on the random split perform better than models trained on the cluster split, when deducing molecular structures from the validation dataset. For example, the model for the ECFP 6,1024 is able to correctly deduce 12.14% from the validation dataset when trained on the cluster split. The reconstruction for the cluster split is lower because the validation dataset contains compounds which likely lie in a chemical space, the model has not seen before. When the model is trained on a random split, 28.70% of the validation dataset can be correctly reverse-engineered. For the internal and temporal datasets, the performance for cluster split and random split are almost similar along all models. This insight is normal and expected, as the data distributions from the internal and temporal sets generally differ from the processed ChEMBL25 dataset. One of our hypotheses was that the probability of reverse-engineering molecular structures from ECFPs increases with larger size, as the ECFPs are less prone to information loss due to hash collision. This is confirmed by our experiments (Table 3), as models trained with larger ECFP 6 input bit-vectors are more capable to correctly deduce the molecular structure in all evaluation datasets. Increasing the ECFP size from 16, 384 to 32, 768 does not improve the performance very much, as the information loss through the hash collision is small. For an analysis on the hash collision for the analyzed fingerprint lengths, we refer to Appendix Section E. In the next study, we trained the models from Table 3 with the same network architectures for each fingerprint length on the ECFP 6 -count vectors. As the ECFP 6 -count vector preserves more information about a molecular structure than the corresponding ECFP 6 -bit vector, the models trained on the ECFP 6 -count vectors are expected to perform better than models trained on bit vectors only. Table 4 shows the results of this study. Table 4: Results for reverse-engineering molecular structures based on ECFP 6 -count vectors. To compute the average Tanimoto similarity for all lengths, we first calculated the ECFP 6,1024 count-vectors for the true and reconstructed SMILES and then parsed the tuple into RDKit's Tanimoto similarity implementation. We selected a fixed ECFP configuration across all lengths k, to have a proper and comparable evaluation on the validation (Valid.), internal (Inter.) and temporal (Temp.) datasets. Higher values are better. Training the Neuraldecipher models on ECFP 6 -count vectors yields better performance metrics as seen in Table 4 compared to Table 3. For the model trained on 1024 length ECFP, the correct reconstruction of molecular structures in the validation dataset improves to 22.49% for the cluster split model when trained on count vectors as opposed to 12.14% when trained on bit vectors. The conclusions made earlier for better performance with increasing fingerprint size are also reflected in the results in Table 4. With our reverse-engineering method, we are able to correctly deduce around 150K compounds from the Bayer internal dataset (478K samples) with 31.73% accuracy, when ECFP-count vectors of length 4096 are shared (see Table 4, Random Split). Considering that we only used publicly available data from ChEMBL to train the Neuraldecipher model, extra caution has to be paid when exchanging ECFPs with legitimate partners, as the protection of molecular structures is of importance for pharmaceutical companies. The validity of SMILES for all models is as before on average 98%. Since the learning rate scheduler and early stopping mechanism for model selection during training is only affected by the validation loss per epoch, we only computed the evaluation metrics in Table 3 and 4 based on the final selected model. To observe the progress of evaluation metrics (i.e. reconstruction accuracy and Tanimoto similarity), we trained the Neuraldecipher on ECFP 6,4096 -count vectors on the cluster split for 300 epochs without early stopping and computed the corresponding metrics after each training epoch. Figure 5 shows the progress of the reconstruction accuracy and Tanimoto similarity over epochs compared with the validation loss.   Figure 5 shows that with decreasing validation loss, the reconstruction accuracy and mean Tanimoto similarity on the validation dataset increase. However, the reconstruction accuracy on the validation data (112, 332 samples) seems volatile and reaches on average 41%. Although the model is not capable to fully deduce the molecular structure, it is able to reconstruct on average compounds that have mean Tanimoto similarity of 72%.</p><!><p>A positive relationship between (1− Tanimoto similarity) and validation loss in Figure 5b is also shown in the analysis when plotting the Euclidean distance in the corresponding CDDD-space for true cddd and predicted cddd and plot it against (1− Tanimoto similarity). We refer to SI Section D for more details.</p><p>Varying the bond diameter d for fixed length k = 4096. The results in Table 3  The results in Table 5 and 6 go along with the finding that models trained on the random split (Table 6) perform better on the validation dataset, compared to models trained on the cluster split. There seems to be no substantial difference between the performance on the internal and temporal datasets, when the model was trained on the cluster or random split (Table 5 and Table 6). Models trained with count-vectors as input perform better than models trained with bit-vectors, as count-vectors preserve more information about the molecular structure. However, we observe that the performance decreases with increasing bond diameter, regardless of which split the model was trained on. Recall that the unfolded ECFP with a larger bond diameter d is a superset of the unfolded ECFP with smaller bond diameter d, because more substructures are captured with higher bond diameter (d > d) during the fingerprint algorithm. So generally, the unfolded ECFP d captures more information than the unfolded ECFP d . Folding the ECFP d to a fixed length of 4096, i.e. to ECFP d ,4096 , comprises a higher information loss due to hash collision 3 than for the ECFP d,4096 . As a result of this, training the Neuraldecipher (with a fixed network architecture) on ECFP 4,4096 representation as input, leads to better performance compared to the setting, when the input is ECFP 6,4096 . The performance decrease from diameter 8 to 10 is comparably small to the other differences (i.e. 4 to 6 and 6 to 8), as the unfolded ECFP 8 representations are in most cases the same as the unfolded ECFP 10 representations and folding these representations into fixed length of 4096 causes the same collision. For a detailed analysis on the hash collision, we refer to Supplementary Information E.</p><p>Comparison Neuraldecipher against Baseline. To further analyze the magnitude of Tanimoto similarity in the cluster validation dataset (112K samples), we compare our method against a purely computation approach from virtual screening (referred as "Library-Analysis Baseline" and explained in the beginning of Section 2).</p><p>For each validation sample, we calculated all pairwise Tanimoto similarities 4 to each sample from the reference (library) training set (1.4M samples). We then computed the average Tanimoto similarity for each validation samples by computing the mean of the aforementioned pairwise similarities ("All-Average"). For the baseline, we selected the top-5 references (training) samples with highest Tanimoto similarity (from the pairwise similarities) and computed the mean of the top-5 references for each validation sample ("Top-5-Average"). The "Top-5-Average" approach demonstrates a weak 5 baseline from compound-library analysis. The "All-Average" procedure aims to show, how similar a validation sample is on average to all samples from reference set, while the "Top-5-Average" procedure aims to show, how similar a validation sample is on average to the top-5 most similar samples from a reference set. Figure 12 displays the Tanimoto similarity distributions between the "All-Average", "Top-5-Average" and our Neuraldecipher model (trained on ECFP 6,4096 count-vectors).  As expected and intended through the cluster split, the Tanimoto similarity between the validation and training (reference) set is small on average with 0.1255. The "Top-5-Average" Baseline (shaded in red in Figure 12) obtains a mean Tanimoto similarity of 0.5053 with fat tails approaching the Tanimoto similarity of 0.8. However, the Baseline (and even Top-1-Average 6 ) cannot reconstruct the validation samples, i.e. reconstruction accuracy of 0. This means that the training (reference) set does not contain the "true" validation samples. This insight goes along with Table 2, displaying 232 non-unique samples for the ECFP 6,4096 count-dataset. In that case, all non-unique samples are represented in the training (reference) set. Our Neuraldecipher however, achieves a reconstruction of 0.4102 and mean Tanimoto similarity of 0.7218. The fat tail of the Neuraldecipher Tanimoto similarity distribution along the horizontal axis between 0.4 and 0.7 (green curve in Figure 12) is likely caused by the contribution of Top-5-Average samples. This means that our Neuraldecipher reconstructs structurally similar molecular compounds of that Tanimoto similarity range, because on average the best structures the model can learn from, also share this Tanimoto similarity of 0.5053. Therefore, there is less probability mass in the Tanimoto range of [0.8; 0.9]. To compare the performance between the Baseline and our method, we plotted the Top-5-Average Tanimoto similarities against the Tanimoto similarities of our reconstructions in Figure 11. Figure 7a and 7b show that our proposed method performs on average better than the Baseline method. Out of 112K validation samples, our method can reconstruct 85K samples that have a higher Tanimoto similarity than the Baseline model, i.e. in 75.89% of all cases. This is illustrated in the points above the bisector line in Figure 7a and more clearly in the distribution plot in Figure 7b for τ 2 − τ 1 > 0.0.</p><p>A justification for the mean Tanimoto similarity of 85.98% (and not larger) for the Neuraldecipher trained on the random split of ECFP 6,4096 -count vectors also relates to the reasoning that the "Top-5-Average" Baseline reaches a mean Tanimoto similarity of 65.76% (see SI Section F).</p><!><p>In this work we proposed a reverse-engineering method to deduce the molecular structure given the extended-connectivity fingerprint (ECFP). To identify to what extend structures can be reconstructed, we tested our method on several fingerprint settings with varying length k and bond diameter d for the ECFP creation. In general, with increasing fingerprint size and count-vectors being revealed, our method is capable of better reconstructing molecular structures from large sets that our method has not seen before. We selected the ECFP to reverse-engineer from, as the ECFP is a commonly used fingerprint in QSAR and ADMET modeling and often considered as non-invertible. In case ECFP-count fingerprints with length 4096 are exchanged (see Table 6), our method is able to correctly reconstruct at least 59% from a random subset of ChEMBL25 (112, 332 unique compounds), 30% from the ChEMBL26 temporal set (55, 701 unique compounds) and 26% from a random subset of one of our internal databases (478, 723 unique compounds). Although, and somehow fortunately, we did not reach a complete reconstruction on the test sets, due to information loss when folding the unfolded ECFP into fixed-length vectors, there might be small improvements by changing the training procedure. Since we have formulated the reverse-engineering task as a machine learning problem, and utilize neural networks as model class, finding the optimal network architecture and formulating different loss function for training entails the chance for better performance. We suggest that extended-connectivity fingerprints should be exchanged with precaution as this yields the potential to harm intellectual property and loss of competitive advantages since our method is capable to reconstruct molecular structures to some extent.    The ECFP As the Euclidean distance increases, the (1−Tanimoto similarity) increases. Interpreting the Euclidean distance and its magnitude in a high-dimensional space is difficult and not straightforward. The Cosine similarity benefits from its property being bounded within −1 and 1. Figure 9b shows the positive correlation (pearson correlation coefficient of 0.6970) between Cosine similarity and Tanimoto similarity. The red lines in Figure 9a and 9b display the linear functions, when regressing the y-axis on the x-axis, indicating the positive trend as well for both plots.</p><!><p>The classical ECFP is an unfolded fingerprint with no pre-defined size and its length depends on the input molecular structure. Since the ECFP algorithm iteratively uses a hash function that maps a list of atom environments (represented as integers) to a new atom environment i ∈ 2 32 and concatenates the result with the earlier list, the components of the final fingerprint can be large integers due to the target space of the hash function. To obtain folded binary or count-vectors from the unfolded fingerprint, the integer entries act as identifier for presence/counts and non-presence in the corresponding binary/count fingerprint. For example, consider a structure where the ECFP algorithm returns an unfolded fingerprint [10,10,80,999,999999]. This leads to an unfolded binary ECFP of length 99999, where the entries {10, 80, 999, 999999} are populated with 1 and 0 elsewhere. The unfolded count fingerprint would have the component-value of 2 for the 10-th position, 1 in position {80, 999, 999999} and 0 elsewhere. Now the "unfolded" binary/count-fingerprints are still variable in length, namely determined by the maximum value of the unfolded ECFP, i.e. in the earlier example 999999. Since machine learning algorithms mostly require a fixed length feature input, the unfolded binary/count fingerprints are folded into fixed length k. The folding operation is usually applied with the modulo operation, by modulo-diving the "on"-positions/keys with k. Applying that, the folded bit/count fingerprint has length k. Assume we set k = 10 such that our bit/count fingerprints have fixed length of 10. Since the unfolded fingerprint is [10, 10, 80, 999, 999999], indicating i-th's entries being "on", we now obtain the entries [0, 0, 0, 9, 9, 9] being "on". For the binary ECFP this would mean that entries {0, 9} are populated with 1 and 0 elsewhere. The count ECFP would be populated with the entry 3 in the components {0, 9}. Folding the fingerprint has led to a fixed fingerprint where only 2 unique keys {0, 9} are on, whereas the original unfolded fingerprint had 4 unique keys {10, 80, 999, 9999}. Therefore, some information is lost. Here, we define the collision degree c as the difference of the number original unique keys and number of new unique keys, i.e. c = 4 − 2 = 2. Note that a collision degree of c = 0 means, that no information is lost after folding ECFP. Increasing k reduces the chance of collision and therefore the information loss.</p><p>For our ECFP 6 configurations, we computed the unfolded ECFP 6 vectors for all compounds in our processed dataset, obtained the number of unique keys and subtracted these values with the number of unique keys for the folded ECFP6 vectors. Figure 10a shows the results for increasing size k. As the fingerprint size k increases, the collision degree of larger than 1 decreases (or in other words, the collision degree of c = 0 increases).</p><p>Since our studies also include the analyses on the Neuraldecipher performance on a fixed fingerprint length k = 4096 but varying bond diameter d ∈ {4, 6, 8, 10}, we also computed the collision degrees for each of the five ECFP datasets with varying bond diameters. The results are shown in Figure 10b.  Figure 10a illustrates that the collision degree of c = 0, i.e. no information loss due to the folding operation, is highest for the ECFP 6 that was folded into length 32768, followed by 16384. The larger the fingerprint size, the smaller the average collision degree µ c is for each setting. A higher average collision degree µ c corresponds to more information loss.</p><p>When fixing the fingerprint length to k = 4096 and increasing the bond diameter d, we observe that the information loss also increases (see increasing average mean collision µ c for increasing bond diamter d in Figure 10b). Since the unfolded ECFP d with higher bond diameter d > d is a superset of the unfolded ECFP d , the number of unique keys for the ECFP d has at least the value of the number of unique keys for the ECFP d . Since the two ECFPs are folded onto the same fixed length of k = 4096, it is natural that the ECFP with higher bond diameter suffers from more information loss. This information loss is shown in the higher number of counts for collisions degrees larger than 1, i.e. counts for c ≥ 1.</p>