Probabilistic Hash Embeddings for Online Learning of Categorical Features
Aodong Li, Abishek Sankararaman, Balakrishnan Narayanaswamy
TL;DR
The paper tackles learning with open-vocabulary categorical features in streaming data, where the item vocabulary changes over time. It introduces Probabilistic Hash Embeddings (PHE), a Bayesian online learning framework that treats hash embeddings as random variables and updates their posteriors incrementally, using a shared embedding table and multiple hash functions to bound memory. The authors provide scalable variational inference methods (variational EM) and show that Bayes online learning matches batch performance regardless of item arrival order, while avoiding catastrophic forgetting. Across classification, sequence modeling, and large-scale recommendation, PHE outperforms deterministic hash-based baselines and closely tracks or surpasses collision-free upper bounds with far lower memory usage. The results demonstrate PHE’s practical impact for real-time systems that must adapt to new categories without growing memory or sacrificing accuracy, making it a valuable plug-in for probabilistic models in dynamic tabular data domains.
Abstract
We study streaming data with categorical features where the vocabulary of categorical feature values is changing and can even grow unboundedly over time. Feature hashing is commonly used as a pre-processing step to map these categorical values into a feature space of fixed size before learning their embeddings. While these methods have been developed and evaluated for offline or batch settings, in this paper we consider online settings. We show that deterministic embeddings are sensitive to the arrival order of categories and suffer from forgetting in online learning, leading to performance deterioration. To mitigate this issue, we propose a probabilistic hash embedding (PHE) model that treats hash embeddings as stochastic and applies Bayesian online learning to learn incrementally from data. Based on the structure of PHE, we derive a scalable inference algorithm to learn model parameters and infer/update the posteriors of hash embeddings and other latent variables. Our algorithm (i) can handle an evolving vocabulary of categorical items, (ii) is adaptive to new items without forgetting old items, (iii) is implementable with a bounded set of parameters that does not grow with the number of distinct observed values on the stream, and (iv) is invariant to the item arrival order. Experiments in classification, sequence modeling, and recommendation systems in online learning setups demonstrate the superior performance of PHE while maintaining high memory efficiency (consumes as low as 2~4 memory of a one-hot embedding table). Supplementary materials are at https://github.com/aodongli/probabilistic-hash-embeddings
