[Paper Review] PHOBIC: Perfect Hashing With Optimized Bucket Sizes and Interleaved Coding
PHOBIC introduces optimized bucket size distribution and interleaved coding to improve the space efficiency and construction speed of PTHash-based minimal perfect hashing. By characterizing an optimal expected bucket size distribution and encoding seeds across partitions in a statistically uniform, interleaved manner, PHOBIC achieves 0.17 bits/key better space efficiency than PTHash at equivalent query speed, with construction up to 83× faster and GPU acceleration enabling 28 ns/key construction at 1.76 bits/key.
A minimal perfect hash function (MPHF) maps a set of n keys to {1, ..., n} without collisions. Such functions find widespread application e.g. in bioinformatics and databases. In this paper we revisit PTHash - a construction technique particularly designed for fast queries. PTHash distributes the input keys into small buckets and, for each bucket, it searches for a hash function seed that places its keys in the output domain without collisions. The collection of all seeds is then stored in a compressed way. Since the first buckets are easier to place, buckets are considered in non-increasing order of size. Additionally, PTHash heuristically produces an imbalanced distribution of bucket sizes by distributing 60% of the keys into 30% of the buckets. Our main contribution is to characterize, up to lower order terms, an optimal distribution of expected bucket sizes. We arrive at a simple, closed form solution which improves construction throughput for space efficient configurations in practice. Our second contribution is a novel encoding scheme for the seeds. We split the keys into partitions. Within each partition, we run the bucket distribution and search step. We then store the seeds in an interleaved way by consecutively placing the seeds for the i-th buckets from all partitions. The seeds for the i-th bucket of each partition follow the same statistical distribution. This allows us to tune a compressor for each bucket. Hence, we call our technique PHOBIC - Perfect Hashing with Optimized Bucket sizes and Interleaved Coding. Compared to PTHash, PHOBIC is 0.17 bits/key more space efficient for same query time and construction throughput. We also contribute a GPU implementation to further accelerate MPHF construction. For a configuration with fast queries, PHOBIC-GPU can construct a perfect hash function at 2.17 bits/key in 28 ns per key, which can be queried in 37 ns on the CPU.
Motivation & Objective
- To improve the space efficiency and construction speed of PTHash-based minimal perfect hashing while maintaining fast query times.
- To characterize an optimal distribution of expected bucket sizes, up to lower-order terms, to minimize construction time and space usage.
- To design a novel encoding scheme for hash function seeds that enables efficient compression through partition-based interleaving.
- To implement and evaluate a GPU-accelerated construction pipeline for further performance gains.
- To demonstrate that the proposed method achieves better space-time trade-offs than existing state-of-the-art MPHF constructions.
Proposed method
- The paper derives a closed-form, optimal expected bucket size distribution that minimizes construction cost, taking the imbalance strategy of PTHash to its logical conclusion.
- It introduces interleaved coding: seeds from the i-th bucket of each partition are stored consecutively, enabling uniform compression per bucket.
- The method uses partitioning to allow parallel construction, with seeds stored in a way that preserves statistical similarity across buckets for effective compression.
- A GPU implementation is developed to accelerate the seed-finding phase, particularly for large-scale key sets.
- The approach combines optimized bucket sizing with partitioned, interleaved seed encoding to improve compression and reduce construction time.
- The method supports various compression schemes (e.g., Rice coding) tuned per bucket, enhancing overall space efficiency.
Experimental results
Research questions
- RQ1What is the optimal distribution of expected bucket sizes that minimizes construction cost in minimal perfect hashing?
- RQ2How can seed encoding be restructured to improve compression efficiency when using partitioned construction?
- RQ3Can interleaved storage of seeds from corresponding bucket positions across partitions lead to better compression and faster construction?
- RQ4To what extent can GPU acceleration improve the construction throughput of minimal perfect hash functions?
- RQ5How does the proposed method compare in space, construction time, and query speed to existing state-of-the-art MPHF techniques?
Key findings
- PHOBIC achieves 0.17 bits/key better space efficiency than PTHash while maintaining identical query performance.
- For a configuration with 1.86 bits/key and similar query time, PHOBIC constructs the MPHF 83 times faster than the original PTHash implementation.
- The GPU-accelerated PHOBIC-GPU achieves a construction time of 28 ns per key at 2.17 bits/key, with query time of 37 ns per query on the CPU.
- PHOBIC-GPU achieves a 62× speedup in construction over the multithreaded CPU version when using λ=9 and interleaved Rice coding.
- Energy consumption for GPU construction is approximately 30× lower than for multithreaded CPU construction, with 405W vs. 195W during peak phases.
- Despite lower space efficiency, SIMDRecSplit achieves faster construction than PHOBIC, highlighting trade-offs in design choices.
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.