NVIDIA / NVIDIA/cuvs

[FEA] Support `binary_hamming` distance

Open
#578 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
Cuda
Stars
854
Forks
236
Avg merge
3d 3h
Merged PRs (30d)
62

Description

It's becoming more common that users quantize their vectors using scalar and binary quantization techniques before they hand the vectors off to be indexed. But specifically binary vectors require a version of the hamming distance that uses an XNOR in place of the multiplication.

The distance should support all current input data types for other distances (fp32, fp16, and uint8) as the binary bits can be packed into any of those and needs to be vectorized during the actual load. We will also need to support this for all of our index algorithms, but we should start with CAGRA, since that's the most popular and requested index.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing distance implementations and the CAGRA index entry points. Trace how fp32, fp16, and uint8 inputs are loaded and vectorized, then identify the relevant tests. Done means binary_hamming supports those input types for CAGRA and uses XNOR-based distance calculation.

Written by the indexing model from the issue text.

Assessment

Domain
search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.