Skip to content

Compare queue insertion-search strategies in CI - #1602

Draft
Wei Wu (wuw92) wants to merge 10 commits into
mainfrom
wuw92-queue-insertion-search
Draft

Wei Wu (wuw92) wants to merge 10 commits into
mainfrom
wuw92-queue-insertion-search

Conversation

@wuw92

@wuw92 Wei Wu (wuw92) commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor
  • Does this PR have a descriptive title that could go in our release notes?
  • Does this PR add any new dependencies?
  • Does this PR modify any existing APIs?
  • Is the change to the API backwards compatible?
  • Should this result in any changes to our documentation, either updating existing docs or adding new ones?

Reference Issues/PRs

Standalone draft targeting main, related to #1590 and #1600. This branch includes their batch-insertion and benchmark infrastructure; neither existing PR is modified. Fixed revision a58bd09808915b3f457008217cb369a201677fd0 is the workload reference, not this PR's base branch.

What does this implement/fix? Briefly explain your changes.

Compare four real queue-update groups: original insert, original batch_insert, insert with a configured insertion-point search, and batch_insert with that search. The benchmark input selects the strategy; this PR does not select or recommend an automatic production crossover.

NeighborPriorityQueue::new(L) and the resizable constructor keep their existing signatures and original SIMD/scalar lookup. The additive .with_insertion_search(InsertionSearch) method selects linear, binary, or a hybrid with an explicitly supplied linear_scan_limit. The selection applies to the actual insert lookup and the batch merge's initial prefix lookup. Removal, the top-L partition, sorting, merging, and cursor/visited handling are unchanged. Existing constructor callers are unchanged. No Cargo feature, callback injection API, or hardcoded 1024-element dispatch remains.

Restore #1600's fixture generation, per-item reset, scalar work model, timer loop, method rotation, and configured repetition counts. Its example input remains unchanged: 23 cases, seed 20261113, eight fixtures, two blocks, nine rounds. Only the optional insertion_search field and its queue construction plumbing are added to the benchmark. A Windows test that incorrectly required a short measured interval to exceed zero now accepts finite nonnegative durations; neither the timer nor repetitions were changed to accommodate it.

One executable runs the original input and a copy that differs only in insertion_search, with three independent processes per input in alternating order. The checked-in strategy configuration selects pure binary search. Hybrid remains an explicit input option, not an automatically chosen optimization. The driver no longer rewrites queue source, generates an expanded matrix, caps repetitions, or runs a lookup-only suite. It checks the original workload and measurement bodies before building, and retains binaries, source/input hashes, commands, environment, raw samples, and per-process comparisons. Speedup is linear / configured time for the same update method; historical timings are not pooled.

Any other comments?

Current source: a9f3d0b2c1de75d18d95965c41f82a7f5e3a7afb. The fresh three-platform benchmark CI passes on Linux x86-64, Linux ARM64, and Windows. All 18 independent processes and 138 same-method comparisons were re-audited against retained inputs, binaries, source hashes, and the fixed revision. This is completion of the configurable comparison, not acceptance of pure binary search as a general optimization. The PR remains a draft; no merge or auto-merge is enabled.

Measured tradeoff. Pure binary search improves large-L insertion but loses on small-L insertion and many batch updates. The table shows full/uniform/shuffled cases from the original workload, with speedup = linear / binary. These are ratios of three process medians, not confidence intervals. The complete 23-case tables, all four groups' ns/update, individual process medians/ranges, raw nine-round samples, and conservative repeatability screens are in each artifact and the CI job summaries; no unfavorable case is excluded from them.

L / N Linux x86 insert / batch ARM64 insert / batch Windows insert / batch
20 / 8 0.561x / 0.764x 0.607x / 0.818x 0.595x / 0.857x
200 / 8 0.577x / 0.882x 1.277x / 0.959x 0.643x / 0.922x
2000 / 8 1.073x / 0.995x 2.323x / 1.010x 1.096x / 0.836x
2000 / 2000 1.172x / 0.999x 2.821x / 1.005x 1.115x / 1.037x

Windows L2000/N8 batch is inconclusive because the linear process medians vary substantially; the 0.836x point estimate is not a stable-loss claim. The large L2000/N2000 insertion result passes the consistent-direction/process-range screen on all three platforms. Neither batch-wide acceleration nor an architecture-independent crossover is established. Only one seed and the original fixture population were used; these warm-fixture microbenchmarks do not establish end-to-end ANN performance.

Complete tables and raw evidence: Linux x86, Linux ARM64, Windows. Each contains summary.md, comparisons.json, process-medians.json, six raw result JSON files, exact commands, input/source/executable hashes, the executable, and build/test/environment logs. The run page exposes the same full tables in job summaries. Artifacts require GitHub access and have 30-day server retention; downloaded copies are preserved. Artifact hidden-file filtering omits .cargo/config.toml; its recorded hash was verified against the pinned repository config, which remains the authoritative source of build target flags.

