Add reranking document post processor#5904
Open
KoreaNirsa wants to merge 1 commit intospring-projects:mainfrom
Open
Add reranking document post processor#5904KoreaNirsa wants to merge 1 commit intospring-projects:mainfrom
KoreaNirsa wants to merge 1 commit intospring-projects:mainfrom
Conversation
Signed-off-by: KoreaNirsa <islandtim@naver.com>
8358585 to
276655d
Compare
|
Hi @KoreaNirsa, nice work on the reranking post-processor! Just a heads-up: PR #5887 (linked to issue #5776, filed on Apr 8) covers similar territory with a Flagging this for the maintainers' awareness so both approaches can be evaluated together. 🙂 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5903
Overview
This PR adds reusable document reranking support to the RAG module.
The new post-processor supports the common RAG pattern of retrieving a broader candidate set from a vector store, reranking those candidates with a more precise relevance strategy, and passing only the best-ranked documents to generation.
The implementation intentionally does not define the ranking strategy itself. Instead, applications provide a
DocumentReranker, which can delegate to an external reranking model or service, use custom metadata-based scoring, apply rule-based ranking, or combine multiple relevance signals.Changes
DocumentRerankeras a functional contract for reranking retrieved documents based on aQueryRerankingDocumentPostProcessorto apply aDocumentRerankerafter retrievaltopNsupport to keep only the highest-ranked reranked documentstopNtruncation, validation, and empty input behaviorRetrievalAugmentationAdvisor