[Paper Review] Superbloom: Bloom filter meets Transformer
Superbloom introduces a novel method that combines Bloom filters with multi-layer Transformers to represent large-vocabulary categorical features (e.g., product or entity IDs) as hashed tokens. By applying a deep Transformer to these Bloom-filtered digests, the model effectively resolves hashing collisions through contextual understanding, achieving higher accuracy than both non-hashed models of similar size and larger models trained with sampled softmax under the same computational budget.
We extend the idea of word pieces in natural language models to machine learning tasks on opaque ids. This is achieved by applying hash functions to map each id to multiple hash tokens in a much smaller space, similarly to a Bloom filter. We show that by applying a multi-layer Transformer to these Bloom filter digests, we are able to obtain models with high accuracy. They outperform models of a similar size without hashing and, to a large degree, models of a much larger size trained using sampled softmax with the same computational budget. Our key observation is that it is important to use a multi-layer Transformer for Bloom filter digests to remove ambiguity in the hashed input. We believe this provides an alternative method to solving problems with large vocabulary size.
Motivation & Objective
- To address the challenge of modeling large-vocabulary categorical features represented as opaque IDs in machine learning.
- To extend the success of subword tokenization (e.g., word pieces in BERT) to arbitrary categorical IDs using hashing.
- To overcome the ambiguity introduced by hash collisions in feature hashing through contextual modeling with deep Transformers.
- To enable efficient, high-accuracy prediction on large output vocabularies by training full softmax on the smaller hashed token space.
- To demonstrate that multi-layer Transformers can effectively disambiguate hashed inputs, outperforming prior hashing-based methods.
Proposed method
- Apply multiple random hash functions to map each opaque ID to a set of hash tokens in a smaller space, mimicking a Bloom filter structure.
- Represent each hashed token with a learnable embedding, forming a sequence of embeddings as input to the Transformer.
- Use a multi-layer Transformer encoder to model dependencies and resolve ambiguities in the hashed token representations using context.
- Train the model using a masked language modeling objective, predicting masked hash tokens from their context.
- Propose an efficient beam search-based inference algorithm to accelerate prediction in the smaller token space.
- Use a hybrid vocabulary combining BERT’s word pieces with frequent unigrams and bigrams to construct a 1M-sized base vocabulary.
Experimental results
Research questions
- RQ1Can a multi-layer Transformer effectively disambiguate hashed representations derived from a Bloom filter-like structure?
- RQ2Does training a full softmax on the smaller hashed token space outperform sampled softmax on the original large vocabulary under the same computational budget?
- RQ3How does the depth of the Transformer architecture affect performance when processing hashed inputs with high collision rates?
- RQ4Can the model learn meaningful representations for rare or unseen entities through hashing and contextual modeling?
- RQ5Is random hashing with high collision rates (e.g., α=40) more effective than coherent hashing schemes for entity representation?
Key findings
- Superbloom outperforms a smaller baseline BERT model (62.6M parameters) with 31.7% recall@1, 48.3% recall@10, and 52.9% recall@20.
- Even with a collision rate of α=40, the model achieves 39.2% recall@1, 58.5% recall@10, and 64.5% recall@20, surpassing a much larger BERT model (254.4M parameters) with 37.2% recall@1.
- The performance gap between one-layer and twelve-layer Transformers is significantly larger on hashed inputs than on non-hashed inputs, indicating that depth is crucial for disambiguation.
- The model demonstrates improved generalization on named entities, often correctly predicting specific entities in fill-in-the-blank tasks where BERT fails.
- The proposed beam search inference algorithm enables fast, approximate inference in the smaller token space, enhancing deployment efficiency.
- The results suggest that hashing can increase representation flexibility by enabling effective, dynamic capacity allocation per entity through the model’s attention mechanism.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.