[Paper Review] Practical Hash Functions for Similarity Estimation and Dimensionality Reduction
This paper evaluates mixed tabulation hashing as a practical, provably good alternative to commonly used hash functions in similarity estimation and feature hashing. It demonstrates that mixed tabulation matches the performance of truly random hashing in both theoretical concentration bounds and real-world experiments, outperforming multiply-mod-prime and MurmurHash3 in reliability and speed—being 40% faster than MurmurHash3 while providing strong theoretical guarantees.
Hashing is a basic tool for dimensionality reduction employed in several aspects of machine learning. However, the perfomance analysis is often carried out under the abstract assumption that a truly random unit cost hash function is used, without concern for which concrete hash function is employed. The concrete hash function may work fine on sufficiently random input. The question is if it can be trusted in the real world when faced with more structured input. In this paper we focus on two prominent applications of hashing, namely similarity estimation with the one permutation hashing (OPH) scheme of Li et al. [NIPS'12] and feature hashing (FH) of Weinberger et al. [ICML'09], both of which have found numerous applications, i.e. in approximate near-neighbour search with LSH and large-scale classification with SVM. We consider mixed tabulation hashing of Dahlgaard et al.[FOCS'15] which was proved to perform like a truly random hash function in many applications, including OPH. Here we first show improved concentration bounds for FH with truly random hashing and then argue that mixed tabulation performs similar for sparse input. Our main contribution, however, is an experimental comparison of different hashing schemes when used inside FH, OPH, and LSH. We find that mixed tabulation hashing is almost as fast as the multiply-mod-prime scheme ax+b mod p. Mutiply-mod-prime is guaranteed to work well on sufficiently random data, but we demonstrate that in the above applications, it can lead to bias and poor concentration on both real-world and synthetic data. We also compare with the popular MurmurHash3, which has no proven guarantees. Mixed tabulation and MurmurHash3 both perform similar to truly random hashing in our experiments. However, mixed tabulation is 40% faster than MurmurHash3, and it has the proven guarantee of good performance on all possible input.
Motivation & Objective
- To evaluate the practical performance of mixed tabulation hashing in real-world machine learning workloads involving similarity estimation and feature hashing.
- To assess whether commonly used hash functions like multiply-mod-prime and MurmurHash3 introduce bias or poor concentration in practice, despite their widespread use.
- To compare mixed tabulation hashing against other hash functions in terms of speed, accuracy, and theoretical guarantees.
- To provide empirical and theoretical evidence that mixed tabulation hashing performs nearly as well as truly random hashing in applications like OPH and FH.
- To advocate for mixed tabulation as the preferred choice in practice due to its combination of speed, reliability, and provable performance.
Proposed method
- The authors implement and evaluate mixed tabulation hashing in two core applications: one permutation hashing (OPH) and feature hashing (FH).
- They conduct extensive experiments on synthetic data, MNIST, and News20 datasets to measure norm concentration and retrieval quality in LSH-based similarity search.
- For feature hashing, they compute the squared L2 norm of transformed vectors across 100 repetitions to assess variance and bias.
- For LSH with OPH, they measure the #retrieved / recall-ratio across different K and L values, focusing on K=L=10 for clarity.
- They compare mixed tabulation against multiply-mod-prime, 2-wise PolyHash, MurmurHash3, and CityHash in terms of speed and accuracy.
- They derive improved concentration bounds for FH under truly random hashing and show mixed tabulation achieves similar performance when input vectors are sparse.
Experimental results
Research questions
- RQ1Does mixed tabulation hashing perform as well as truly random hashing in practical applications like OPH and FH?
- RQ2Can commonly used hash functions like multiply-mod-prime and MurmurHash3 introduce systematic bias or poor concentration in real-world data?
- RQ3How does mixed tabulation compare in speed and accuracy to MurmurHash3 and CityHash in similarity estimation and dimensionality reduction?
- RQ4To what extent do theoretical guarantees of mixed tabulation translate into practical robustness across diverse data distributions?
- RQ5Is mixed tabulation a reliable and efficient alternative to heuristic hash functions in machine learning pipelines?
Key findings
- Mixed tabulation hashing achieves performance nearly identical to truly random hashing in both norm concentration and LSH recall, with minimal bias and excellent concentration.
- Multiply-mod-prime hashing leads to significant overestimation of similarities and poor concentration, especially on structured or real-world data, despite being fast.
- MurmurHash3 performs similarly to truly random hashing in practice but lacks theoretical guarantees, making it less reliable under adversarial or structured inputs.
- Mixed tabulation is 40% faster than MurmurHash3 while matching its empirical performance, making it a superior practical choice.
- On the MNIST dataset, 2-wise PolyHash produced a norm of 16.671, while mixed tabulation achieved only 2.077, demonstrating severe bias in weaker hash functions.
- The #retrieved / recall-ratio metric showed that multiply-mod-prime consistently underperforms due to over-retrieval, despite slightly higher recall.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.