Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiprobe L2 LSH first pass #123

Merged
merged 33 commits into from
Aug 2, 2020
Merged

Multiprobe L2 LSH first pass #123

merged 33 commits into from
Aug 2, 2020

Conversation

alexklibisz
Copy link
Owner

@alexklibisz alexklibisz commented Aug 2, 2020

First pass at multiprobe L2 LSH based on paper: Multi-Probe LSH: Efficient Indexing for High-Dimensional Similarity Search, Qin, et. al.
This uses the naive method for picking perturbation vectors. Namely it enumerates all of the 3^k possible perturbation vectors and uses a heap to pick the best ones using the x_i(\delta) scores from section 4.3 in the paper.
Next I'll implement the optimizations from sections 4.4 and 4.5.

This already shows a meaningful improvement in the Sift dataset benchmarks, specifically:

  • Mapping with L=300, k=2, r=1, query with 4000 candidates produces p90 recall/duration = (0.73, 54ms)
  • Mapping with L=100, k=2, r=1, query with 4000 candidates and 3 probes produces p90 recall/duration = (0.78, 54ms)

So you can store 3x fewer hashes and get better recall with the exact same latency.

This required some internal changes to the way the HashingFunctions are cached.
I also simplified how the MatchHashesAndScoreQuery handles cases with all-zero counts by just returning a DocIdSetIterator.empty().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant