You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Residual quantization (TurboQuant-style second pass) — recall at same bit width #23
vecq's pipeline (random rotation → fixed Lloyd-Max codebook) is in the same family as TurboQuant (arXiv:2504.19874, adopted by Qdrant 1.18). TurboQuant's extra lever: quantize the vector, then quantize the residual with a second Lloyd-Max pass — materially lower MSE at 3–4 bits. The follow-up paper Revisiting RaBitQ and TurboQuant found mixed results head-to-head — vecq should adopt the technique only with measured evidence.
Design
Encode: code0 = quantize_4bit(x), residual r = x - dequant(code0), code1 = quantize_4bit(r * gain) (gain = fixed per-dim or per-vector scalar).
Score: s = adc(code0, q) + w * adc(code1, q) with fixed association order (must stay bit-identical across paths — same discipline as NEON/AVX2 kernels).
Format v1.2: optional residual code block per vector (readers accept v1/v1.1/v1.2; writers opt-in) — keeps forward compatibility.
Optional: 3-bit tier (code0 at 3 bits + residual) for a higher-compression profile.
Acceptance
Recall@10 delta vs current 4-bit on the benchmark dataset (EmbeddingGemma, 1k/10k/50k)
MSE bound documented in docs (à la TurboQuant's constant-factor-of-lower-bound framing)
Bit-identity tests extended to the residual term (NEON == AVX2 == scalar)
Format v1.2 round-trip + v1.1 read compatibility tests
Runs after or alongside the benchmark-baseline issue (needs a competitor comparison to justify). Medium-high effort (format migration + kernel changes).
Activity
bench: head-to-head vs TurboQuant and RaBitQ at 4 bits (#28) (#34)
fix(core): residual scoring — exact reconstruction-norm denominator (#23
test+docs: real-dataset residual validation + benchmark doc (#23)
fix(test): use as_chunks::<4> — satisfy clippy 1.98 chunks_exact_to_a…
feat(core): residual quantization — opt-in recall mode, exact-norm tw…
docs: benchmark width matrix (#39/#40) + changelog for Unreleased (#42)
chore: release v0.3.0 to main (#46)
chore: release v0.3.1 to main (#55)