fix(linalg): correct multivector distance aggregation - #8710
Merged
Conversation
ddupg
force-pushed
the
fix/ddu-348-multivec-distance
branch
from
August 24, 2026 04:31
0d63488 to
33ededc
Compare
ddupg
marked this pull request as ready for review
August 24, 2026 04:31
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ddupg
force-pushed
the
fix/ddu-348-multivec-distance
branch
from
August 25, 2026 08:19
33ededc to
13a3068
Compare
ddupg
force-pushed
the
fix/ddu-348-multivec-distance
branch
from
August 25, 2026 08:22
13a3068 to
eb48602
Compare
Contributor
There was a problem hiding this comment.
✅ Gate recommendation: approve.
This preserves the additive late-interaction contract by summing each query sub-vector’s nearest stored-vector distance. That directly matches indexed scoring, corrects Hamming ordering, and is cleaner than retaining metric-specific similarity baselines. The regression covers flat, partially indexed, and fully indexed search paths.
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.
Background
While implementing distributed batch vector search in lance-ray#5263, I compared the indexed and flat search paths in Lance Core and found that they used different multivector distance baselines.
For a query with
Msub-vectors, the indexed path used:while the flat path used:
The results therefore differed by
M - 1; for example, a perfect match withM = 2returned0from the indexed path but-1from the flat path.Changes
distance(Q, V) = sum_i min_j d(q_i, v_j).distance(Q, V) = sum_i min_j hamming(q_i, v_j), without an outer1 - ...conversion.Testing
cargo test -p lance-linalgtest_multivec_annandtest_multivec_search_paths