Locality-sensitive hashing (LSH) is an approximate indexing technique for high-dimensional vectors. It assigns hashes to regions of hyperspace, making nearby embeddings easier to retrieve without comparing a query against every document. The trade-off is deliberate: retrieval becomes faster, while precision may decline. section 4.8.1 section 10.3.4
Use LSH with these practical expectations:
- Treat it as an approximate k-nearest-neighbors method that performs both vector indexing and neighbor retrieval. section 10.3.4
- Prefer it when exhaustive search would require one similarity comparison for every document, especially at large collection sizes. section 4.8.1 section 10.3.4
- Measure quality rather than assuming exact matches: accuracy deteriorates around 12 dimensions in the illustrated semantic-search setting, and results become especially poor beyond 16 dimensions. section 4.8.1
Semantic search at scale
A semantic-search system can convert a query and documents into topic or embedding vectors, use LSH to index the vectors, and retrieve approximate neighbors instead of calculating dot products against millions of articles. For production deployments, LSH is one indexing choice alongside tree-based and graph-based methods; hosted vector databases can manage scaling. section 10.3.4 section 10.3.5
Figure 4.5 Semantic search accuracy deteriorates at around 12 dimensions
Inspect the dimensionality comparison showing how semantic-search accuracy deteriorates as vector dimensions increase. section 4.8.1
