Skip to content

Commit 0fec31c

Browse files
committed
test(quantization): correct the RaBitQ memory-savings expectation
384 dims pad to 512 for the FWHT rotation, so each vector costs 64 code bytes plus 8 bytes of factors (21.3x vs FP32), and with 100 vectors the fixed centroid/rotation state brings the total to ~17x. The old "> 20x (~32x expected)" bound ignored padding and fixed cost and failed on every platform; assert the achievable range instead.
1 parent fb7da53 commit 0fec31c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎tests/test_quantization.cpp‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,13 @@ void test_two_stage_memory_savings() {
571571
} else if (qtype == QuantizationType::LVQ4) {
572572
assert(compression > 6.0f); // ~8x expected
573573
} else if (qtype == QuantizationType::RaBitQ) {
574-
assert(compression > 20.0f); // ~32x expected
574+
// 384 dims pad to 512 for the FWHT rotation: 64 code bytes + 8 bytes of per-vector
575+
// factors = 72 B vs 1536 B FP32 (21.3x per vector). With only 100 vectors the fixed
576+
// centroid + rotation state (~1.7 KB) brings the total to ~17x.
577+
assert(compression > 16.0f);
578+
const float per_vector_bound = static_cast<float>(dim * sizeof(float)) /
579+
static_cast<float>(512 / 8 + 2 * sizeof(float));
580+
assert(compression < per_vector_bound);
575581
}
576582
}
577583

0 commit comments

Comments
 (0)