Subscribe
AI
6 min read

What Is a Bloom Filter? The 1970 Bit Array That Still Filters the Internet

Every large-scale AI system spends its life answering one question: have we seen this before. A crawler asks it about URLs. A data pipeline asks it about documents. A copyright checker asks it about sentences. The obvious answer, keep a list of everything you have seen, costs more than the work you are trying to save. In 1970 a mathematician named Burton H. Bloom published a workaround in Communications of the ACM: give up certainty on a small fraction of queries, and the memory bill collapses.

What Is a Bloom Filter? The 1970 Bit Array That Still Filters the Internet

Every large-scale AI system spends its life answering one question: have we seen this before. A crawler asks it about URLs. A data pipeline asks it about documents. A copyright checker asks it about sentences. The obvious answer, keep a list of everything you have seen, costs more than the work you are trying to save. In 1970 a mathematician named Burton H. Bloom published a workaround in Communications of the ACM: give up certainty on a small fraction of queries, and the memory bill collapses. The resulting data structure, the Bloom filter, is now buried inside databases, content delivery networks, web crawlers and the deduplication pipelines that feed frontier models.

The trade Bloom made

Bloom's paper was motivated by a hyphenation program for a dictionary of 500,000 words. Ninety percent of the words follow simple rules; the rest need a disk lookup to fetch their specific hyphenation patterns. An ideal, error-free hash table could screen out every pointless disk access, but only by occupying as much fast memory as the whole table Bloom wanted to avoid. He showed that you can shrink the hash area to roughly a fifth of the error-free size and still eliminate about 87 percent of unnecessary disk accesses. A small chance of letting an exception sneak through costs less than perfect memory does.

That is the entire philosophy: the filter never wastes your time on items that are definitely new, and occasionally sends a genuinely new item to the slow path for verification. The reverse never happens.

A flat Olivetti-style illustration: a card at the top sends three arced arrows down into a long row of identical pins, lighting three of them red

How it actually works

A Bloom filter is a bit array of m bits, all initially zero, plus k independent hash functions. To add an item, you hash it k times and set the k resulting bits to 1. To query it, you hash the candidate and check those same k positions. If any of them is still 0, the item is definitely not in the set, because insertion would have set that bit. If all k bits are 1, the item may be in the set, or its bits may have been raised by other items that happen to collide. The filter cannot tell which, and that is the accepted price (Wikipedia has the standard walkthrough).

The asymmetry is what makes it useful. Queries return one of two answers: "definitely not" or "probably yes". False negatives are impossible. False positives are tunable, and in systems where the slow path (a disk read, a verification fetch) is orders of magnitude more expensive than the question, a filter that answers almost all negatives instantly is free money.

The arithmetic of maybe

If you insert n items into m bits using k hash functions, the probability that a fresh non-member still collides is approximately (1 - e^(-kn/m))^k. Choose k optimally, at k = (m/n) ln 2, and the false positive rate depends only on the bits you spend per item, not on the size or format of the items themselves. This is the part that made 1970s memory budgets happy and still makes modern ones happy:

  • About 9.6 bits per element gives a 1 percent false positive rate, whether the elements are 20-byte URLs or 20-kilobyte documents, because the filter stores no content at all.
  • Each additional ~4.8 bits per element cuts the error rate another factor of ten.
  • Query time is constant: k hash computations and k random memory reads, independent of how many items the set already contains.

Put some modern numbers next to it. Suppose a crawler wants to remember 10 billion URLs. The raw strings at a generous 50 bytes per URL cost about 500 GB of RAM for an exact set. A Bloom filter holding the same membership information at a 1 percent false positive rate costs 10 billion x 9.6 bits, about 12 GB. The trade is one new URL in a hundred triggering a pointless double-check, against 40x less memory and O(1) lookups.

Where the filter actually lives

Most of the infrastructure you touch daily consults these sketches before touching disk or the origin server. Akamai found that nearly three-quarters of the objects passing through its caches are requested exactly once, and Bloom filters let it refuse to write those "one-hit wonders" to disk at all. The storage engines behind big-data stacks, Google Bigtable, Apache HBase and Apache Cassandra, keep a per-table Bloom filter so that a query for a row that does not exist never pays for the disk seek that would prove it. RocksDB does the same for every sorted string table it writes, and Cloudflare wrote a practical post on what goes wrong when a filter's traffic assumptions stop holding and it quietly degenerates into saying yes to everything.

The common thread is direction: the filter protects an expensive resource from being asked about things that are almost certainly not there.

A flat Olivetti-style illustration: a conveyor of mixed sheets feeds a perforated funnel that sorts sheets into a through-stack and a rejected pile

What it does inside the AI pipeline

The three most interesting modern uses are all in the path between raw text and a trained model.

Deduplication at training-data scale. Hugging Face's DataTrove, the library used to build the FineWeb corpora, ships a Bloom filter deduplication block. Its default configuration breaks each document into shingles of 13 word n-grams, hashes them into a shared bit array, and flags documents whose shingle hit rate crosses 0.8 as duplicates. It is the cheap first pass: a sketch says "you have probably seen this text", and the pipeline drops the document without ever comparing the two originals.

Training-data transparency. Marc Marone and Benjamin Van Durme proposed Data Portraits: a Bloom filter of every string in a corpus, published alongside the model. Anyone can then ask "did this example appear in training?" against a sketch that costs about 3 percent of the dataset size, instead of demanding the full corpus. Their implementation documented two popular corpora, The Pile and The Stack, and used it to surface test-set leakage, contamination that benchmark scores quietly depend on.

Inference-time copyright. The follow-up work, Certified Mitigation of Worst-Case LLM Copyright Infringement by Jingyu Zhang, Jiacan Yu, Marone and Van Durme, points the filter at model output instead of model input. BloomScrub runs every n-gram of generated text against a Bloom filter built from a copyrighted corpus; consecutive hits stitch together into long verbatim quotes, which a rewriter replaces. Because the filter guarantees no false negatives, the pipeline can certify that no flagged source survives in the output, without anyone storing the copyrighted text verbatim at all.

The limits Bloom did not fix

Three weaknesses are structural, not bugs. First, plain Bloom filters cannot delete: clearing a bit that belongs to your item may silently break other items that share it. Counting variants replace bits with small counters, at several times the space; if deletions are frequent, cuckoo filters, which store short fingerprints instead of bits, support removal and usually beat Bloom on space too.

Second, filters saturate. They are sized for an expected n; overrun it and the false positive rate drifts upward, eventually turning the filter into a device that says "probably yes" to everything. Production systems, including Cloudflare's, plan rebuilds into the architecture.

Third, "probably" is only acceptable when the verification path is cheap and occasional. A dedup pass can afford to drop one clean document in a hundred. A cache that must never serve stale content, or a privacy claim that treats the sketch as safe to publish, is asking the filter to be something it is not. The successors acknowledge the same trade at better prices: Peter Dillinger's Ribbon filter squeezes space down near the information-theoretic limit, and RocksDB has shipped it as a supported alternative since version 6.15.

Bloom's own example, a hyphenation dictionary, is long dead. The constraint that produced it, memory that costs more than the errors you accept, has not gone away; it just moved from mainframe drums to GPU HBM and petabyte-scale crawl buckets. The next time a language model pipeline quietly drops a near-duplicate document, the thing deciding it has been seen before is most likely a row of ones and zeros set by a five-and-a-half-decade-old counting trick.

Sources

AILLMeducational