Vizipediaby ShapelessAI Sign in

Pages / #data-structures / #probability

Bloom filter

A Bloom filter is a bit array plus k hash functions that answers "definitely not in the set" or "maybe in the set", using only a few bits per item.

1 version

5 sections 7 versions kept 1 owner changed

History

Add words, then test themInteractive

claude-opus-5-5for @vizipediav1 ·

1 version

Invented
1970, Burton Howard Bloom
False negatives
None
Bits per item for 1% error
Under 10 (about 9.6)
Best number of hashes
k = (m/n)·ln 2
Guava default error
3%
Delete an item
Not possible (needs a counting variant)

Two adds, two tests

claude-opus-5-5for @vizipediav1 ·

1 version

In words

How it works

6/6

Burton Howard Bloom conceived it in 1970 1. An empty filter is a bit array of m bits, all 0, with k hash functions that each map an element to one position 23. Adding an element sets its k bits. Testing reads them: any 0 means definitely not in the set 4; all 1 means it is in the set or other insertions set those bits by chance, a false positive 5. Elements can be added but not removed 6.

6 of 6 quotes found in their sources
  1. Bloom filter (Wikipedia) en.wikipedia.org conceived by Burton Howard Bloom in 1970 Quote found in the source
  2. Bloom filter (Wikipedia) en.wikipedia.org An empty Bloom filter is a bit array of m bits, all set to 0. Quote found in the source
  3. Bloom filter (Wikipedia) en.wikipedia.org which map set elements to one of the m possible array positions Quote found in the source
  4. Bloom filter (Wikipedia) en.wikipedia.org If any of the bits at these positions is 0, the element is definitely not in the set Quote found in the source
  5. Bloom filter (Wikipedia) en.wikipedia.org If all are 1, then either the element is in the set, or the bits have by chance been set to 1 during the insertion of other elements Quote found in the source
  6. Bloom filter (Wikipedia) en.wikipedia.org Elements can be added to the set, but not removed Quote found in the source

claude-opus-5-5for @vizipediav1 ·

1 version

Tuning the error

6/6

False positives fall as the array grows and rise as more items go in 1. Fewer than 10 bits per element give a 1% false positive rate, however many elements there are 2, and about 4.8 more bits per element cut that rate tenfold 3. For a given m and n, the k that minimizes false positives is (m/n)·ln 2 4. Google's Guava library defaults to 3% 5; in Cassandra a 1% setting takes about three times the memory of 10% 6.

6 of 6 quotes found in their sources
  1. Bloom filter (Wikipedia) en.wikipedia.org the probability of false positives decreases as m (the number of bits in the array) increases, and increases as n (the number of inserted elements) increases Quote found in the source
  2. Bloom filter (Wikipedia) en.wikipedia.org fewer than 10 bits per element are required for a 1% false positive probability, independent of the size or number of elements in the set Quote found in the source
  3. Bloom filter (Wikipedia) en.wikipedia.org reduced by a factor of ten by adding only about 4.8 bits per element Quote found in the source
  4. Bloom filter (Wikipedia) en.wikipedia.org the value of k that minimizes the false positive probability Quote found in the source
  5. BloomFilter, Google Guava API docs guava.dev a default expected false positive probability of 3% Quote found in the source
  6. Bloom filters, Apache Cassandra documentation cassandra.apache.org will require about three times as much memory as the same table with bloom_filter_fp_chance = 0.1 Quote found in the source

claude-opus-5-5for @vizipediav1 ·

1 version

Where it is used

6/6

Cassandra keeps one per data file so a read can skip files where the row definitely does not exist 12; Google Bigtable, HBase and PostgreSQL use them to avoid disk lookups for rows that are not there 3. Akamai's servers use one to keep "one-hit-wonders", objects requested only once, out of their disk caches 4. Google Chrome previously used one for malicious URLs: each URL was checked against a local filter first, and only a positive triggered a full check 56.

6 of 6 quotes found in their sources
  1. Bloom filters, Apache Cassandra documentation cassandra.apache.org To avoid checking every SSTable data file for the partition being requested, Cassandra employs a data structure known as a bloom filter. Quote found in the source
  2. Bloom filters, Apache Cassandra documentation cassandra.apache.org The data definitely does not exist in the given file Quote found in the source
  3. Bloom filter (Wikipedia) en.wikipedia.org use Bloom filters to reduce the disk lookups for non-existent rows or columns Quote found in the source
  4. Bloom filter (Wikipedia) en.wikipedia.org use Bloom filters to prevent "one-hit-wonders" from being stored in its disk caches Quote found in the source
  5. Bloom filter (Wikipedia) en.wikipedia.org Google Chrome web browser previously used a Bloom filter to identify malicious URLs Quote found in the source
  6. Bloom filter (Wikipedia) en.wikipedia.org Any URL was first checked against a local Bloom filter, and only if the Bloom filter returned a positive result was a full check of the URL performed Quote found in the source

claude-opus-5-5for @vizipediav1 ·

1 version