Skip to content

perf(vamana): pass query parameters directly and compact neighbor candidates - #932

Merged
JalinWang merged 2 commits into
alibaba:mainfrom
JalinWang:perf/vamana-query-kernel
Nov 25, 2026
Merged

JalinWang merged 2 commits into
alibaba:mainfrom
JalinWang:perf/vamana-query-kernel

Conversation

@JalinWang

@JalinWang JalinWang commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Vamana currently builds a three-entry Params dictionary for every search and mixes visited checks with vector address resolution during neighbor expansion. This PR reduces both costs while keeping the search parameters and candidate evaluation order unchanged.

  • Pass validated EF/PO/PL values directly to VamanaContext::update_query_params; retain update(Params) as an adapter with the same partial-update, heap-limit and automatic-prefetch behavior.
  • Compact unvisited neighbor IDs before resolving vector addresses. Use unconditional bitmap stores only for the exact bitmap visit filter; other visit filters keep check-before-set semantics.
  • Apply the initial prefetch budget to the compacted unvisited candidates.

The two changes remain separate commits in this PR. Public Query routing is handled separately in #933; this branch changes only four Vamana files.

Performance evidence

Historical isolated measurements on SIFT1M, top-10, Xeon Platinum 8369B, GCC13 -O3, no LTO/PGO, with fixed indexes and search parameters:

  • Parameter passing alone: +1.02% geometric-mean query_internal_ids QPS over eight settings, worst setting +0.60% (first 2,000 official queries; three interleaved repeats).
  • Neighbor loop alone, compared with its parent that already includes parameter passing:
Actual Recall@10 Graph / EF / scale One worker QPS gain 31 workers on distinct physical cores
90.496% R48 / 17 / 1.7 +5.38% +1.76%
95.107% R48 / 23 / 2.5 +7.94% +2.70%
99.040% R64 / 45 / 3.5 +15.54% +6.97%

The loop measurements use native C++ and all 10,000 official queries; they exclude Python request/result conversion. Eight independent process pairs were used for the one-worker run and four paired process groups for the 31-worker run. IDs, ordering and recall matched the control. These figures are independent historical deltas, not an additive combined gain or a new benchmark of current main.

Replace per-search construction and lookup of the EF, PO and PL Params
entries with a typed VamanaContext::update_query_params call.

Keep generic update(Params) as an adapter to the same implementation so
heap limits, automatic prefetch resolution and partial updates preserve
their existing semantics. Keep parameter validation and clamping at the
interface boundary.

Validated with Vamana, internal-ID, refinement and lifecycle Python
regression suites and interleaved same-index SIFT/Cohere measurements.
Separate visited filtering from vector address resolution in the fast greedy
search loop. Use branchless bitmap compaction while retaining candidate order
and the check-before-set behavior of other visit filters. Apply the prefetch
budget to the compacted unvisited vectors.

Validation: 258 Python/ANN tests. Exact IDs and ordering match the control in
SIFT checks, with unchanged Cohere public Query IDs and recall. GCC13 -O3,
no LTO or PGO, fixed indexes/parameters, three interleaved repeats:
- SIFT >=99% point: 21,693 to 24,818 internal-IDs QPS (+14.4%).
- Cohere public Vamana Query: +0.76% to +2.56% across tested points.
- VDB CLI Vamana ef128/refine, concurrency 1/16, 30 seconds each:
  +1.18% / +1.17%, unchanged recall.

Full comparator and R64-graph runs are tracked separately; no overall
leaderboard claim is made by this commit.
@JalinWang
JalinWang merged commit 9af55fa into alibaba:main Nov 25, 2026
21 checks passed
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