Skip to main content

pick_quantization

Function pick_quantization 

Source
pub fn pick_quantization(
    candidate_set_size: usize,
    target_recall: f32,
) -> QuantizationKind
Expand description

Pick the best quantization tier for a given candidate set size and target recall requirement.

§Heuristic

  • Small sets (< 1 000): FP32 — the set fits in cache; no compression gain.
  • Medium sets (1 000 – 99 999):
    • target recall ≥ 0.97 → SQ8 (high fidelity, 4× compression)
    • otherwise → PQ (8× compression, slightly lower recall)
  • Large sets (≥ 100 000):
    • target recall ≥ 0.95 → BBQ (centroid-centered 1-bit + rerank)
    • otherwise → RaBitQ (raw 1-bit, fastest scan)