Skip to main content

Module bbq

Module bbq 

Source
Expand description

BBQ — Better Binary Quantization (Elasticsearch 9.1, mid-2025).

Centroid-centered asymmetric 1-bit quantizer with 14-byte corrective factors per vector. Empirically beats raw FP32 NDCG on 9/10 BEIR datasets via oversampling rerank.

§Corrective factor layout (14 bytes → unified header fields)

BytesHeader fieldMeaning
4residual_norm‖v − c‖ (centroid distance)
4dot_quantized⟨v′, sign(v′)⟩ / ‖v′‖ (quantization quality)
4global_scale⟨v′, c⟩ / ‖c‖ (query alignment)
2reserved[0..2]reserved for future correctives

where v′ = v − c. Together these 14 bytes enable the asymmetric corrective distance used at rerank without storing full FP32 per vector.

§Oversampling

The codec does not execute rerank itself; it exposes oversample so the caller fetches oversample × top_k coarse candidates and reruns exact_asymmetric_distance on them. Default is 3×.

Structs§

BbqCodec
BBQ centroid-centered asymmetric 1-bit quantization codec.
BbqQuantized
Owned quantized BBQ vector. Wraps a UnifiedQuantizedVector with QuantMode::Bbq.
BbqQuery
Prepared query for BBQ distance computation.