Repository navigation
Conversation
…erank Signed-off-by: Parth Vadera <parthvadera@gmail.com>
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.
Description
In
RankGPTRerank(llama-index-core/llama_index/core/postprocessor/rankGPT_rerank.py):_remove_duplicatechecksif c not in new_response:against a list on every element ($O(K^2)$). Usinglist(dict.fromkeys(response))preserves first-seen order in_receive_permutationappends unranked candidates via[tt for tt in range(rank_end) if tt not in response_list], performing anseen = set(response_list)makes this_clean_responsebuildsnew_responsevia repeated+=character concatenation in a loop instead of"".join(c if c.isdigit() else " " for c in response).strip().On a 2,000-hit permutation (20 calls),
_receive_permutationdrops from610.49 msto38.13 ms(16.0x faster).Type of Change
How Has This Been Tested?
test_rankgpt_rerank_receive_permutation_duplicates_and_missinginllama-index-core/tests/postprocessor/test_rankgpt_rerank.pypytest llama-index-core/tests/postprocessor/test_rankgpt_rerank.py(3 passed)