Runners: Linux x86 AMD EPYC 9V74, Linux ARM Neoverse-N2, Windows AMD EPYC 7763. All use rustc 1.97.1 and the same locked release build configuration. Linux timing children use the first allowed logical CPU; Windows inherits runner affinity. Exact OS/kernel, flags, affinity, source, executable, and invocation details are retained per artifact. Shared CI is not assumed quieter than local hardware.

Reproduce from the current source, without overlapping builds or benchmarks:

python .github/scripts/benchmark_queue_search.py build --output benchmark-results
python .github/scripts/benchmark_queue_search.py run --output benchmark-results
python .github/scripts/benchmark_queue_search.py summarize --output benchmark-results

The candidate configuration is diskann-benchmark/example/neighbor-queue-search-strategy.json. build --search-config <path> selects another explicit search configuration without changing cases, reset, or repetition controls.

Local validation:

  • cargo test --locked --release -p diskann -p diskann-benchmark neighbor --features diskann/experimental_diversity_search: passed, 77 library and seven benchmark tests.
  • cargo clippy --locked --release -p diskann -p diskann-benchmark --all-targets -- -D warnings: passed.
  • cargo fmt --all -- --check: passed.
  • python .github/scripts/test_benchmark_queue_search.py: passed, seven comparison/measurement-contract tests.
  • python .github/scripts/benchmark_queue_search.py build --output <artifact-directory>: passed; includes 41 targeted queue tests.
  • python .github/scripts/benchmark_queue_search.py run --output <artifact-directory> and summarize --output <artifact-directory>: passed; six processes and 46 same-method comparisons using the original 23 cases.
  • git diff --check: passed.

The benchmark CI repeats targeted tests, Clippy, formatting, build, and the original-workload comparison on all three platforms. Full workspace tests and end-to-end ANN benchmarks were not run locally; the separate general CI workflow is outside this benchmark result. Numeric/tie tests and configured real-queue comparisons cover NaN filtering, NaN removal, signed zero, infinities, partial fill, unique IDs, buffer reuse, visited/cursor state, capacity, and resizable queues.

Historical experiments remain available in round 1, round 2, round 3, and round 4. Those runs used the superseded harness and/or automatic insertion-only dispatch. They do not establish this corrected four-group comparison. Their raw artifacts and source revisions are preserved; the previous small-L and boundary regressions are not reclassified as noise or resolved by this interface change.

Wei Wu (wuw92) and others added 8 commits November 13, 2026 19:55
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Apply the measured insertion-only hybrid above filled length 1024 and retain baseline, binary, and earlier hybrid comparisons in CI.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep small-queue insertion on the original inline lookup path and compare the outlined candidate with both the original scan and prior guarded implementation. Preserve the existing cases, seeds, timing harness, and release flags.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@wuw92
Wei Wu (wuw92) marked this pull request as draft November 17, 2026 01:44
@wuw92
Wei Wu (wuw92) changed the base branch from wuw92-beam-queue-benchmark to main November 17, 2026 01:44
Restore the original fixture reset, workloads, and repetition counts. Keep new(L) unchanged and select lookup through with_insertion_search and benchmark input. Remove source-rewriting variants and standalone lookup timings.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.23116% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.16%. Comparing base (dd896a3) to head (29a4c79).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
diskann-benchmark/src/neighbor_queue.rs 87.28% 52 Missing ⚠️
diskann/src/neighbor/queue.rs 99.63% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1602      +/-   ##
==========================================
- Coverage   92.14%   91.16%   -0.98%     
==========================================
  Files         621      623       +2     
  Lines      130986   131313     +327     
==========================================
- Hits       120694   119710     -984     
- Misses      10292    11603    +1311     
Flag Coverage Δ
miri 91.16% <93.23%> (-0.98%) ⬇️
unittests 90.88% <93.23%> (-1.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
diskann-benchmark/src/main.rs 94.08% <100.00%> (+0.01%) ⬆️
diskann/src/graph/index.rs 96.47% <100.00%> (-0.01%) ⬇️
diskann/src/graph/search/inline_filter_search.rs 99.52% <100.00%> (-0.01%) ⬇️
diskann/src/graph/search/multihop_filter_search.rs 100.00% <100.00%> (ø)
diskann/src/neighbor/mod.rs 99.03% <ø> (ø)
diskann/src/neighbor/queue_search.rs 100.00% <100.00%> (ø)
diskann/src/neighbor/queue.rs 99.10% <99.63%> (+0.16%) ⬆️
diskann-benchmark/src/neighbor_queue.rs 87.28% <87.28%> (ø)

... and 67 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

2 participants