Abstract: In this note we discuss a common misconception, namely that embeddings are always used to reduce the dimensionality of the item space. We show that when we measure dimensionality in terms of information entropy then the embedding of sparse probability distributions, that can be used to represent sparse features or data, may or not reduce the dimensionality of the item space. However, the embeddings do provide a different and often more meaningful representation of the items for a particular task at hand. Also, we give upper bounds and more precise guidelines for choosing the embedding dimension.
Introduction
In modern machine learning, particularly within recommendation systems and Natural Language Processing (NLP), embeddings are the standard method for handling categorical features. A common belief is that embeddings primarily serve to reduce the dimensionality of massive, sparse input spaces into compact, dense vectors. However, by applying the lens of information theory, we find that this "compression" is not always occurring. This paper explores the relationship between sparsity, information entropy, and embedding dimensionality.
Measuring Information Capacity
To evaluate whether an embedding reduces dimensionality, we must first define a metric for information. The author uses Shannon Entropy ($H$).
For an embedding vector $v$ of dimension $d$, where each component is represented by $s$ bits (e.g., 32-bit floats), the maximum information capacity is: $$H(v) = d \times s$$
For the input space, we consider "lookup signatures." If we select $k$ items from a vocabulary of $n$ (multi-hot encoding), the number of possible combinations is $\binom{n}{k}$. Assuming a uniform distribution, the entropy of this input space is calculated as $H(\text{input}) = \log_2 \binom{n}{k}$. To handle the massive combinatorial spaces involved in large-scale systems, the author employs Ramanujan’s approximation for factorials.
The Combinatorial Explosion of Sparsity
The paper demonstrates that as $k$ (the number of active features) increases, the entropy of the input space grows rapidly. For small $k$ relative to $n$, this growth is nearly linear on a log-log scale.
As shown in the figure above, the total vocabulary size $n$ has a logarithmic effect on entropy, while the number of selected items $k$ has a much more significant impact. When $k$ is large, the information contained in the sparse input can easily exceed the capacity of a small embedding vector, meaning the embedding may actually need to "upsample" the information density.
Practical Guidelines for Embedding Design
A key contribution of this work is providing theoretical bounds for practitioners. If the goal is to preserve the information present in the input features, the embedding dimension $d$ must satisfy $d \cdot s \geq H(\text{input})$.
The following table provides a "cheat sheet" for sizing embeddings based on vocabulary size ($n$), number of lookups ($k$), and bit-precision ($s$).
For example, with $n=100M$ and $k=1000$, a 32-bit embedding requires a dimension of at least $d=519$ just to match the input entropy. If quantization is used (e.g., 8-bit), the dimension must increase fourfold to $d=2076$ to maintain the same capacity.
Conclusion
Embeddings are more than just a compression tool; they are a transformation into a continuous, semantically meaningful space. However, engineers must be wary of "information bottlenecks." By calculating the entropy of sparse features, one can establish a theoretical "roofline" for embedding dimensions, ensuring that the model has sufficient capacity to represent the underlying data. While real-world data distributions (often power-law) may require less capacity than the uniform case studied here, these bounds provide a robust upper limit for architectural design.
Summary updated