Matrix Bloom Filter: An Efficient Probabilistic Data Structure for 2-tuple Batch Lookup

Yue Fu, Rong Du, Haibo Hu, Man Ho Au, Dagang LiarXiv 2019

TL;DR

The Matrix Bloom Filter (MBF) extends the classic Bloom filter from a 1D bit-vector to a 2D bit-matrix to efficiently handle 2-tuples (key-value pairs). It enables high-speed batch lookups and "partial existence" queries while preserving the correlation between data dimensions, outperforming traditional hashmaps and multi-dimensional filters in both speed and space efficiency for complex workloads.

The Challenge of Multivariate Data

Standard Bloom filters are the gold standard for approximate membership queries, but they are primarily designed for univariate data. In modern applications like Online Analytical Processing (OLAP) and machine learning, data often comes in pairs—such as (UserID, IPAddress) or (Node, Content).

Existing solutions face significant trade-offs:

  1. Standard Bloom Filters treat the entire tuple as a single string. This makes "partial queries" (e.g., "Which contents does Node A have?") impossible without re-scanning or storing multiple filters.
  2. Multi-dimensional Bloom Filters (MDBF) store each dimension in separate filters. However, they lose the correlation between dimensions (knowing Node A exists and Content 1 exists doesn't prove Node A has Content 1), leading to high false-positive rates.
  3. Hashmaps are exact but consume significant memory and suffer from performance degradation as hash collisions create long chains that must be traversed.

The authors aim to create a structure that supports 2-tuple partial existence tests: the ability to perform batch insertions or queries on one component independently while maintaining the dependency between the two.

The Matrix Bloom Filter Mechanism

The core innovation is the Matrix Bloom Filter (MBF). Instead of a bit-array, it uses a bit-matrix of size $m_1 \times m_2$.

  • Insertion: To insert a tuple $(x_1, x_2)$, the filter hashes $x_1$ to $k_1$ row indices and $x_2$ to $k_2$ column indices. It then sets the $k_1 \times k_2$ bits at the intersections of these rows and columns to 1.
  • Query: To check if $(x_1, x_2)$ exists, it checks those same $k_1 \times k_2$ intersections. If any bit is 0, the tuple is definitely not there.
The Matrix Bloom Filter (MBF) mechanism: hashing two components independently to set bits at their intersections in a 2D matrix.

The authors propose two specialized variants:

  • Maximum Adaptive Matrix BF: Designed for the "worst-case" where data distribution is unknown. It treats rows and columns as dedicated filters, ensuring a low false-positive rate at the cost of a lower load factor (typically $\le 25\%$).
  • Minimum Storage Matrix BF: Optimized for datasets with known statistical properties (like 1-to-1 mappings). It uses a "j-matrix" structure that can achieve the same space efficiency as a standard Bloom filter.

Key Insights and Batching Efficiency

  • Orthogonal Hashing: By hashing dimensions independently but storing them at their intersections, the MBF preserves the "co-existence" relationship without needing to hash the combined tuple string.
  • Batching Efficiency: In a batch query for a single key (e.g., "Does Node A have contents 1, 2, 3...?"), the row hashes for "Node A" are computed only once. The system then only needs to compute column hashes for each content. This reduces complexity from $O(k_1 \times k_2)$ per element to essentially $O(k_2)$ for subsequent elements in the batch.
  • Double-Sided Queries: Because the structure is a matrix, it is symmetric. You can batch-query by key or batch-query by value with equal efficiency, a feat that usually requires two separate hashmaps.

Performance Evaluation

The researchers evaluated their structure using real-world "Bag of Words" datasets (docword.kos and docword.nips) and synthetic data.

False positive rates of the MBF compared to theoretical bounds across different k values and load factors.

Key results include:

  • Constant Time Performance: Unlike hashmaps, where query time increases as the dataset grows due to chain traversal, the MBF maintains a nearly constant comparison time regardless of the proportion of data queried.
  • Speedup: In tests on the KOS dataset, the MBF achieved a runtime of ~1.05 $\mu s$ per query, while a hashmap took ~2.97 $\mu s$. On the NIPS dataset, the MBF was nearly 8x faster than the hashmap approach.
  • Theoretical Validation: The authors proved that the false positive rate of an MBF follows the same mathematical bounds as a standard Bloom filter, meaning you don't sacrifice accuracy for the added dimensionality.

Limitations and Future Work

  • Storage Overhead: The "Maximum Adaptive" version is relatively sparse, which implies it uses more memory than a perfectly packed standard Bloom filter to achieve its batching benefits.
  • Prior Knowledge: The "Minimum Storage" variant is highly efficient but requires prior knowledge of the data distribution (e.g., the ratio of keys to values) to configure it optimally.
  • Higher Dimensions: While the paper focuses on 2-tuples, extension to 3D or higher-dimensional tensors is theoretically possible but would likely increase complexity and sparsity significantly.

Summary updated

BibTeX
@misc{fu2019matrix,
  author = {Yue Fu and Rong Du and Haibo Hu and Man Ho Au and Dagang Li},
  title = {{Matrix Bloom Filter: An Efficient Probabilistic Data Structure for 2-tuple Batch Lookup}},
  year = {2019},
  eprint = {1912.07153},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1912.07153},
}
Figure