Skip to content

feat(pyramid): integrate reasoning mechanism for Pyramid index#2333

Open
LHT129 wants to merge 1 commit into
antgroup:mainfrom
LHT129:lht/pyramid-reasoning
Open

feat(pyramid): integrate reasoning mechanism for Pyramid index#2333
LHT129 wants to merge 1 commit into
antgroup:mainfrom
LHT129:lht/pyramid-reasoning

Conversation

@LHT129

@LHT129 LHT129 commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implement SearchWithRequest for the Pyramid index to integrate the reasoning mechanism.

Changes

  • Add Pyramid::SearchWithRequest override (pyramid.h/pyramid.cpp)
  • Update search_impl to accept optional QueryContext* parameter
  • Integrate ReasoningContext for expected labels tracking

Behavior

When expected_labels is provided in SearchRequest, Pyramid generates a reasoning report diagnosing missed expected results:

  • not_reachable, filter_rejected, quantization_error, ef_too_small, reorder_evicted

Zero overhead when expected_labels is empty.

Testing

  • All 39 existing Pyramid functests pass (113187 assertions)
  • All 5 reasoning functests pass

Closes #2332

@LHT129 LHT129 requested a review from wxyucs as a code owner June 24, 2026 06:52
Copilot AI review requested due to automatic review settings June 24, 2026 06:52
@LHT129 LHT129 requested review from inabao and jiaweizone as code owners June 24, 2026 06:52
@LHT129 LHT129 added kind/feature Brand-new functionality or capabilities 引入全新的功能、新特性或新能力 version/1.0 labels Jun 24, 2026
@LHT129 LHT129 self-assigned this Jun 24, 2026
@mergify

mergify Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 3 merge protections satisfied — ready to merge.

Show 3 satisfied protections

🟢 Require kind label

  • label~=^kind/

🟢 Require version label

  • label~=^version/

🟢 Require linked issue for feature/bug PRs

  • body~=(?im)(?:^|[\s\-\*])(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s*:?\s+(?:#\d+|[\w.\-]+/[\w.\-]+#\d+|https?://github\.com/[\w.\-]+/[\w.\-]+/issues/\d+)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request implements the SearchWithRequest method in the Pyramid class, enabling search requests with reasoning capabilities when expected labels are provided. The feedback highlights two main issues: first, a potential null pointer dereference if the query dataset or its vectors are null, which should be validated with assertions; second, a design flaw where making the QueryContext parameter optional in search_impl leads to silent statistics loss for other search methods (like KnnSearch and RangeSearch). It is recommended to make QueryContext a required parameter across all callers.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/algorithm/pyramid/pyramid.cpp Outdated
Comment thread src/algorithm/pyramid/pyramid.cpp Outdated
Comment thread src/algorithm/pyramid/pyramid.h Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Integrates the reasoning mechanism into Pyramid searches by adding a SearchWithRequest override and wiring ReasoningContext through the search path when expected_labels are provided.

Changes:

  • Added Pyramid::SearchWithRequest implementation to support reasoning reports for missed expected labels
  • Extended search_impl to accept an optional external QueryContext*
  • Added reasoning context setup/diagnosis/report generation when expected_labels is non-empty

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.

File Description
src/algorithm/pyramid/pyramid.h Adds SearchWithRequest API and extends search_impl with optional QueryContext*
src/algorithm/pyramid/pyramid.cpp Implements SearchWithRequest, integrates ReasoningContext, and plumbs external QueryContext through search_impl

Comment thread src/algorithm/pyramid/pyramid.cpp
Comment thread src/algorithm/pyramid/pyramid.cpp Outdated
Comment thread src/algorithm/pyramid/pyramid.cpp Outdated
Comment thread src/algorithm/pyramid/pyramid.cpp Outdated
Comment thread src/algorithm/pyramid/pyramid.cpp Outdated
Comment thread src/algorithm/pyramid/pyramid.cpp
Comment thread src/algorithm/pyramid/pyramid.cpp
Comment thread src/algorithm/pyramid/pyramid.cpp
Comment thread src/algorithm/pyramid/pyramid.cpp Outdated
@LHT129 LHT129 force-pushed the lht/pyramid-reasoning branch 2 times, most recently from 89d84e3 to 6c9ea19 Compare June 24, 2026 07:45
@LHT129 LHT129 force-pushed the lht/pyramid-reasoning branch from 6c9ea19 to b6de6f6 Compare June 24, 2026 10:12
Copilot AI review requested due to automatic review settings June 24, 2026 10:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 2 out of 2 changed files in this pull request and generated 4 comments.

Comment thread src/algorithm/pyramid/pyramid.cpp Outdated
Comment thread src/algorithm/pyramid/pyramid.cpp
Comment thread src/algorithm/pyramid/pyramid.cpp Outdated
Comment thread src/algorithm/pyramid/pyramid.cpp
@LHT129 LHT129 force-pushed the lht/pyramid-reasoning branch from b6de6f6 to 9db2748 Compare June 25, 2026 02:35
Copilot AI review requested due to automatic review settings June 26, 2026 03:39
@LHT129 LHT129 force-pushed the lht/pyramid-reasoning branch from 9db2748 to ccfe08c Compare June 26, 2026 03:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 2 out of 2 changed files in this pull request and generated 5 comments.

Comment thread src/algorithm/pyramid/pyramid.cpp Outdated
Comment thread src/algorithm/pyramid/pyramid.cpp Outdated
Comment thread src/algorithm/pyramid/pyramid.cpp Outdated
Comment thread src/algorithm/pyramid/pyramid.cpp
Comment thread src/algorithm/pyramid/pyramid.cpp Outdated
Implement SearchWithRequest for Pyramid to support reasoning context
creation, expected_targets tracking, and diagnostic report generation.

Changes:
- Add Pyramid::SearchWithRequest override in pyramid.h/pyramid.cpp
- Update search_impl to accept required QueryContext* parameter
- Integrate ReasoningContext for expected labels tracking
- Include partition selection and intra-partition search tracking

When expected_labels is provided in SearchRequest, Pyramid now generates
a reasoning report that diagnoses why expected results were missed
(not_reachable, filter_rejected, quantization_error, ef_too_small,
reorder_evicted). Zero overhead when expected_labels is empty.

Signed-off-by: LHT129 <tianlan.lht@antgroup.com>
Co-authored-by: opencode <opencode@anthropic.com>
@LHT129 LHT129 force-pushed the lht/pyramid-reasoning branch from ccfe08c to e917e79 Compare July 10, 2026 03:47
@vsag-bot

Copy link
Copy Markdown
Collaborator

/label S-waiting-on-review
/waiting-on reviewer
/request-review @jiaweizone
/request-review @wxyucs
/request-review @inabao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Brand-new functionality or capabilities 引入全新的功能、新特性或新能力 size/L version/1.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(pyramid): integrate reasoning mechanism for Pyramid index

4 participants