Introduction
Finding similar users is a cornerstone of modern recommendation systems, such as Twitter’s "Who To Follow" feature. Mathematically, this is framed as the "all-pairs similarity search" problem: given millions of users represented as high-dimensional vectors, identify all pairs whose cosine similarity exceeds a specific threshold $\tau$.
While existing techniques like Locality Sensitive Hashing (LSH) perform well at high thresholds (e.g., $\tau > 0.8$), they become computationally infeasible at the lower thresholds (e.g., $\tau \approx 0.2$) that are often most predictive in social networks. Furthermore, in distributed environments like Hadoop, the primary bottleneck is often the "shuffle" cost—the volume of data moved across the network.
The WHIMP Algorithm
To address these challenges, the authors introduce WHIMP (Wedges and Hashes In Matrix Product), a distributed algorithm designed to scale similarity search to datasets with hundreds of billions of edges. WHIMP combines two distinct techniques into a cohesive three-round MapReduce process:
- Wedge Sampling: This technique identifies candidate pairs by sampling "wedges" (paths of length two). While effective at finding potential matches in sparse data, it typically suffers from high false-positive rates at low thresholds.
- SimHash (Random Projections): WHIMP uses SimHash as a local oracle. Before a candidate pair is transmitted over the network, the algorithm checks their short SimHash "fingerprints." If the Hamming distance between these fingerprints suggests the similarity is below the threshold, the candidate is discarded immediately.
This hybrid approach prevents the communication explosion typical of vanilla wedge sampling by filtering candidates locally before they contribute to network traffic.
Datasets and Evaluation
WHIMP was evaluated on four massive datasets, treated as directed graphs where similarity is defined by shared in-neighbors:
- friendster: 65M nodes, 1.6B edges.
- clueweb: 978M nodes, 42B edges.
- eu: 1.1B nodes, 84B edges.
- flock: Twitter’s internal follow graph, containing over 100B edges.
Key Results and Insights
WHIMP demonstrates near-optimal communication costs, scaling primarily with the size of the final output rather than the intermediate candidate list. On the flock dataset, WHIMP reduced shuffle data by approximately 65x compared to the previous state-of-the-art algorithm, DISCO (287 TB vs. an estimated 18,553 TB).
Beyond global metrics, the authors emphasize "per-user" accuracy. For over 75% of users in the Twitter graph, WHIMP achieves both precision and recall above 0.7 at a similarity threshold of 0.2. On webgraphs like eu, the algorithm achieves near-perfect accuracy for thresholds $\geq 0.4$.
Conclusion
WHIMP successfully scales similarity search to the "Twitter-verse" by intelligently hybridizing sampling and hashing. While the algorithm requires careful parameter tuning and currently excludes high-degree "celebrity" nodes to maintain efficiency, it represents a significant leap in practical, large-scale similarity search. Future work may involve adapting this batch process for real-time streaming updates.
Summary updated