Skip to content

feat(vamana): add optional two-pass graph build - #634

Merged
luoxiaojian merged 4 commits into
alibaba:mainfrom
luoxiaojian:codex/vamana-two-pass-build
Aug 13, 2026
Merged

feat(vamana): add optional two-pass graph build#634
luoxiaojian merged 4 commits into
alibaba:mainfrom
luoxiaojian:codex/vamana-two-pass-build

Conversation

@luoxiaojian

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings July 30, 2026 09:23

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

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds an optional “two-pass” Vamana graph build (initial alpha=1.0 pass + full-graph refine pass at configured alpha), wiring it through params (proto/JSON/Python), engine initialization, and merge/persistence finalization.

Changes:

  • Introduces two_pass_build in Vamana params across C++/proto/JSON/Python and propagates it into the Vamana streamer.
  • Adds a finalize_build() hook to streamers and invokes it during Index::Merge, with idempotent finalize behavior for Vamana.
  • Implements full-graph refine pass (refine_graph) in the Vamana algorithm and adds tests validating merge finalization + serialization.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/db/index/common/db_proto_converter_test.cc Adds proto <-> params conversion coverage for two_pass_build.
tests/core/interface/index_interface_test.cc Adds merge/finalize behavior test and JSON serialization assertions for two_pass_build.
src/include/zvec/db/index_params.h Extends VamanaIndexParams with two_pass_build, cloning/equality/string output, and an overload for ordering.
src/include/zvec/core/interface/index_param_builders.h Adds builder support WithTwoPassBuild.
src/include/zvec/core/interface/index_param.h Adds two_pass_build field to core Vamana index params.
src/include/zvec/core/framework/index_streamer.h Adds finalize_build() virtual hook for streamers.
src/db/proto/zvec.proto Adds two_pass_build to VamanaIndexParams protobuf.
src/db/index/common/proto_converter.cc Serializes/deserializes two_pass_build via protobuf converter.
src/db/index/column/vector_column/engine_helper.hpp Propagates DB params into engine builder for two_pass_build.
src/core/interface/indexes/vamana_index.cc Passes two_pass_build into streamer params.
src/core/interface/index_param.cc Adds JSON serialize/deserialize for two_pass_build.
src/core/interface/index.cc Calls streamer_->finalize_build() during merge.
src/core/algorithm/vamana/vamana_streamer.h Declares finalize hook and finalize helpers for two-pass build.
src/core/algorithm/vamana/vamana_streamer.cc Implements idempotent finalize pass, dump-time finalize, and stats attributes.
src/core/algorithm/vamana/vamana_params.h Adds streamer param key for two-pass build enable.
src/core/algorithm/vamana/vamana_algorithm.h Adds refine_graph() and refine_node() API.
src/core/algorithm/vamana/vamana_algorithm.cc Implements full-graph refine pass and candidate merge behavior.
src/binding/python/model/param/python_param.cc Exposes two_pass_build in Python bindings, dict/repr/pickle.
python/zvec/model/param/init.pyi Updates Python type stubs for new param.
python/tests/test_vamana.py Extends Python tests to cover defaults/custom/to_dict/repr/pickle/schema with two_pass_build.

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

Comment thread src/include/zvec/core/framework/index_streamer.h Outdated
Comment thread src/core/algorithm/vamana/vamana_algorithm.cc
Comment thread src/core/algorithm/vamana/vamana_algorithm.cc Outdated
Comment thread tests/core/interface/index_interface_test.cc Outdated
Comment thread src/binding/python/model/param/python_param.cc Outdated
Comment thread src/binding/python/model/param/python_param.cc
Comment thread src/binding/python/model/param/python_param.cc
@luoxiaojian
luoxiaojian force-pushed the codex/vamana-two-pass-build branch from 01dade9 to 0f17219 Compare July 31, 2026 02:30
Copilot AI review requested due to automatic review settings July 31, 2026 02:30

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

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

@richyreachy

richyreachy commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

CAPI是否也要透出two pass build参数

@luoxiaojian
luoxiaojian force-pushed the codex/vamana-two-pass-build branch 3 times, most recently from 95f54f1 to 4929c1a Compare August 13, 2026 06:09
@luoxiaojian
luoxiaojian force-pushed the codex/vamana-two-pass-build branch from 4b454f7 to ad79a3b Compare August 13, 2026 06:55

@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

@luoxiaojian
luoxiaojian merged commit 0ea9003 into alibaba:main Aug 13, 2026
15 checks passed
chinaux added a commit to chinaux/zvec that referenced this pull request Aug 13, 2026
upstream/main still modified the protobuf files this branch deletes (zvec.proto, proto_converter.cc, db_proto_converter_test.cc); keep the deletions. Port the one feature that landed through them — VamanaIndexParams.two_pass_build (proto field 8, upstream alibaba#634) — into ManifestCodec encode/decode, with a round-trip test.
chinaux added a commit to chinaux/zvec that referenced this pull request Aug 14, 2026
… library

upstream alibaba#634 added zvec_index_params_{get,set}_vamana_two_pass_build to the C API and its tests; the slimmed libzvec_c_api hides unlisted symbols, so c_api_test failed to link on every platform. Add both symbols to exported_symbols.lds and exported_symbols.txt.
chinaux added a commit to chinaux/zvec that referenced this pull request Aug 17, 2026
… library

upstream alibaba#634 added zvec_index_params_{get,set}_vamana_two_pass_build to the C API and its tests; the slimmed libzvec_c_api hides unlisted symbols, so c_api_test failed to link on every platform. Add both symbols to exported_symbols.lds and exported_symbols.txt.
chinaux added a commit to chinaux/zvec that referenced this pull request Aug 17, 2026
Encode/decode proto field 8 (two_pass_build, added by upstream alibaba#634) in
the protobuf-free manifest codec, and add a golden round-trip test:
manifests written before the field existed decode to the default (false),
and the flag round trips.
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