Repository navigation
Tighten the dense selection as its heap fills - #71
Merged
Merged
Conversation
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.
The dense scorer made a result for every row of the matrix and let the bounded heap discard almost all of them. Scan and inverted both raise their minimum similarity as the heap fills, so a row that cannot reach what the heap already holds is rejected before anything is made for it. The dense path never adopted that.
DotProductRows.addRowsnow raises its minimum throughResultHeaps.tightenedMinSimilarity()after every row it adds, which is the same helper and the same conservative bound the scan uses, one step below the weakest row kept. A row tying with the weakest is therefore still offered to the heap rather than skipped, so what a query returns is unchanged.Measured on a devpod at 200k rows of 512 dimensions, k of 100, 24 threads, one dispatcher, selecting the true best rows with no minimum similarity: 268 queries a second against 203 at one query a batch, and 744 against 449 at 113. Selection fell from 83% of a query to 72%.
Three tests cover it: the best rows are kept, rows tying with the weakest still fill the bound, and a query's own minimum still excludes what is below it.
658 tests pass.