Skip to content

fix: integrate rerank into hierarchical retriever#599

Merged
MaojiaSheng merged 3 commits intovolcengine:mainfrom
mildred522:feat/retrieval-rerank-integration
Mar 14, 2026
Merged

fix: integrate rerank into hierarchical retriever#599
MaojiaSheng merged 3 commits intovolcengine:mainfrom
mildred522:feat/retrieval-rerank-integration

Conversation

@mildred522
Copy link
Copy Markdown
Contributor

Description

This PR wires the existing rerank client into hierarchical retrieval so THINKING mode can actually use rerank scores
during both starting-point selection and recursive child retrieval.

It also makes rerank failures non-fatal by falling back to vector scores, and fixes the rerank client request path/
response handling to make the integration usable in practice.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Initialize RerankClient in HierarchicalRetriever when rerank config is available.
  • Apply rerank scores in RetrieverMode.THINKING for both global starting points and recursive child retrieval.
  • Add safe fallback logic so invalid rerank responses, request failures, or score length mismatches fall back to
    vector scores.
  • Update RerankClient to use https:// and return None on invalid/failed rerank calls.
  • Add focused retrieval tests covering rerank initialization, THINKING-mode rerank behavior, fallback behavior, and
    QUICK-mode bypass.
  • Update the English retrieval documentation to clarify rerank fallback behavior.

Testing

Validated locally with Python 3.11 on Windows.

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Additional Notes

  • Rerank is only applied in RetrieverMode.THINKING; QUICK mode remains unchanged.
  • If rerank returns invalid data or the API call fails, retrieval falls back to vector scores to preserve retrieval
    availability.

@mildred522 mildred522 changed the title feat: integrate rerank into hierarchical retriever fix: integrate rerank into hierarchical retriever Mar 14, 2026
@MaojiaSheng MaojiaSheng merged commit 73c7072 into volcengine:main Mar 14, 2026
6 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Mar 14, 2026
CHW0n9 pushed a commit to CHW0n9/OpenViking that referenced this pull request Mar 15, 2026
* feat(retrieval): integrate rerank into hierarchical retriever

* chore(retrieval): align retriever typing with lint checks

* docs(retrieval): clarify rerank fallback in zh docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants