Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved use ScoreTracker to avoid wasteful searching for very large k #387

Merged
merged 11 commits into from
Jan 17, 2025

Conversation

marianotepper
Copy link
Collaborator

This improves upon #384 by making the quantiles estimation more lightweight. It models the recent scores as a Normal distribution and uses incremental updates to track sufficient statistics of its mean and variance. Then, quantiles are computed from these statistics.

@marianotepper marianotepper requested a review from jbellis January 15, 2025 20:45
@marianotepper marianotepper marked this pull request as ready for review January 15, 2025 20:46
# Conflicts:
#	jvector-base/src/main/java/io/github/jbellis/jvector/graph/GraphSearcher.java
@jbellis
Copy link
Owner

jbellis commented Jan 16, 2025

* This implementation does not consider the worstBestScore provided to shouldStop.

I think this comment must be left over from earlier changes?

* @param bestScoredTracked the number of tracked scores used to estimate if we are unlikely to improve
* the results anymore. An empirical rule of thumb is bestScoredTracked=rerankK.
*/
RelaxedMonotonicityTracker(int bestScoredTracked) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in bestScoresTracked

double windowPercentile = this.mean + SIGMA_FACTOR * std;
double worstBestScore = sortableIntToFloat((int) bestScores.top());
return windowPercentile < worstBestScore;
// return false;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleanup

@jbellis
Copy link
Owner

jbellis commented Jan 16, 2025

How does accuracy look for much smaller k/rrk? Like 5/10 or 10/20?

@marianotepper
Copy link
Collaborator Author

How does accuracy look for much smaller k/rrk? Like 5/10 or 10/20?

Will look into this. We should consider whether in those cases it is worth applying this technique.

@marianotepper
Copy link
Collaborator Author

The exploration savings are consistent for 5/10 or 10/20, but smaller. In the order of 5-10%

@marianotepper marianotepper merged commit 7cbb2e1 into main Jan 17, 2025
0 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants