Composable Sketches for Functions of Frequencies: Beyond the Worst Case

Edith Cohen, Ofir Geri, Rasmus Pagh

Introduction

In the world of Big Data, sketches—compact summaries of massive datasets—are essential for calculating statistics without storing every single record. These sketches are "composable," meaning summaries from different servers can be merged into one. However, there is a theoretical wall: while some statistics (like counting distinct elements) require very little space, calculating frequency moments ($p$-th moments where $p > 2$) is known to require sketches that grow polynomially with the number of unique items in the worst-case scenario.

This paper challenges this pessimistic worst-case theory. By leveraging machine learning "advice" or assuming "natural" data distributions (like Zipfian distributions), the authors prove that simple, compact sketches can provide highly accurate estimates for these "hard" functions in practice.

Moving Beyond the Worst Case

The authors explore two primary strategies to circumvent worst-case lower bounds:

  1. The Advice Model: They introduce a sketch that utilizes "advice" from an external source, such as a machine learning model trained on historical data, which provides a predicted frequency for each item. The sketch combines the "heaviest" items according to the advice, a weighted sample based on the advice, and a uniform sample to ensure robustness against poor predictions.
  2. Frequency-Function Combinations: They analyze how "easy" sketches (like standard $\ell_1$ or $\ell_2$ samplers) can emulate "hard" $\ell_p$ sampling. They introduce emulation overhead—a factor quantifying how much larger a sample needs to be when using a sub-optimal sampling distribution.
  3. Distributional Assumptions: They analyze performance on Zipfian and sub-Zipfian distributions, where a few items appear very frequently while most appear rarely—a pattern seen in everything from word usage to network traffic.

Key Insights and Performance

The researchers evaluated their approach on diverse real-world datasets, including AOL search logs, Stack Overflow (SO) links, CAIDA internet traffic, and UGR network flows. These represent "natural" data distributions rather than the adversarial ones used to prove theoretical lower bounds.

The Power of the Heavy Hitter: If a dataset has even one "heavy hitter" (a very frequent item), estimating high moments becomes much easier. An $\ell_1$ or $\ell_2$ sampler can capture this heavy hitter, providing enough information to estimate higher moments with low overhead.

Low Overhead in Practice: In real-world datasets, the measured overhead for using an $\ell_2$ sampler to estimate high moments (like the 10th moment) was surprisingly low, ranging from 1.2 to 18. This is a massive improvement over the theoretical worst-case.

Moment Estimation Error

$\ell_2$ vs. Advice: As seen in the estimation error comparisons, standard $\ell_2$ samplers (particularly without replacement) often outperformed the ML-advice-based models on certain tasks. This suggests that for many "natural" datasets, the inherent distribution is already "nice" enough that complex ML augmentation isn't strictly necessary. The advice model, however, remains robust as long as predictions for the most important items are approximately correct.

Accuracy on the "Tail": While $\ell_2$ sampling is excellent for capturing frequent items, the authors found that $\ell_1$ sampling (without replacement) was more accurate for estimating the "tail" of the frequency distribution.

Estimated Distribution Tail

Limitations and Future Work

  • Stability of Advice: The advice model assumes past data predicts future data. If the data distribution shifts radically, performance could degrade, though the uniform sampling component mitigates this.
  • Defining "Natural": While the paper makes strides in defining "sub-Zipfian" distributions, further work is needed to characterize exactly which real-world properties make a dataset "easy" versus "hard."
  • Implementation Complexity: Implementing multi-objective sketches that combine advice, weighted sampling, and uniform sampling requires careful engineering to maintain composability without increasing computational overhead.

Summary updated

BibTeX
@inproceedings{cohen2020composable,
  author = {Edith Cohen and Ofir Geri and Rasmus Pagh},
  title = {{Composable Sketches for Functions of Frequencies: Beyond the Worst Case}},
  booktitle = {International Conference on Machine Learning},
  year = {2020},
  url = {https://openreview.net/forum?id=Jr0cL-OWdpq},
}
Figure