Estimating Entropy of Distributions in Constant Space

Jayadev Acharya, Sourbh Bhadane, Piotr Indyk, Ziteng Sun

TL;DR

This paper presents a breakthrough algorithm for estimating the Shannon entropy of a distribution using a constant amount of memory (specifically, just 20 words), regardless of how large the distribution's domain is. While previous state-of-the-art methods required memory that scaled linearly with the domain size, this new approach achieves an exponential reduction in space with only a minor, logarithmic increase in the number of samples required.

What Problem Does This Paper Address?

Entropy estimation—measuring the "uncertainty" or "randomness" of a data source—is a cornerstone of information theory and machine learning. In the modern era of massive datasets, we often face a "streaming" challenge: data arrives sequentially, and we don't have enough memory to store it all.

The fundamental challenge is the space-sample trade-off. To estimate the entropy of a distribution over $k$ possible items (a $k$-ary distribution):

  1. Sample-Optimal algorithms exist that use very few samples ($O(k/\log k)$), but they require nearly linear space ($O(k)$), which is impossible for massive domains.
  2. Streaming algorithms designed for worst-case data exist, but they often focus on the entropy of the observed stream rather than the underlying generating distribution.

The authors ask: Can we estimate the entropy of an underlying distribution using a tiny, fixed amount of memory that doesn't grow with $k$?

Methods

The authors build their solution starting from a simple identity: Shannon entropy $H(p)$ can be written as the expected value of the log-probability of a sample: $$H(p) = \mathbb{E}_{X \sim p} \left[ \log \frac{1}{p(X)} \right]$$

The Simple Method

A naive constant-space approach would be:

  1. Draw a sample $X$.
  2. In the next $N$ samples, count how many times $X$ appears to estimate $\hat{p}(X)$.
  3. Calculate $\log(1/\hat{p}(X))$ and repeat this process many times to find the average. While this uses $O(1)$ space, it requires a huge number of samples to be accurate across all possible values of $p(X)$.

The Interval-Based Innovation

To optimize this, the authors partition the probability range $[0, 1]$ into $T$ disjoint intervals. The core idea is that different probability scales require different treatment:

  • Large probabilities are easy to see often, so we need fewer samples to estimate them, but they contribute significantly to the variance of the estimate.
  • Small probabilities are rare and need many samples to even be detected, but their contribution to entropy is more constrained.

By carefully designing these intervals using the iterated logarithm ($\log^* k$), the authors create a multi-layered estimation strategy. They use a randomized algorithm to "guess" which interval a symbol belongs to and then apply specialized estimators for each interval. This balancing act allows them to keep the total memory usage constant while bringing the sample complexity down to near-linear in $k$.

Datasets

This is a theoretical paper focused on algorithmic complexity and mathematical proofs. As such, no empirical datasets were used for training or evaluation. The results are established through rigorous probabilistic analysis (using tools like Hoeffding’s and Chernoff bounds).

Key Insights and Ideas

  • Bypassing Streaming Lower Bounds: Traditional streaming theory suggests a memory lower bound of $\Omega(1/\epsilon^2)$. The authors show that because their data is generated by a distribution (rather than being an arbitrary, adversarial sequence), they can bypass these limits.
  • Exponential Space Reduction: The jump from $O(k)$ space to $O(1)$ space is a massive qualitative shift. It means this algorithm could run on a simple sensor or a network router with virtually no dedicated memory for the task.
  • The Power of Partitioning: The "aha moment" is realizing that you don't need to estimate every probability with the same precision. By partitioning the space, you can trade off bias and variance differently for "heavy" vs. "light" elements of the distribution.

Key Results

The paper’s main contribution is summarized in the comparison of Algorithm 9 against existing methods:

Table 1: Sample and space complexity for estimating H(p).
  • Constant Space: Algorithm 9 requires only 20 words of memory, regardless of the domain size $k$.
  • Near-Linear Samples: The sample complexity is $O\left(\frac{k \log (1/\varepsilon)^2}{\varepsilon^3}\right)$. While this is slightly higher than the sample-optimal $O(k/\log k)$, it is a small price to pay for the exponential reduction in memory.
  • Theoretical Guarantee: The algorithm provides a $\pm\varepsilon$ estimate of the true Shannon entropy with a success probability of at least 2/3.

Limitations and Future Work

  • Sample Efficiency Gap: There is still a gap between this algorithm's sample complexity ($O(k)$) and the theoretical minimum ($O(k/\log k)$). The authors leave it as an open question whether an algorithm can achieve both optimal samples and constant (or even polylogarithmic) space.
  • High Precision Cost: The sample complexity scales with $1/\epsilon^3$, which might become prohibitive if extremely high precision (very small $\epsilon$) is required.
  • Lower Bounds: While they achieved constant space, the authors note that proving a formal lower bound on the space required for a sample-optimal algorithm remains an important future direction.

Summary updated

BibTeX
@inproceedings{acharya2019estimating,
  author = {Jayadev Acharya and Sourbh Bhadane and Piotr Indyk and Ziteng Sun},
  title = {{Estimating Entropy of Distributions in Constant Space}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
  url = {https://openreview.net/forum?id=hhjS56m6PaI},
}
Figure