Skip to content

[DO NOT MERGE] Reproduce flaky TestAcceleratedHNSWMultiLayerRoundTrip (BQ) - #2827

Closed
bdice wants to merge 2 commits into
NVIDIA:mainfrom
bdice:ci-repro-lucene-bq-selfmatch
Closed

bdice wants to merge 2 commits into
NVIDIA:mainfrom
bdice:ci-repro-lucene-bq-selfmatch

Conversation

@bdice

@bdice bdice commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Reproducer for the binary-quantized TestAcceleratedHNSWMultiLayerRoundTrip.testThreeLevelGraphCanBeReopenedAndSearched flake (workstream P of #2783). CI is reduced to lucene builds/tests; the lucene test job loops this test with random seeds and prints diagnostics.

@copy-pr-bot

copy-pr-bot Bot commented Oct 11, 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 11, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 37efbf2

@bdice

bdice commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 81f14dc

@bdice

bdice commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Closing this reproducer. It confirmed the root cause (graph ordinal used as the insertion id after a reordering forceMerge(1): 112/39,320 BQ misses before the fix, 0/93,300 after). The fix is in #2831.

@bdice bdice closed this Oct 11, 2026
rapids-bot Bot pushed a commit that referenced this pull request Oct 13, 2026
…ndTrip (#2831)

`TestAcceleratedHNSWMultiLayerRoundTrip.testThreeLevelGraphCanBeReopenedAndSearched` queried with `vectors[graph.entryNode()]` and checked the hit's stored `id` against the same number. `entryNode()` is a vector ordinal, which equals the docID in the merged segment, but `vectors[]` is indexed by insertion id. The two only match while `forceMerge(1)` keeps documents in insertion order. `newIndexWriterConfig()` picks a random merge policy, and `TieredMergePolicy` or `MockRandomMergePolicy` can reorder documents. The query is then an arbitrary document's vector, and the test effectively asserts that an approximate 1-bit BQ HNSW search at k = ef = 10 finds that document. A miss there is legitimate.

The test now looks up the entry node's stored id, queries with `vectors[queryId]`, and requires `hit.doc == entryNode`. The assertion stays strict for all three formats.

Supporting analysis (CPU only):
- A replay of the failing seed picks `TieredMergePolicy`, which reorders 232 of 256 documents.
- Under the Lucene102 OSQ quantization of the test's exact 256x129 vectors, each document's own quantized score is strictly the maximum. The smallest margin is 0.39, so this is not a quantization tie.
- In an emulation of the BQ graph search, an arbitrary target is missed in about 22% of trials, and the entry node's own vector in 0 of 20,000.

CI evidence (reproducer #2827; 4 lucene test jobs per run: 2x 13.3.0 rtxpro6000, 12.9.2 rtxpro6000, 12.9.2 l4; each loops this test with `-Dtests.iters=100` and random seeds for 45 minutes):
- Before, [run 38142877368](https://github.com/NVIDIA/cuvs/actions/runs/38142877368) at `37efbf2a`: each iteration runs both the original and the fixed query on the same index. Over 39,320 iterations per format, the original query missed 112 times for BQ, 5 for SQ and 0 for float. All of those misses were on the 676 indexes that `forceMerge(1)` reordered (`TieredMergePolicy` or `MockRandomMergePolicy`). There were 0 misses when docID == insertion id. The fixed query missed 0 times. The stress-run seed `73F002E9239F2329` reorders 232/256 docs on the GPU, and the original query missed in 6 of 20 replays.
- After, [run 38149047284](https://github.com/NVIDIA/cuvs/actions/runs/38149047284) at `81f14dce`, which runs this PR's exact test file: 93,300 test iterations (31,100 per format) with 0 failures and 0 errors, and the failing seed passed 20 of 20 replays.

Found by the stress run (#2793). Part of #2783.

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

Approvers:
  - Igor Motov (https://github.com/imotov)

URL: #2831
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