Skip to content

Conversation

@Kerollmops
Copy link
Collaborator

@Kerollmops Kerollmops commented Aug 20, 2025

This PR is a proposal akin to meilisearch/arroy#150 to define a threshold at which Hannoy will switch to a linear search instead of using the HNSW. This threshold is arbitrarily set to 1000, but maybe @irevoire or @ManyTheFish has a better idea (5% of the index size)?

We should maybe implement this:
https://github.com/meilisearch/arroy/blob/ee8388229f5c8ec6e3c74c7687061f3e5af92b5f/src/reader.rs#L292-L296

@Kerollmops Kerollmops added the enhancement New feature or request label Aug 20, 2025
@Kerollmops Kerollmops force-pushed the optimize-small-candidates-nns branch from bbf31e2 to 7a8d0b4 Compare August 20, 2025 16:01
@Kerollmops Kerollmops force-pushed the optimize-small-candidates-nns branch from 7a8d0b4 to 785801d Compare August 20, 2025 16:08
@irevoire
Copy link
Collaborator

FYI @Kerollmops I decided to go with 5% of the dataset after looking at your benchmarks here: https://blog.kerollmops.com/meilisearch-vs-qdrant-tradeoffs-strengths-and-weaknesses
Where we see the query time going from 60ms with 6% of the dataset included to 100ms with 1% of the dataset.
I have no idea if hannoy has the same issue and at which thresholds (even for arroy maybe it depends on the number of dimensions or something)

@Kerollmops
Copy link
Collaborator Author

Thank you @irevoire. So, we could keep the current 10000 setting and adjust in the future. @nnethercott we can merge this way I think 😇

@nnethercott
Copy link
Owner

@Kerollmops @irevoire just ran it on the vector benchmark and it is indeed faster! looks good to me

@Kerollmops Kerollmops merged commit 0d36b6f into main Aug 21, 2025
21 checks passed
@Kerollmops Kerollmops deleted the optimize-small-candidates-nns branch August 21, 2025 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants