[Paper Review] Learned Monotone Minimal Perfect Hashing
LeMonHash is a learned monotone minimal perfect hashing technique that uses a piecewise linear model (PGM-index) to estimate key ranks and a retrieval structure (BuRR) to resolve collisions, achieving up to 34% lower space usage and 19× faster query performance than top competitors on integer datasets. It also introduces LeMonHash-VL for variable-length strings, matching best-in-class space usage while offering up to 3× faster queries.
A Monotone Minimal Perfect Hash Function (MMPHF) constructed on a set S of keys is a function that maps each key in S to its rank. On keys not in S, the function returns an arbitrary value. Applications range from databases, search engines, data encryption, to pattern-matching algorithms. In this paper, we describe LeMonHash, a new technique for constructing MMPHFs for integers. The core idea of LeMonHash is surprisingly simple and effective: we learn a monotone mapping from keys to their rank via an error-bounded piecewise linear model (the PGM-index), and then we solve the collisions that might arise among keys mapping to the same rank estimate by associating small integers with them in a retrieval data structure (BuRR). On synthetic random datasets, LeMonHash needs 34% less space than the next larger competitor, while achieving about 16 times faster queries. On real-world datasets, the space usage is very close to or much better than the best competitors, while achieving up to 19 times faster queries than the next larger competitor. As far as the construction of LeMonHash is concerned, we get an improvement by a factor of up to 2, compared to the competitor with the next best space usage. We also investigate the case of keys being variable-length strings, introducing the so-called LeMonHash-VL: it needs space within 13% of the best competitors while achieving up to 3 times faster queries than the next larger competitor.
Motivation & Objective
- To address the long-standing challenge of achieving both low space usage and high query speed in monotone minimal perfect hashing (MMPHF) for integer and string keys.
- To explore whether learning-based data structures can outperform traditional, trie-based MMPHF designs in practice.
- To develop a method that leverages data smoothness and local uniformity to minimize space and accelerate construction and query times.
- To extend the approach to variable-length strings with minimal space overhead and high performance.
Proposed method
- Leverage the PGM-index to learn a monotone, error-bounded piecewise linear approximation mapping keys to estimated ranks.
- Use a compressed data structure to store the global rank of the first key in each bucket, enabling fast rank lookup.
- Resolve collisions within buckets by storing local ranks using the BuRR retrieval structure, which avoids storing the keys directly.
- Apply alphabet reduction and recursion thresholds in LeMonHash-VL to handle variable-length strings efficiently.
- Optimize the PGM mapper with a fixed error bound (ε = 31 for integers, ε = 63 for strings) to balance segment length and collision resolution.
- Integrate the PGM and BuRR components in a two-level hierarchy: global bucket rank indexing followed by local collision resolution.
Experimental results
Research questions
- RQ1Can a learning-based approach outperform traditional trie-based MMPHF constructions in terms of space and query speed on integer datasets?
- RQ2How effective is the combination of a piecewise linear model (PGM) and a retrieval structure (BuRR) in minimizing space usage while maintaining O(1) query time?
- RQ3To what extent can data smoothness and local uniformity in key distributions be exploited to reduce space and construction time?
- RQ4Can the learned approach be extended to variable-length strings with competitive space and performance characteristics?
- RQ5Does the use of error-bounded piecewise linear models break the theoretical superlinear space lower bound in practice?
Key findings
- On synthetic random integer datasets, LeMonHash uses 34% less space and achieves 16× faster query throughput than the next best competitor.
- On real-world integer datasets, LeMonHash uses space comparable to or better than the best competitors while achieving up to 19× faster query performance.
- LeMonHash improves construction throughput by up to a factor of 2 compared to the next-best competitor in terms of space usage.
- LeMonHash-VL achieves space usage within 13% of the best competitors on string datasets while offering up to 3× faster query throughput.
- The method outperforms all competitors simultaneously in space, construction, and query performance on most tested datasets.
- The approach breaks the superlinear space lower bound in practice by exploiting local uniformity in key distributions, particularly when combined with error-bounded PGM modeling.
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.