feat: support pyramid raw vector retrieval#2503
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
/label S-waiting-on-review |
|
Automated pull request review completed. Review effort: Submitted 1 inline comment. |
Merge Protections🟢 All 3 merge protections satisfied — ready to merge. Show 3 satisfied protections🟢 Require kind label
🟢 Require version label
🟢 Require linked issue for feature/bug PRs
|
There was a problem hiding this comment.
Pull request overview
Adds Pyramid support for preserving and retrieving FP32 raw vectors (including through streaming/legacy serialization), along with detailed live memory reporting to enable accurate HGraph vs Pyramid memory comparisons.
Changes:
- Implement Pyramid raw-vector storage/reuse logic and expose it via
GetVectorByInnerId/GetRawVectorByIds, including streaming + legacy serialization support. - Add Pyramid
GetMemoryUsage()/GetMemoryUsageDetail()with hierarchy graph accounting and alias-aware raw-vector reporting. - Update unit tests, docs (EN/ZH), and add a C++ example to reproduce HGraph/Pyramid memory comparisons.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/quantization/fp32_quantizer_parameter.cpp | Persist hold_molds in FP32 quantizer JSON. |
| src/quantization/fp32_quantizer_parameter_test.cpp | Extend FP32 parameter JSON roundtrip coverage for hold_molds. |
| src/algorithm/pyramid/pyramid.h | Add raw-vector members/hooks and memory usage APIs to Pyramid declarations. |
| src/algorithm/pyramid/pyramid.cpp | Implement raw-vector reuse/storage, serialization blocks, and memory usage reporting. |
| src/algorithm/pyramid/pyramid_zparameters.cpp | Backward-compat restore for legacy FP32 hold_molds and compatibility checks for raw-vector params. |
| src/algorithm/pyramid/pyramid_test.cpp | Add regression tests covering raw vectors, (de)serialization, cosine behavior, and memory reporting. |
| examples/cpp/README.md | Document new memory comparison example. |
| examples/cpp/CMakeLists.txt | Build target for the new memory comparison example. |
| examples/cpp/325_feature_compare_hgraph_pyramid_memory.cpp | New example program to compare RSS/allocator/index-reported memory. |
| docs/docs/zh/src/indexes/pyramid.md | Document new Pyramid raw-vector parameters (ZH). |
| docs/docs/zh/src/advanced/new_serialization.md | Document Pyramid streaming raw_vector block (ZH). |
| docs/docs/en/src/indexes/pyramid.md | Document new Pyramid raw-vector parameters (EN). |
| docs/docs/en/src/advanced/new_serialization.md | Document Pyramid streaming raw_vector block (EN). |
|
/retest |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/algorithm/pyramid/pyramid.cpp:978
SUPPORT_GET_RAW_VECTOR_BY_IDSis enabled wheneverraw_vector_ != nullptr, but for cosine metrics an FP32 flatten withoutHoldMolds()stores normalized vectors, soGetRawVectorByIdswould not return the original/raw vectors. This should follow the same gating used by BruteForce/HGraph: only advertise raw-vector support for cosine when molds are preserved.
if (raw_vector_ != nullptr) {
this->index_feature_list_->SetFeature(IndexFeature::SUPPORT_GET_RAW_VECTOR_BY_IDS);
}
vsag-bot
left a comment
There was a problem hiding this comment.
Automated inline review completed.
Review effort: high (531 changed lines across 10 files).
Submitted 4 inline comments.
Reviewed commit c519510.
Signed-off-by: jac0626 <jac0626@users.noreply.github.com> Assisted-by: Codex:gpt-5
Signed-off-by: jac0626 <jac0626@users.noreply.github.com> Assisted-by: Codex:gpt-5
Signed-off-by: jac0626 <jac0626@users.noreply.github.com> Assisted-by: Codex:gpt-5
08b4de1 to
360048a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
src/algorithm/pyramid/pyramid.cpp:474
- GetMemoryUsageDetail() computes hierarchy_memory using hierarchies_.bucket_count() * sizeof(value_type), which overcounts because value_type storage scales with hierarchies_.size(), not bucket_count. This can noticeably inflate the reported memory usage for small numbers of hierarchies.
uint64_t hierarchy_memory = hierarchies_.bucket_count() *
(sizeof(decltype(hierarchies_)::value_type) + sizeof(uint32_t));
for (const auto& [name, hierarchy] : hierarchies_) {
vsag-bot
left a comment
There was a problem hiding this comment.
Automated inline review completed.
Review effort: high (809 changed lines across 8 files).
Submitted 1 inline comment.
Reviewed commit 360048a.
Signed-off-by: jc543239 <jc543239@antgroup.com> Assisted-by: Codex:gpt-5
vsag-bot
left a comment
There was a problem hiding this comment.
Automated inline review completed.
Review effort: high (811 changed lines across 8 files).
Submitted 1 inline comment.
Reviewed commit ab8a0f2.
|
/retest |
Change Type
Linked Issue
What Changed
store_raw_vectorsupport and expose raw vectors throughGetRawVectorByIds/GetVectorByInnerId.GetMemoryUsage()/GetMemoryUsageDetail()reporting, including hierarchy graphs and separate raw-vector storage without double-counting aliases.hold_molds, validate legacy deserialization parameters before reading the body, and preserve backward compatibility for older Pyramid parameter snapshots.Test Evidence
make fmtmake lintmake testmake cov, run tests, and collect coverageTest details:
Compatibility Impact
store_raw_vector=true; FP32 parameter snapshots now retainhold_moldsPerformance and Concurrency Impact
Documentation Impact
README.mdDEVELOPMENT.mdCONTRIBUTING.mdRisk and Rollback
Checklist
kind/bugandkind/feature; see "Linked Issue" above)[skip ci]prefix)