Module binary

Module binary 

Source
Expand description

Binary Quantization (BBQ) for OmenDB

1-bit quantization with SIMD-optimized Hamming distance.

§Algorithm

  • Quantize: bit[d] = 1 if f32[d] > threshold[d] else 0
  • Distance: Hamming distance via XOR + popcnt
  • Correction: Apply norm-based correction for accurate ranking

§Performance

  • 32x compression (f32 → 1 bit)
  • 2-4x faster search than SQ8 (SIMD Hamming is extremely fast)
  • ~85% raw recall, ~95-98% with rescore

§When to Use

  • Dimensions >= 384 (below this, SQ8 has better recall)
  • Large datasets (>100K vectors) where memory matters
  • Cost-sensitive deployments

Structs§

BinaryParams
Binary quantization parameters

Functions§

corrected_distance
Compute corrected distance for binary quantization
hamming_distance
Compute Hamming distance between two binary vectors