fix: prune deleted BM25 vocabulary entries#11997
Merged
Merged
Conversation
|
@hxaxd is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
1 task
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
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.
Related Issues
Proposed Changes:
InMemoryDocumentStore.delete_documents()now removes vocabulary entries whose document frequency reaches zero after subtraction. This prevents terms that exist only in deleted documents from changing the epsilon-adjusted average IDF used byBM25Okapi.PR #7549 introduced incremental BM25 indexing to avoid rebuilding the corpus for each query. Its deletion path used
Counter.subtract(), which retains zero-count keys, while the scoring path treated every Counter key as part of the active vocabulary. The change repairs that state invariant at deletion time without giving up incremental indexing.The PR also adds a regression test comparing a fresh store with a store that previously contained a deleted document, plus a release note.
How did you test it?
TestMemoryDocumentStore::test_bm25_okapi_scores_do_not_depend_on_deleted_documents.Notes for the reviewer
The cleanup is limited to the distinct terms in each deleted document.
Checklist
fix: prune deleted BM25 vocabulary entries.