feat(search): support distributed batch vector queries - #5263
Open
ddupg wants to merge 2 commits into
Open
Conversation
ddupg
force-pushed
the
feat/ddu-324-batch-vector-search
branch
from
July 29, 2026 05:33
a67abfd to
d41faa1
Compare
ddupg
marked this pull request as ready for review
July 29, 2026 08:15
ddupg
force-pushed
the
feat/ddu-324-batch-vector-search
branch
from
August 20, 2026 12:04
d41faa1 to
652c1ba
Compare
Keep the existing single-query API unchanged while introducing a bounded streaming session that reuses Ray actors and preserves dataset snapshots. Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
ddupg
force-pushed
the
feat/ddu-324-batch-vector-search
branch
from
August 20, 2026 12:53
652c1ba to
3565a70
Compare
yanghua
pushed a commit
to lance-format/lance
that referenced
this pull request
Aug 30, 2026
## Background While implementing distributed batch vector search in [lance-ray#5263](lance-format/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 `M` sub-vectors, the indexed path used: ```text M - sum(max similarity) ``` while the flat path used: ```text 1 - sum(max similarity) ``` The results therefore differed by `M - 1`; for example, a perfect match with `M = 2` returned `0` from the indexed path but `-1` from the flat path. ## Changes - For float metrics, directly compute `distance(Q, V) = sum_i min_j d(q_i, v_j)`. - For Hamming, use the same aggregation, `distance(Q, V) = sum_i min_j hamming(q_i, v_j)`, without an outer `1 - ...` conversion. - Add unit and end-to-end coverage for flat, indexed, and partially indexed search paths. ## Testing - `cargo test -p lance-linalg` - `test_multivec_ann` and `test_multivec_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
Some workloads need to search a large number of query vectors against the same dataset and index.
The existing
vector_search()API is designed for single-vector queries. Calling it repeatedly processes each query independently, introducing repeated Ray task scheduling and preventing search workers from efficiently batching queries and reusing warmed index state. In our benchmark, this approach achieved only about 9 QPS.This PR keeps
vector_search()unchanged and introduces a separate streaming API for large batch-query workloads.Summary
open_vector_search()for streaming vector queriesquery_indexvector_search()behavior and Global Pool implementationStreaming API
query_batchescan be an iterator, so callers do not need to materialize all query vectors in memory.The main execution parameters are configurable:
Dataset Semantics
The streaming session pins a fixed dataset snapshot for its lifetime.
It supports:
LanceDatasetinputfast_search=Trueto intentionally skip uncovered fragmentsPerformance
Benchmarked with an IVF_RQ index on a 100M-row, 768-dimensional dataset using
k=10,nprobes=9, and accurate mode.vector_search()serial single-queryThe streaming result preserved the reference Recall@10 while substantially improving throughput.