A Sketch Algorithm for Estimating Two-Way and Multi-Way Associations

Ping Li, Kenneth Ward ChurchComput. Linguistics 2007

Introduction

In Information Retrieval (IR) and Natural Language Processing (NLP), estimating word associations (co-occurrences) at "Web scale" is a significant challenge. With billions of documents, computing exact pair-wise frequencies is computationally prohibitive. While sampling is a common workaround, standard random sampling often misses rare word pairs. This paper presents a sketch-based algorithm that utilizes Maximum Likelihood Estimation (MLE) constrained by known document frequencies to provide highly accurate estimates with minimal computational overhead.

Methodology: Sketches and Contingency Tables

The core of the approach involves creating "sketches" for every word. By applying a random permutation to document IDs and storing only the $k$ smallest IDs, the algorithm effectively samples the "front" of an inverted index. To estimate the association between two words, $W_1$ and $W_2$, the algorithm constructs a sample contingency table from these sketches.

Contingency and sample tables used for MLE estimation.

As shown in Figure 1, the contingency table tracks occurrences ($a$), partial occurrences ($b, c$), and absences ($d$). The innovation lies in using the known total document frequencies ($f_1 = a+b$ and $f_2 = a+c$), referred to as "margins," to constrain the MLE. This "free" information significantly reduces estimation variance compared to margin-free methods like Broder’s sketches. Solving the exact MLE requires a cubic equation, but the authors provide a computationally efficient quadratic approximation that maintains high accuracy.

Advantages of Sketching

A primary insight of this work is that sketches capture both presence and absence within a specific range of the permuted space. This allows for much more efficient estimation of intersections than traditional random sampling.

Comparison of sketch-based sampling vs. random sampling for intersection estimation.

Figure 2 illustrates that sketch-based methods capture a significantly higher percentage of intersections at low sampling rates compared to random sampling. This efficiency allows the proposed method to achieve high accuracy even with sampling rates as low as 0.1%. By utilizing all available data in the sketches rather than just the intersection, the proposed method achieves a 50% reduction in Mean Square Error (MSE) compared to Broder's original sketching technique.

Key Results and Extensions

The proposed MLE method is practically unbiased and maintains high ranking accuracy—around 70% agreement with full-dataset gold standards—even at extremely low sampling rates. Furthermore, the method extends to multi-way associations (e.g., three or four words) by formulating the estimation as a convex optimization problem solved via Newton’s method. While more computationally intensive than the two-way quadratic approximation, it provides a robust framework for complex query optimization and linguistic analysis.

Conclusion

By leveraging "free" marginal information and the inherent properties of permuted inverted indexes, this sketch-based MLE algorithm provides a scalable and statistically rigorous solution for word association estimation. It bridges the gap between simple sampling and exact computation, enabling advanced NLP tasks at the scale of the modern Web.

Summary updated

BibTeX
@article{li2007sketch,
  author = {Ping Li and Kenneth Ward Church},
  title = {{A Sketch Algorithm for Estimating Two-Way and Multi-Way Associations}},
  journal = {Comput. Linguistics},
  year = {2007},
  doi = {10.1162/coli.2007.33.3.305},
}
Figure