Research
Bloom Filter Encoding for Machine Learning
Overview Research area: Machine learning preprocessing and data representation, combining probabilistic data structures (Bloom filters) with classification across text, time-series, tabular, and image

- arXiv
- 2512.19991
- Published
- 2025-12-23
- Authors
- John Cartmell, Mihaela Cardei, Ionut Cardei
AI summary
Overview
- Research area: Machine learning preprocessing and data representation, combining probabilistic data structures (Bloom filters) with classification across text, time-series, tabular, and image data.
- Technical level: Intermediate. The core idea is intuitive, but the paper assumes familiarity with hashing, bit-array density, false positive rates, and standard classifier evaluation metrics.
- Scope: The paper evaluates whether a Bloom filter transform can serve as a general-purpose, memory-saving, partially obfuscating replacement for raw feature vectors across six datasets and four classifiers.
What This Paper Is About
Most machine learning preprocessing methods aim either at compactness or at privacy, and rarely deliver both in a single representation. This paper asks whether a Bloom filter—a compact probabilistic structure traditionally used only for set membership testing—can be repurposed as a general-purpose feature transform that maps each raw sample into a fixed-length binary vector usable directly for model training. The authors test whether models trained on these encodings match models trained on raw features or on standard dimensionality reduction (PCA, LDA), while using less memory and distributing feature values across a shared bit space through hashing and collisions.
Key Contributions
- A general-purpose Bloom filter transform. Each sample is tokenized as (feature name, quantized value) pairs, and each token sets bits in an m-bit array using k deterministic hash functions of the form h_i(f, v) = H(f || v || i) mod m. The resulting fixed-length binary vector is used directly as model input, in contrast to prior work that uses Bloom filters as auxiliary structures inside specific pipelines or tasks.
- Broad empirical evaluation. Six datasets spanning four data types (SMS Spam Collection, ECG200, Adult 50K, CDC Diabetes, MNIST, Fashion MNIST) are tested with four classifiers (Extreme Gradient Boosting, Deep Neural Networks, Convolutional Neural Networks, Logistic Regression), compared against raw features and against PCA and LDA sized to approximately match the Bloom representation.
- Characterization of representation trade-offs. The paper reports compression ratio, entropy (0.38–0.68) and bit occupancy (0.13–0.60), plus a parameter sweep over filter size m and number of hash functions k on the SMS dataset.
- An honest framing of the obfuscation claim. The encoding is described as providing a degree of data obfuscation via hashing and collisions, with an explicit statement that it does not provide formal privacy guarantees such as differential privacy.
Main Findings
- Comparable performance on structured data: Models trained on Bloom filter encodings perform comparably to raw-feature models across several datasets, with occasional improvements. On the EKG dataset, accuracy rises from 81.0% (raw) to 82.9% (+1.9 percentage points), and on Adult 50K with a DNN classifier from 88.1% to 88.9% (+0.8 percentage points).
- Small regressions where raw data wins: On Adult 50K with XGBoost, raw data reaches 88.6% versus 88.2% for Bloom (−0.4 percentage points), described as a small difference.
- Image data degrades: On MNIST, accuracy falls from 98.1% (raw) to 95.1% (Bloom), a 3.0 percentage point reduction; on Fashion MNIST from 90.5% to 85.3% (−5.2 percentage points). The authors attribute this to loss of spatial structure when images are mapped into hashed representations.
- Advantage over PCA and LDA at matched sizes: On Adult 50K (XGB), the paper reports Bloom at 88.2% versus 86.5% (PCA) and 85.6% (LDA); on CDC Diabetes (DNN), Bloom at 82.2% versus 78.2% (PCA) and 80.5% (LDA). A reporting note: Section 5.1 describes these as accuracy values, while Table 2 lists AUC as the metric for Adult 50K and CDC Diabetes, and Table 3 reports Adult 50K results as mean AUC with standard deviations (Raw XGBoost 88.76 ± 0.37, Bloom XGBoost 88.21 ± 0.13, PCA 86.73 ± 0.43, LDA 86.07 ± 0.55). The Adult 50K DNN figure in the text (88.9) also differs slightly from Table 3 (88.66 ± 0.34).
- Stable across folds: On Adult 50K and ECG200 cross-validation, Bloom representations show variance comparable to or lower than raw features. For ECG200, the Bloom improvement exceeds the standard deviation (Raw XGBoost 81.02 ± 1.18, Bloom XGBoost 82.93 ± 1.05; Raw DNN 80.11 ± 2.36, Bloom DNN 83.21 ± 1.57).
- Consistent memory savings: Bloom encodings reduce representation size by approximately 2–4× compared with raw data. On EKG the reduction is 4.00×, meaning each sample is roughly 25% of the raw representation size.
- Compression versus accuracy trade-off: LDA achieves higher compression (14.29× on Adult 50K, 16.67× on CDC Diabetes) but with larger predictive losses. Against PCA, Bloom often achieves both higher compression and better performance (2.63× vs. 2.17× on Adult 50K; 4.17× vs. 0.29× on CDC Diabetes).
- Representation characteristics sit in a mid-range: Entropy values of 0.38–0.68 and bit occupancy of 0.13–0.60 indicate filters that are neither overly sparse nor saturated, balancing information density against collision effects.
- Parameter sensitivity: On the SMS dataset, predictive performance generally improves as filter size m grows (fewer collisions), while compression moves in the opposite direction. Moderate values of k tend to perform well; larger k increases collisions when filter size is fixed.
Methodology in Plain English
The pipeline starts with a dataset split into training and test sets. Every sample is converted into tokens of the form (feature name, quantized value); continuous values are first quantized into discrete bins so that similar inputs produce shared tokens. Each token is then pushed through k deterministic hash functions, each of which sets one bit in an m-bit array. The final representation for a sample is a fixed-length binary vector whose length depends only on m, not on the original number of features. Training samples are encoded and used to fit the classifier; test samples go through the identical transform before inference.
The paper uses HMAC-SHA256 as the underlying hash function. A key is optional and, the authors state, is only required for reproducing the representation. Because hashing is deterministic and shared features set shared bit positions, samples with greater feature overlap tend to produce more similar bit patterns, so the encoding preserves approximate similarity rather than exact distances. The authors note the exact functional relationship between original-space distance and Hamming distance between encodings is not explicitly defined.
For fairness, models are trained with identical hyperparameters across representations so that only the input encoding varies, and PCA and LDA component counts are chosen so their representation sizes roughly match the Bloom encoding. Datasets without predefined splits use 5-fold cross-validation. Evaluation metrics are chosen per dataset: positive-class F1 for SMS Spam and EKG, AUC for Adult 50K and CDC Diabetes (both imbalanced), and macro F1 across classes for the image datasets.
Why This Matters
The work tests whether a classical data structure can be promoted from a set-membership utility into a drop-in feature transform, and it reports both where that works (tabular records, time-series signals) and where it does not (images with spatial structure). For research, it opens a comparison point against PCA and LDA that is not purely about accuracy: it frames encoding as a three-way trade-off among predictive performance, representation size, and obfuscation, and it is explicit that the privacy benefit is obfuscation rather than a formal guarantee.
Real-world applications suggested by the evaluated domains:
- Spam and message filtering, where the SMS Spam Collection results (evaluated on positive-class F1) apply to high-volume text classification.
- Clinical and physiological signal screening, such as heartbeat rhythm classification on the ECG200 recordings, where Bloom encoding improved accuracy over raw data.
- Tabular prediction with sensitive attributes, such as income classification (Adult 50K at 48,842 samples and 14 features) and diabetes prediction (CDC Diabetes at 250,000 samples and 23 features), where obfuscating raw feature values may be desirable.
- Memory-constrained deployment, where the reported 2–4× reduction in representation size matters more than squeezing out the last percentage point of accuracy.
Industry relevance centers on pipelines that must store or transmit compact feature vectors, and on settings where raw feature values ideally should not be exposed directly. The paper's own framing of this is limited: it states the encoding provides a degree of obfuscation while noting that keyed constructions "do not provide formal privacy guarantees on their own," so it should not be read as a privacy-preserving machine learning method in the compliance sense.
Future Directions
- Extending beyond classification: The authors plan to apply the approach to regression and to distributed learning settings, where compression and communication efficiency are critical.
- Broadening the empirical base: Additional datasets and model architectures are listed as planned evaluations.
- Improving the encoding itself: Puncturing and folding techniques are proposed to improve compression and representation efficiency.
- Hybrid representations: Combining Bloom filter encodings with selected structured features, which may recover performance on data types where spatial structure currently degrades (the image results), while keeping the representation compact.
- Open question — parameter selection: The paper states that identifying optimal settings of m and k for specific applications remains future work, and that the method requires this tuning.
Target Audience
Researchers and practitioners interested in feature engineering, compact representations, and hashing-based transforms will get the most from this paper, along with engineers working on memory-constrained or bandwidth-constrained machine learning deployment. It is also relevant to readers tracking the boundary between data obfuscation and formal privacy, since the paper is explicit about which claims it does and does not support. Readers looking for a privacy-guaranteed method, or for approaches that preserve spatial structure in images, will find the paper's negative results on MNIST and Fashion MNIST as useful as its positive ones.
Authors’ abstract
We present a method that uses a Bloom filter transform to preprocess data for machine learning. Each sample is encoded into a compact bit-array representation using hash-based encoding, producing a fixed-length feature space that reduces memory usage and obfuscates original feature values. The encoding does not rely on keyed hashing; however, a key can optionally be used to control the mapping and would be required to reproduce the representation. We evaluate the approach on six datasets spanning text, time-series, tabular, and image domains: SMS Spam Collection, ECG200, Adult 50K, CDC Diabetes, MNIST, and Fashion MNIST. Four classifiers are considered: Extreme Gradient Boosting, Deep Neural Networks, Convolutional Neural Networks, and Logistic Regression. Results show that models trained on Bloom filter encodings achieve performance comparable to models trained on raw data or standard dimensionality reduction techniques across several datasets, while providing consistent memory savings. These findings suggest that Bloom filter encodings can serve as an efficient, general-purpose pre-processing representation that preserves useful similarity structure for learning tasks while providing a degree of data obfuscation.