Hash Collisions in Molecular Fingerprints: Effects on Property Prediction and Bayesian Optimization
Walter Virany, Austin Tripp · 2025
Read Hash Collisions in Molecular Fingerprints: Effects on Property Prediction and Bayesian Optimization by Walter Virany, Austin Tripp (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2511-17078.txt.
Introduction
Walter Virany and Austin Tripp examine a flaw in the fingerprint codes used to represent molecules in computer models. Fingerprints hash parts of a molecule into a fixed-length code, and sometimes two unlike parts land on the same slot. Such clashes make unlike molecules look more alike than they are, which can distort predictions of their traits.
The pair compares standard squashed fingerprints with exact ones that avoid clashes, using process models to predict traits on five test sets. Exact fingerprints give a small but steady gain in prediction accuracy. That gain, though, does not carry over to the guided search for better molecules, where scores stay about the same. The work helps chemists judge when paying for exact codes is worth the cost.
Catalog record
| CREATOR | Walter Virany, Austin Tripp |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 28 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2511-17078
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Hash Collisions in Molecular Fingerprints: Effects on Property Prediction and Bayesian Optimization Walter Virany, Austin Tripp Abstract Molecular fingerprinting methods use hash functions to create fixed-length vector representations of molecules. However, hash collisions cause distinct substructures to be represented with the same feature, leading to overestimates in molecular similarity calculations. We investigate whether using exact fingerprints improves accuracy compared to standard compressed fingerprints in molecular property prediction and Bayesian optimization where the underlying predictive model is a Gaussian process. We find that using exact fingerprints yields a small yet consistent improvement in predictive accuracy on five molecular property prediction benchmarks from the DOCKSTRING dataset. However, these gains did not translate to significant improvements in Bayesian optimization performance. 1 Introduction Molecular fingerprints are vector representations that encode chemical structure information ( Yang et al. 2022 ) . Despite substantial advances in AI, neural network representations of molecules have not been shown to robustly outperform fingerprints on molecular property prediction tasks, particularly given limited training data ( Green et al. 2023 ; Praski et al. 2025 ) . Ideally, each dimension in a molecular fingerprint should represent a unique substructure in a molecule. For example, in Extended Connectivity Fingerprints (ECFPs) ( Rogers and Hahn 2010 ) , 1 1 1 Alternatively known as Morgan fingerprints. Arguably, this is the most popular type of fingerprint. each dimension represents a circular substructure up to a given radius. However, due to the combinatorially large number of possible substructures, such fingerprints would be extremely high dimensional. Common practice is to instead use a fixed -length vector, usually of dimension 1024 or 2048, using hash functions to map substructure to a dimension. When there are more structures present than the length of this vector, it will inevitably result in collisions , where a single dimension is used to represent multiple distinct substructures. An example of this is given in Figure 1 . Figure 1: Example of collisions. (Left) Two structurally different molecules (SMILES strings are CC(=O)OC1=CC=CC=C1C(=O)O and CC(C)CC1=CC=C(C=C1)C(C)C(=O)O ) with highlighted circular substructures of radius 2. (Middle) Highlighted substructures and their corresponding Morgan identifiers, as well as the resulting hash values after taking modulo 32 (corresponding to the fingerprint size). (Right) Fingerprint vector where both distinct substructures map to the same element given by the hash key, demonstrating how different substructures can map to the same dimension. Intuitively, one would expect the effect of such collisions to be problematic, since it prevents machine learning algorithms from distinguishing between substructures whose effects may be different. In this paper we investigate this hypothesis quantitatively using Gaussian process (GP) models. Because GPs are kernel methods which typically use the similarity between fingerprints as input, the effect of hash collisions can be isolated without introducing confounding factors like a changed number of parameters. Our results in § 4 show that eliminating collisions results in a small but consistent improvement on regression metrics, but has a negligible effect on Bayesian optimization (BO) performance. Given GPs’ natural applicability to lab-in-the-loop active learning tasks ( Moss and Griffiths 2020 ; Griffiths et al. 2023 ) , we believe these results provide important guidance to practitioners. 2 Background 2.1 Gaussian processes GPs are a commonly used class of probabilistic models which assume that the data follows a joint multivariate Gaussian distribution. The mean of the distribution is given by a mean function \mu:\mathcal{X}\to\mathbb{R} , and the covariance is given by a positive-definite kernel function k:\mathcal{X}\times\mathcal{X}\to\mathbb{R} , where \mathcal{X} denotes some input space. A detailed treatment of GPs can be found in several textbooks ( Rasmussen and Williams 2006 ; Garnett 2023 ) . GPs have become popular for molecular property prediction due to their efficacy in low-data regimes ( Green et al. 2023 ; Moss and Griffiths 2020 ; Griffiths et al. 2023 ) . A common choice of kernel function for molecular fingerprints is the Tanimoto kernel , which computes the Tanimoto similarity between two molecules, defined as k_{\text{Tanimoto}}(\mathbf{x},\mathbf{x}^{\prime})=\frac{\sum_{i}\min\left(x_{i},x_{i}^{\prime}\right)}{\sum_{i}\max\left(x_{i},x_{i}^{\prime}\right)}\ , (1) where \mathbf{x},\mathbf{x}^{\prime} are molecular fingerprint vectors. The full covariance function then takes the form k(\mathbf{x},\mathbf{x}^{\prime})=a^{2}\,k_{\text{Tanimoto}}(\mathbf{x},\mathbf{x}^{\prime})+\sigma_{n}^{2}\,\delta(\mathbf{x},\mathbf{x}^{\prime})\ , (2) where a^{2} and \sigma_{n}^{2} are the amplitude and noise variance hyperparameters respectively, and \delta(\mathbf{x},\mathbf{x}^{\prime}) is the Kronecker delta. 2.2 Bayesian optimization BO is a sequential optimization method for expensive black-box functions ( Garnett 2023 ) . BO uses a probabilistic surrogate model (commonly a GP) to approximate the unknown objective function from observed data. At each iteration, an acquisition function balances exploration of uncertain regions with exploitation of promising areas to select the next point(s) to evaluate. In molecular optimization, this corresponds to selecting molecules for expensive experimental evaluation (e.g., synthesis and testing). The acquired data is used to retrain the surrogate model, yielding a more accurate approximation of the objective function. This process is then repeated until some stopping criterion is met (e.g., budget exhausted or satisfactory molecules found). BO heavily relies on accurate predictions of the objective function by the surrogate model. However, as we established, when using a GP surrogate model, the performance can suffer as a result of overestimates of the similarities between molecules. This paper investigates whether exact fingerprints improve GP accuracy and whether this has a substantial effect on BO performance. 3 Methods 3.1 Fingerprint representations We evaluated three different strategies for encoding molecular fingerprints. Exact fingerprints, as previously mentioned, preserve all unique substructures without compression, resulting in variable-length representations depending on the number of unique substructures present in the molecule. In contrast, compressed fingerprints use fixed-length vectors with RDKit’s default hash function, causing collisions when the number of unique substructures exceeds the vector dimension. Finally, we used the Sort&Slice method as proposed by Dablander et al. 2024 , which selects the most frequently occurring substructures from a reference dataset rather than using hash-based folding. This eliminates collisions for the most common substructures, reducing the number of hash collisions overall. For all three approaches, we used count-based ECFPs with radius 2. Count fingerprints store the frequency of each substructure, as opposed to binary fingerprints which only indicate the presence/absence of each substructure. Our rationale for this was to include as much information as possible in the compressed fingerprints, in order to not give exact fingerprints an artificial advantage. For the Sort&Slice method, we calibrated the substructure selection using the ZINC250k dataset. Thus, all three fingerprint methods compute the same underlying substructure identifiers, with differences arising solely from how these are encoded into vectors. 3.2 Gaussian process implementation Standard GP libraries typically require fixed-dimensional input vectors, making them incompatible with exact fingerprints that have variable dimensions. To address this, we developed a custom GP implementation that works directly with RDKit fingerprint objects by computing Tanimoto similarities using the Tanimoto kernel and storing only the resulting kernel matrices. This approach enables fair comparison between exact and fixed-length fingerprints using identical GP methodology with performance differences attributable solely to the fingerprint representation and resulting kernel evaluations. 3.3 Experiment design Datasets and tasks. We evaluated our methods on five protein-ligand docking targets from the DOCKSTRING regression benchmark ( García-Ortegón et al. 2022 ) . DOCKSTRING provides a dataset of over 260,000 diverse molecules each docked against 58 protein targets, resulting in over 15 million docking scores. The five targets in the regression benchmark span