Skip to main content

Module binary

Module binary 

Source
Expand description

Binary (1-bit) quantization — a second optional in-memory index mode.

Each dimension is thresholded at its learned per-dimension mean and stored as a single bit (1 if above the mean, else 0), packed into u64 words. Distance is Hamming distance (popcount of XORed codes), which approximates angular similarity. This is an extreme compressor: D bits/vector = D/8 bytes vs D·4 for float32 → ~32× smaller.

Binary codes are coarse: on their own they give a fast, tiny filter with modest recall. The intended pipeline is binary-Hamming for candidate generation followed by a full-precision rerank of the top candidates — see examples/quant_bench.rs, which measures both raw and reranked recall.

Structs§

BinaryQuantizedIndex
BinaryQuantizer
Per-dimension mean-threshold binary quantizer.