Skip to content

fix(vamana): honor asymmetric query metrics - #635

Merged
luoxiaojian merged 1 commit into
alibaba:mainfrom
luoxiaojian:codex/vamana-query-metric
Jul 30, 2026
Merged

fix(vamana): honor asymmetric query metrics#635
luoxiaojian merged 1 commit into
alibaba:mainfrom
luoxiaojian:codex/vamana-query-metric

Conversation

@luoxiaojian

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings July 30, 2026 12:04

@richyreachy richyreachy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Vamana streamer behavior for asymmetric metrics by ensuring build-time (add) distance functions and query-time (search) distance functions can differ, so searches honor the metric’s query_metric() when provided.

Changes:

  • Cache separate distance/batch-distance callables for add vs search in VamanaStreamer::open().
  • Update VamanaContext/VamanaDistCalculator to allow swapping distance implementations per operation.
  • Add a regression test validating that brute-force and graph search use the asymmetric query metric while add/build uses the base metric.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/core/algorithm/vamana/vamana_streamer_test.cc Adds regression test covering asymmetric query metric behavior across add, BF search, graph search, and BF-by-primary-keys search.
src/core/algorithm/vamana/vamana_streamer.h Introduces cached add/search distance and batch-distance function members.
src/core/algorithm/vamana/vamana_streamer.cc Initializes add/search distance callables in open() and applies them to contexts in add/search code paths.
src/core/algorithm/vamana/vamana_dist_calculator.h Adds a method to update the distance and batch-distance callables dynamically.
src/core/algorithm/vamana/vamana_context.h Exposes a context-level helper to update the underlying distance calculator’s callables.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@luoxiaojian
luoxiaojian merged commit ad36b75 into alibaba:main Jul 30, 2026
5 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.

3 participants