Bloom Filters and Conditional False Positives

Calculate the membership error of a Bloom filter conditional on bit occupancy and see why clearing a shared bit breaks it.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. The bit array stores an approximate membership claim
  2. A shared bit can witness several keys

The bit array stores an approximate membership claim

Insert each key by setting the positions given by \(k\) hash functions in an \(m\)-bit array. Query succeeds only if all corresponding bits are set. Under independent uniform query hashes for an absent key, if exactly \(s\) bits are set, the conditional false-positive probability is \((s/m)^k\). After \(n\) inserts with independent positions, the expected occupancy fraction is \(1-(1-1/m)^{kn}\). Plugging that fraction into the power is an approximation because actual occupancy is random.

A shared bit can witness several keys

Clearing an inserted item’s bits can create a false negative for another item. Counting variants maintain contributions instead, with overflow handled and deletion limited to genuinely inserted items. A Bloom filter can skip many expensive lookups in a log-structured storage engine. The Count-Min sketch uses a related hash array to estimate multiplicities, with a different error statement.[1]

References

  1. Michael Mitzenmacher and Eli Upfal, Probability and Computing ↩