Skip to content

feat(sindi): integrate reasoning mechanism for search diagnostics#2405

Open
LHT129 wants to merge 1 commit into
antgroup:mainfrom
LHT129:opencode/sindi-reasoning
Open

feat(sindi): integrate reasoning mechanism for search diagnostics#2405
LHT129 wants to merge 1 commit into
antgroup:mainfrom
LHT129:opencode/sindi-reasoning

Conversation

@LHT129

@LHT129 LHT129 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Integrate the reasoning mechanism into the SINDI (Sparse Inverted Non-redundant Distance Index) to enable diagnostic analysis of sparse vector search recall.

Changes

  • src/algorithm/sindi/sindi.h: Added forward declaration for ReasoningContext, SearchWithRequest override, AttachReasoningReport method, modified search_impl and immutable_search_impl signatures
  • src/algorithm/sindi/sindi.cpp: Implemented SearchWithRequest, added reasoning tracking in window loops (bucket selections, candidate visits, filter rejections), implemented AttachReasoningReport

Design

SINDI reasoning tracks:

  • Window access: which windows are visited during search
  • Candidate visits: which expected targets are encountered with their distances
  • Filter rejections: which expected targets are rejected by the filter

Zero overhead when reasoning_ctx is null.

Related

Copilot AI review requested due to automatic review settings July 2, 2026 11:44
@LHT129 LHT129 added kind/feature Brand-new functionality or capabilities 引入全新的功能、新特性或新能力 version/1.0 labels Jul 2, 2026
@LHT129 LHT129 self-assigned this Jul 2, 2026
@mergify

mergify Bot commented Jul 2, 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 introduces search reasoning capabilities to the SINDI index by adding SearchWithRequest and integrating a ReasoningContext to record bucket selections, document visits, and filter rejections. The review feedback highlights several critical issues: potential null pointer dereferences for request.query_ and dataset_results, inefficient heap allocations and overwriting behavior in bucket selection recording, incorrect distance scaling when recording visits, and missing diagnostic records during the reordering stage.

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/sindi/sindi.cpp
Comment thread src/algorithm/sindi/sindi.cpp
Comment thread src/algorithm/sindi/sindi.cpp
Comment thread src/algorithm/sindi/sindi.cpp Outdated
Comment thread src/algorithm/sindi/sindi.cpp Outdated
@LHT129

LHT129 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator Author

All review feedback from @gemini-code-assist addressed in dd4c65d:

  1. Bucket selection overwriting + heap alloc in loop (search_impl & immutable_search_impl): Moved selected_buckets declaration before the window loop, accumulate with push_back, call RecordBucketSelection once after the loop. Eliminates per-iteration heap allocation and correctly preserves all bucket IDs.

  2. Incorrect distance scale: RecordVisit now uses 1.0F + dists[i] to match the actual 1 - ip distance metric.

  3. Null check for request.query_: Added CHECK_ARGUMENT(request.query_ != nullptr) before dereferencing.

  4. Missing reorder diagnostics: Added RecordReorder and RecordReorderEviction (with label-to-inner-id conversion) in both search_impl and immutable_search_impl reorder stages.

  5. Null check for dataset_results: AttachReasoningReport now guards against null dataset_results.

@LHT129 LHT129 force-pushed the opencode/sindi-reasoning branch from dd4c65d to f5566ca Compare July 2, 2026 11:58

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@LHT129 LHT129 force-pushed the opencode/sindi-reasoning branch from f5566ca to f52f18a Compare July 3, 2026 03:47
@LHT129 LHT129 force-pushed the opencode/sindi-reasoning branch from f52f18a to 411aaf7 Compare July 3, 2026 04:04
Copilot AI review requested due to automatic review settings July 3, 2026 04:04

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

Comment thread src/algorithm/sindi/sindi.cpp
Comment thread src/algorithm/sindi/sindi.cpp Outdated
Comment thread src/algorithm/sindi/sindi.cpp Outdated
Comment thread tests/test_sindi.cpp
@vsag-bot

vsag-bot commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

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

Copilot AI review requested due to automatic review settings July 6, 2026 09:35
@LHT129 LHT129 force-pushed the opencode/sindi-reasoning branch from 65347ab to b359710 Compare July 6, 2026 09:35

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

Comment thread src/algorithm/sindi/sindi.cpp Outdated
Comment thread src/algorithm/sindi/sindi.cpp Outdated
Comment thread src/algorithm/sindi/sindi.cpp Outdated
Comment thread src/algorithm/sindi/sindi.cpp
Comment thread src/algorithm/sindi/sindi.cpp
Comment thread src/algorithm/sindi/sindi.cpp
Comment thread src/algorithm/sindi/sindi.cpp
Add SearchWithRequest override to SINDI index to support reasoning
context creation when expected_labels are provided. Track window
accesses, candidate visits, and filter rejections during the search
process. Attach reasoning report to search results for diagnostic
analysis of sparse vector recall.

Signed-off-by: LHT129 <tianlan.lht@antgroup.com>
Co-authored-by: opencode <opencode@anthropic.com>
@LHT129 LHT129 force-pushed the opencode/sindi-reasoning branch from b359710 to 57b275e Compare July 7, 2026 03:14
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 引入全新的功能、新特性或新能力 module/testing size/L version/1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] SINDI Reasoning Integration

3 participants