Use bulk scoring more places for HNSW graphs
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
### Description
While we have added bulk scoring, which can provide a substantial performance boost, we still don't use it everywhere. I happened to notice its missing from filter search & higher level searches (fixed for 10.4), but there are some others.
Looking at the code, there are various places where I still see `RandomVectorScorer.score` that might benefit from the bulk scorer API.
- [x] HnswGraphBuilder#diversityCheck (I am looking at this one now)
- [ ] NeighborArray#isWorstNonDiverse
Now, there are also places that use `VectorScorer.score()` that could benefit from bulk scoring
- [ ] DiversifyingChildrenVectorScorer#nextParent (bulk score the children?)
- [ ] VectorSimilarityScorerSupplier should maybe satisfy the BulkScorer interface and delegate correctly?
- [ ] FullPrecisionFloatVectorSimilarityValuesSource satisfies the DoubleValues interface, which...doesn't have any bulk interfaces :(. But might benefit from them.
- [ ] Same for `VectorSimilarityValuesSource`
Places that use `VectorUtil` directly, that might be harder to refactor but could benefit from bulk scoring:
- [ ] KMeans
- [ ] BpVectorReorderer
Contributor guide
Research direction
Start by tracing the listed RandomVectorScorer and VectorScorer call sites, especially NeighborArray#isWorstNonDiverse and DiversifyingChildrenVectorScorer#nextParent, then review the bulk-scoring API around VectorSimilarityScorerSupplier. Consider the listed VectorUtil users, KMeans and BpVectorReorderer, separately. Done means the applicable remaining scalar-scoring paths use bulk scoring.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, performance, search
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100