Abstract: In this paper, we explore the power of randomized algorithms to address the challenge of working with very large amounts of data. We apply these algorithms to generate noun similarity lists from 70 million pages. We reduce the running time from quadratic to practically linear in the number of elements to be computed.
Introduction
Presented at ACL 2005, this research marks a pivotal shift in Natural Language Processing (NLP) from curated, "small data" corpora to the vast, unorganized data of the open web. As NLP researchers realized that increasing data volume often yields better performance than model refinement, they encountered a significant scaling bottleneck: the $O(n^2)$ complexity of traditional similarity calculations.
For a corpus of $n$ nouns, calculating pairwise similarity requires $n^2$ comparisons. While manageable for 10,000 nouns (100 million comparisons), web-scale data involving millions of nouns pushes this into the trillions. The authors estimated that traditional methods would require over 50,000 hours (nearly 6 years) to process their 138GB web corpus on a single machine.
Methodology: Locality Sensitive Hashing (LSH)
To overcome the quadratic barrier, the authors implemented a randomized approach based on Locality Sensitive Hashing (LSH), specifically the algorithm proposed by Moses Charikar (2002). The process involves three key steps:
- Signature Generation: High-dimensional feature vectors (contextual words surrounding a noun) are projected onto $d$ random hyperplanes. This creates a compact bit-string "fingerprint" for each noun.
- Cosine Similarity via Hamming Distance: Due to the properties of random projections, the probability of two bit-strings matching at a specific position correlates directly with the cosine similarity of the original vectors. Similarity search is thus reduced to finding bit-strings with low Hamming distance.
- The "Jumbling" Trick: To avoid exhaustive bit-string comparison, the authors use random permutations of the signatures followed by lexicographical sorting. By checking only a small "beam" of $B$ neighbors in these sorted lists across multiple permutations, they achieve near-linear complexity $O(nk)$.
Experimental Setup
The approach was evaluated on two datasets:
- Web Corpus: 70 million pages (138GB), yielding approximately 655,000 unique nouns.
- Newspaper Corpus: A 6GB collection (TREC-9 and TREC-2002) used as a gold standard to compare randomized results against traditional benchmarks.
Results and Discussion
The randomized approach demonstrated high fidelity to traditional methods while providing massive speedups. With 3,000 random vectors, the average error in cosine similarity was restricted to 0.027.
As shown in the performance data, increasing the number of random vectors $d$ improves accuracy but increases computation time. Despite this, the LSH approach processed the web corpus in roughly 240 hours—a task previously deemed infeasible. Furthermore, using 1,000 random permutations and a beam size of 100, the algorithm recovered 72.8% of the top 100 most similar nouns found by the exact method.
Qualitatively, the clusters produced were highly intuitive, successfully grouping semantically related entities across various domains, from natural disasters to luxury brands.
Conclusion
By linearizing the complexity of similarity search, this work enabled NLP tasks to scale to the size of the internet. While the method is probabilistic and carries a "recall gap" (missing roughly 30% of true neighbors), its memory efficiency and speed make it a foundational technique for modern large-scale data processing, including near-duplicate detection and document clustering.
Summary updated