Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions rust/lance/src/index/vector/ivf/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2596,8 +2596,15 @@ mod tests {
}

fn lightweight_pq_params_with_bits(num_bits: usize) -> PQBuildParams {
let num_sub_vectors = if num_bits == 4 {
// M4 is only a 2-byte code, so random KMeans/HNSW can leave recall near
// the threshold. M32 restores the original 4-bit test capacity.
DIM
} else {
LIGHTWEIGHT_PQ_SUB_VECTORS
};
PQBuildParams {
num_sub_vectors: LIGHTWEIGHT_PQ_SUB_VECTORS,
num_sub_vectors,
num_bits,
max_iters: 2,
sample_rate: 16,
Expand Down Expand Up @@ -2667,6 +2674,7 @@ mod tests {
ivf_params.max_iters = 2;
ivf_params.sample_rate = 16;
let pq_params = lightweight_pq_params_with_bits(num_bits);
let expected_num_sub_vectors = pq_params.num_sub_vectors;
let params = if use_hnsw {
VectorIndexParams::with_ivf_hnsw_pq_params(
distance_type,
Expand Down Expand Up @@ -2704,7 +2712,7 @@ mod tests {
assert_eq!(stats["indices"][0]["sub_index"]["nbits"], num_bits);
assert_eq!(
stats["indices"][0]["sub_index"]["num_sub_vectors"],
LIGHTWEIGHT_PQ_SUB_VECTORS
expected_num_sub_vectors
);
if use_hnsw {
let hnsw_params = &stats["indices"][0]["sub_index"]["params"];
Expand Down
Loading