Skip to content

[DO NOT MERGE] Reproduce IVF-RaBitQ wrong-list results for queries on a list centroid - #2800

Closed
bdice wants to merge 3 commits into
NVIDIA:mainfrom
bdice:fix-ivf-rabitq-exact-match-search-repro
Closed

bdice wants to merge 3 commits into
NVIDIA:mainfrom
bdice:fix-ivf-rabitq-exact-match-search-repro

Conversation

@bdice

@bdice bdice commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Reproduces IVF-RaBitQ returning neighbors from the wrong list when a query coincides with a list centroid (for example, a query equal to a duplicated data row). Found by workstream G (#2791, #2798).

Adds ivf_rabitq_exact_match_test: 32 distinct rows, each repeated 128 times, n_lists = 32, and the queries are the distinct rows. All 10 neighbors must be copies of the query at distance ~0, for every search mode and for bits_per_dim 1 and 3.

CI is reduced to the amd64 CUDA 13.3.0 C++ build and NEIGHBORS_ANN_IVF_RABITQ_TEST on H100 and RTX PRO 6000, repeated.

Part of #2783 (workstream K).

@copy-pr-bot

copy-pr-bot Bot commented Oct 10, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@bdice

bdice commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 8ba8a8b

@bdice

bdice commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test e89081b

@bdice

bdice commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Closing: this was a reproducer/diagnostic PR for workstream K of #2783. The fix is in #2802.

@bdice bdice closed this Oct 11, 2026
rapids-bot Bot pushed a commit that referenced this pull request Nov 4, 2026
IVF-RaBitQ computes the probe distance `||q - c||^2` in expanded form (`||q||^2 + ||c||^2 - 2 q.c`). When a query sits on a list centroid, for example a query equal to a row that is duplicated across a whole list, rounding can make that value slightly negative. The block-sort search kernels take `sqrtf` of it for the error bound, which gives NaN. The NaN lower bound then fails `low_dist < threshold` for every vector in that list, so the query's own list contributes no candidates and all k results come from other lists. This affects `QUANT4`/`QUANT8` (the default) at any `bits_per_dim`, and `LUT16`/`LUT32` with `bits_per_dim > 1`.

This PR clamps the probe distances to non-negative values after the GEMM. It also adds a regression test where each list holds copies of one row and the queries are those rows. Without the fix, 18 of the 24 cases fail deterministically on H100 and RTX PRO 6000.

See #2800 and #2783.

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Robert Maynard (https://github.com/robertmaynard)
  - Anupam (https://github.com/aamijar)
  - Victor Lafargue (https://github.com/viclafargue)

URL: #2802
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant