Skip to main content
QUICK REVIEW

[Paper Review] When Hashes Met Wedges: A Distributed Algorithm for Finding High Similarity Vectors

Aneesh Sharma, C. Seshadhri|arXiv (Cornell University)|Mar 3, 2017
Stochastic Gradient Optimization TechniquesComputer Science43 references4 citations
TL;DR

WHIMP is a distributed algorithm that efficiently finds high-cosine-similarity vector pairs in massive networks by combining wedge sampling with SimHash, enabling scalable similarity search at low thresholds (e.g., τ=0.2). It achieves near-optimal communication costs and accurately identifies similar user pairs on graphs with tens of billions of edges, including the full Twitter network.

ABSTRACT

Finding similar user pairs is a fundamental task in social networks, with numerous applications in ranking and personalization tasks such as link prediction and tie strength detection. A common manifestation of user similarity is based upon network structure: each user is represented by a vector that represents the user's network connections, where pairwise cosine similarity among these vectors defines user similarity. The predominant task for user similarity applications is to discover all similar pairs that have a pairwise cosine similarity value larger than a given threshold $τ$. In contrast to previous work where $τ$ is assumed to be quite close to 1, we focus on recommendation applications where $τ$ is small, but still meaningful. The all pairs cosine similarity problem is computationally challenging on networks with billions of edges, and especially so for settings with small $τ$. To the best of our knowledge, there is no practical solution for computing all user pairs with, say $τ= 0.2$ on large social networks, even using the power of distributed algorithms. Our work directly addresses this challenge by introducing a new algorithm --- WHIMP --- that solves this problem efficiently in the MapReduce model. The key insight in WHIMP is to combine the "wedge-sampling" approach of Cohen-Lewis for approximate matrix multiplication with the SimHash random projection techniques of Charikar. We provide a theoretical analysis of WHIMP, proving that it has near optimal communication costs while maintaining computation cost comparable with the state of the art. We also empirically demonstrate WHIMP's scalability by computing all highly similar pairs on four massive data sets, and show that it accurately finds high similarity pairs. In particular, we note that WHIMP successfully processes the entire Twitter network, which has tens of billions of edges.

Motivation & Objective

  • To address the scalability challenge of computing all-pairs cosine similarity in large-scale social networks where similarity thresholds are low but meaningful (e.g., τ=0.2).
  • To design a practical distributed algorithm that efficiently discovers all similar user pairs without relying on heuristics or high memory overhead.
  • To reduce communication and computation costs in the MapReduce model while maintaining high precision and recall for similarity detection.
  • To enable scalable similarity search on real-world networks with tens of billions of edges, such as the full Twitter graph.

Proposed method

  • Combines wedge sampling from Cohen-Lewis with SimHash from Charikar to efficiently estimate high-similarity vector pairs.
  • Uses a single SimHash sketch per vector to generate candidate pairs, reducing the need for multiple rounds of sampling.
  • Employs a two-phase process: first, wedge sampling generates candidate pairs; second, SimHash filters and verifies high-similarity matches.
  • Sets the number of wedge samples to s = 50/τ to ensure sufficient concentration and achieve precision/recall > 0.8.
  • Leverages the fact that each wedge sample is processed once and emitted only if it satisfies the SimHash condition, minimizing redundant computation.
  • Splits shuffle cost evenly across two phases, significantly reducing total communication compared to vanilla wedge sampling.

Experimental results

Research questions

  • RQ1Can a distributed algorithm efficiently compute all vector pairs with cosine similarity ≥ τ for small τ (e.g., 0.2) in massive networks?
  • RQ2How can wedge sampling and SimHash be combined to reduce communication and computation costs in similarity search?
  • RQ3What is the theoretical communication cost of the proposed method, and how does it compare to existing approaches?
  • RQ4Can the algorithm scale to real-world networks with tens of billions of edges, such as the full Twitter graph?
  • RQ5How accurate is the method in practice, particularly in terms of precision and recall at low similarity thresholds?

Key findings

  • WHIMP successfully processes the entire Twitter network, which contains tens of billions of edges, demonstrating scalability at scale.
  • For τ = 0.2, WHIMP achieves precision and recall above 0.8 with s = 50/τ wedge samples, confirming robustness at low similarity thresholds.
  • The algorithm reduces shuffle cost to approximately 160 × ||A^T A||_1 / τ, which is significantly lower than vanilla wedge sampling, especially at low τ.
  • Empirical results show that WHIMP reliably finds more than 70% of all 0.2-similar user pairs for the vast majority of users.
  • Case studies on Twitter show that the algorithm retrieves interpretable and meaningful similar users, such as conference accounts, researchers, and high-profile figures.
  • Storage requirements for LSH-based approaches at τ=0.2 are estimated at 26,000 TB for 1 billion users, making them infeasible—highlighting WHIMP’s practical advantage.

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.