Skip to main content
QUICK REVIEW

[Paper Review] New cardinality estimation algorithms for HyperLogLog sketches

Otmar Ertl|arXiv (Cornell University)|Feb 4, 2017
Advanced Image and Video Retrieval TechniquesComputer Science22 references17 citations
TL;DR

This paper proposes two new cardinality estimation algorithms for HyperLogLog sketches: a theoretically motivated bias-corrected estimator that improves accuracy across the full cardinality range, and a maximum likelihood-based method that delivers unbiased estimates with superior precision. The maximum likelihood approach further enables more accurate estimation of set operations like unions, intersections, and relative complements by outperforming the conventional inclusion-exclusion principle.

ABSTRACT

This paper presents new methods to estimate the cardinalities of data sets recorded by HyperLogLog sketches. A theoretically motivated extension to the original estimator is presented that eliminates the bias for small and large cardinalities. Based on the maximum likelihood principle a second unbiased method is derived together with a robust and efficient numerical algorithm to calculate the estimate. The maximum likelihood approach can also be applied to more than a single HyperLogLog sketch. In particular, it is shown that it gives more precise cardinality estimates for union, intersection, or relative complements of two sets that are both represented by HyperLogLog sketches compared to the conventional technique using the inclusion-exclusion principle. All the new methods are demonstrated and verified by extensive simulations.

Motivation & Objective

  • To address the bias in the original HyperLogLog estimator at both low and high cardinalities.
  • To develop a theoretically grounded, unbiased cardinality estimation method based on the maximum likelihood principle.
  • To extend the maximum likelihood approach to enable more accurate estimation of set operations (e.g., unions, intersections) when sketches are combined.
  • To provide a numerically stable and efficient algorithm for computing the new estimates.
  • To demonstrate through extensive simulations that the new methods significantly reduce estimation error compared to existing techniques.

Proposed method

  • Proposes a modified raw estimator that corrects bias in the original HyperLogLog estimator by adjusting the harmonic mean formula using a theoretically derived correction factor.
  • Derives a maximum likelihood estimator (MLE) for cardinality estimation, which is unbiased and optimal under the assumed statistical model of register values.
  • Introduces a robust and efficient numerical algorithm to compute the MLE estimate, ensuring numerical stability and fast convergence.
  • Applies the MLE framework to multiple HyperLogLog sketches, enabling joint estimation of set operation result sizes.
  • Uses a Poisson approximation model to describe the distribution of register values in the sketch, forming the statistical foundation for the MLE derivation.
  • Validates the methods via extensive simulations across diverse cardinality ranges and set operation scenarios.

Experimental results

Research questions

  • RQ1Can a theoretically motivated correction to the original HyperLogLog estimator eliminate bias across the entire cardinality range?
  • RQ2Does a maximum likelihood estimator based on the full likelihood function of the sketch state yield more accurate and unbiased cardinality estimates than the original method?
  • RQ3Can the maximum likelihood approach be generalized to estimate the cardinality of set operations (e.g., unions, intersections) when two HyperLogLog sketches are combined?
  • RQ4How does the performance of the new MLE-based method compare to the conventional inclusion-exclusion principle for set operations?
  • RQ5What is the numerical stability and computational efficiency of the proposed algorithms in practice?

Key findings

  • The proposed bias-corrected estimator achieves significantly reduced relative error across the entire cardinality range, including both small and large values, outperforming the original HyperLogLog estimator.
  • The maximum likelihood estimator (MLE) is proven to be unbiased and achieves higher precision than the original and corrected estimators.
  • For set operations such as unions, intersections, and relative complements, the MLE-based method reduces estimation error compared to the inclusion-exclusion principle, especially for small Jaccard indices.
  • The MLE algorithm is numerically stable, with error propagation bounded and decreasing over recursion steps, ensuring reliable computation.
  • The relative error in the final estimate due to approximation of the auxiliary function h(x) is shown to be of the same order of magnitude as the approximation error in h(x), ensuring robustness.
  • Simulations confirm that the new methods consistently reduce estimation error across diverse data distributions and cardinality regimes.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.