How does locality-sensitive hashing achieve sub-linear nearest-neighbor retrieval?

Quick Overview

Asks how locality-sensitive hashing finds near neighbors without scanning every point. It tests whether you can describe hash families for common similarity measures, explain how multiple hashes and tables are combined, and justify why query time grows slower than the dataset.

How does locality-sensitive hashing achieve sub-linear nearest-neighbor retrieval?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: hard

Interview Round: Other

How does locality-sensitive hashing achieve sub-linear nearest-neighbor retrieval? ```hint One hash versus many Compare the collision probability of a near pair and a far pair under one hash function, then under k hash functions concatenated into a single key. ``` ```hint Size the tables Ask how selective each table's key must be so that far points rarely share the query's bucket, then how many tables recover a near point. ``` ```hint Name the problem being solved Be precise about whether LSH answers exact nearest-neighbor queries or an approximate version of them. ``` ### What a Strong Answer Covers - What makes a hash family locality-sensitive, with example families for cosine, Euclidean and Jaccard similarity - How concatenating hashes within a table and taking the union across tables shape the collision probability - Where the sub-linear query bound comes from, including the choice of k and L and the exponent that governs it - The guarantee's limits: probabilistic recall, approximate neighbors, memory and tuning cost - How LSH compares in practice with other approximate nearest-neighbor methods ### Follow-up Questions - Derive the collision probability of a random-hyperplane hash for two vectors at angle $\theta$. - How would you choose k and L for a target recall, and how does multi-probe LSH reduce the number of tables? - How does MinHash with banding apply the same idea to near-duplicate document detection? - Why does graph-based search such as HNSW often beat LSH on dense embeddings, and when might LSH still be the better choice?

Overview: Asks how locality-sensitive hashing finds near neighbors without scanning every point. It tests whether you can describe hash families for common similarity measures, explain how multiple hashes and tables are combined, and justify why query time grows slower than the dataset.

General logo
General
Nov 24, 2026
hardMachine Learning EngineerOtherMachine Learning
0
0

How does locality-sensitive hashing achieve sub-linear nearest-neighbor retrieval?

What a Strong Answer Covers Guidance

  • What makes a hash family locality-sensitive, with example families for cosine, Euclidean and Jaccard similarity
  • How concatenating hashes within a table and taking the union across tables shape the collision probability
  • Where the sub-linear query bound comes from, including the choice of k and L and the exponent that governs it
  • The guarantee's limits: probabilistic recall, approximate neighbors, memory and tuning cost
  • How LSH compares in practice with other approximate nearest-neighbor methods

Follow-up Questions Guidance

  • Derive the collision probability of a random-hyperplane hash for two vectors at angle θ\theta .
  • How would you choose k and L for a target recall, and how does multi-probe LSH reduce the number of tables?
  • How does MinHash with banding apply the same idea to near-duplicate document detection?
  • Why does graph-based search such as HNSW often beat LSH on dense embeddings, and when might LSH still be the better choice?