arXiv:2611.01599cs.DSNov 2026

Manuscript Offprint

arXiv:2611.01599

Fresh-Priority Eviction for Cuckoo Filters: Exploiting Latent Randomness Under XOR Hashing

Min Liu

Abstract

Cuckoo filters are a widely adopted approximate membership query (AMQ) data structure that supports insertions, lookups, and deletions with low memory overhead. At high load factors, however, insertion performance degrades sharply due to the random-walk eviction process, which may require a large number of element relocations. Recent work on bucketized cuckoo hash tables has shown that fresh-priority eviction, which preferentially evicts elements whose alternate bucket location has not yet been used, achieves O(ℓm)O(\ell m) total expected evictions for bucket size ℓ\ell, an improvement over the standard random walk. In this paper, we show that this technique transfers to cuckoo filters despite their use of XOR-based partial-key hashing. The key insight is that a fresh element's fingerprint, although stored in the table, is not examined by the eviction policy, so when the fingerprint length satisfies k=Ω(log⁡m)k = \Omega(\log m), the alternate bucket hash remains a near-uniform random variable, a property we call latent randomness. We prove that under this condition the corruption graph remains subcritical and the total number of evictions is O(ℓmlog⁡m)O(\ell m \log m); we conjecture the tighter O(ℓm)O(\ell m) bound holds via the full amortized analysis of Bell and Kuszmaul. We further propose encoding the fresh/kicked state implicitly by the element's position within its bucket, requiring no additional per-element metadata. Experimental results on a filter with 2222^{22} slots and 8-bit fingerprints demonstrate 1.2×1.2\times to 2.4×2.4\times fewer evictions at load factors between 94% and 99% for bucket size ℓ=8\ell = 8, and a 1.73×1.73\times reduction in cumulative evictions to full capacity.

1 Introduction

Approximate membership query (AMQ) data structures are fundamental building blocks in networking, databases, storage systems, and many other areas of computer science [8, 22]. Given a set SS, an AMQ structure supports membership queries with a tunable false-positive rate ε\varepsilon while using substantially less memory than an exact representation. AMQ structures also appear in online caching systems [19], where they help reduce unnecessary computation or data access. The classic Bloom filter [5] has been the dominant AMQ structure for decades, but it has well-known limitations: it does not support deletions, and its cache performance is poor when the number of hash functions is large [28, 20].

The cuckoo filter, introduced by Fan et al. [15], addresses both shortcomings. It stores compact fingerprints in a bucketized cuckoo hash table, supports deletions, and achieves better cache locality by accessing at most two bucket-sized cache lines per query. Cuckoo filters have seen wide adoption in practice [27, 18, 7] and have inspired numerous variants, including resizable filters [32, 30], persistent-memory filters [31], variable-length encoding [11], and novel hash table architectures [29, 14, 4].

However, cuckoo filters share a fundamental challenge with cuckoo hash tables: as the load factor approaches capacity, the insertion procedure relies on a random-walk eviction process that may require many element relocations (“kicks”). In practice, a cap on the maximum number of kicks is imposed (typically 500), and when this cap is reached, the insertion fails. The number of kicks grows rapidly near full capacity, creating a sharp performance cliff that limits the practical load factor. Reducing this insertion overhead is therefore important for data-intensive applications, where memory-efficient data structures must sustain high insertion throughput.

Recently, Bell and Kuszmaul [3] resolved a long-standing open problem on the insertion complexity of bucketized cuckoo hashing. They showed that by preferring to evict fresh elements (those whose alternate bucket location has never been used), the total number of evictions to insert mm elements into a table with mm slots and bucket size ℓ\ell is O(ℓm)O(\ell m) in expectation, an improvement over the ω(ℓm)\omega(\ell m) evictions required by the standard random walk at the optimal load threshold. The key idea is that a fresh element's second hash value is an independent random variable that has not yet influenced any algorithmic decision, so the eviction process explores the hash table uniformly rather than getting trapped in cycles [23, 2].

Challenge: XOR hashing in cuckoo filters. Transferring this technique from cuckoo hash tables to cuckoo filters is not immediate. In a cuckoo hash table, each element xx has two independent hash values h1(x)h_1(x) and h2(x)h_2(x). In a cuckoo filter, however, the element itself is not stored; only its fingerprint f(x)f(x) is kept, and the alternate bucket is computed via the XOR-based formula

halt(x)=h1(x)⊕HASH(f(x)),(1)h_{\mathrm{alt}}(x)=h_1(x) \oplus \mathrm{HASH}(f(x)), \tag{1}

where HASH is a hash function applied to the fingerprint [15]. Since halth_{\mathrm{alt}} depends on the stored fingerprint f(x)f(x), which in turn depends on h1(x)h_1(x), one might worry that the two bucket locations are no longer independent, potentially invalidating the analysis.

Our contribution. We make three contributions:

  1. Latent randomness under XOR hashing. We show that the fresh-priority eviction scheme preserves a latent randomness property for cuckoo filters when the fingerprint length satisfies k=Ω(log⁡m)k=\Omega(\log m). The crucial observation is that although the fingerprint f(x)f(x) is stored in the table, it is never examined by the eviction policy, which only checks bucket occupancy and the fresh/kicked status of elements. Therefore, when a fresh element is evicted for the first time, its alternate bucket halt(x)h_{\mathrm{alt}}(x) is a near-uniform random variable over the buckets, and we prove that the corruption graph remains subcritical with O(ℓmlog⁡m)O(\ell m \log m) total expected evictions (Section 4).

  2. Proposed zero-overhead state encoding. We observe that the fresh/kicked state of each element can in principle be encoded implicitly by its position within the bucket: fresh elements are inserted at the front and kicked elements at the back. Eviction scans front-to-back, naturally preferring fresh elements. If the positional invariant is maintained exactly, this requires no additional per-element metadata beyond what a standard cuckoo filter already stores (Section 3). Our experiments use an explicit 1-bit flag per slot to guarantee the exact fresh/kicked distinction; the positional encoding is described as a potential production optimization whose formal equivalence we leave to future work.

  3. Experimental validation. We implement and benchmark both the standard random-walk and the fresh-priority eviction schemes for cuckoo filters with bucket sizes ℓ∈{4,8}\ell \in \{4, 8\}. At fine-grained load factors between 94% and 99% with ℓ=8\ell=8, fresh-priority eviction reduces the average number of kicks per insertion by 1.2×1.2\times to 2.4×2.4\times, and reduces cumulative total kicks to full capacity by 1.73×1.73\times (Section 5).

Organization. Section 2 reviews cuckoo filters and the Bell-Kuszmaul framework. Section 3 presents our fresh-priority eviction scheme. Section 4 provides the theoretical analysis. Section 5 reports experimental results. Section 7 concludes.

References (32)