Bbq
Source header: cuvs/preprocessing/quantize/bbq.hpp
Better Binary Quantization utilities
preprocessing::quantize::bbq::bbq_code_layout
Storage layout of BBQ/OSQ quantized component codes in each dataset row.
Values
preprocessing::quantize::bbq::get_bit_width
Bit width of a layout.
Parameters
Returns
uint32_t
preprocessing::quantize::bbq::get_encoded_row_length
Bytes one row of dim components occupies once encoded in layout.
Parameters
Returns
uint32_t
preprocessing::quantize::bbq::quantizer
Better Binary Quantization (BBQ) is a vector-quantization approach used in Elasticsearch and Apache Lucene. It builds on ideas introduced in RaBitQ([Gao and Long](https://arxiv.org/pdf/2405.12497, Gao et al.): residual binary codes around a centroid, corrective factors, and efficient bitwise comparison of codes at different bit widths. Lucene implements this as optimized scalar quantization (OSQ) with packed and bit-plane layouts; Elasticsearch exposes it as BBQ.
BBQ in cuVS designed to be compatible with the Lucene/Elasticsearch dataset: a single shared centroid, no random rotation, and OSQ codes.
RaBitQ and BBQ in cuVS both compress centroid-relative vectors to low-bit codes and retain additional per-vector information so search is better than naïve sign-bit comparison. They differ in transformation and scale representation. RaBitQ commonly separates residual magnitude from direction, then applies a random orthogonal rotation before binary coding; BBQ uses per-vector scalar intervals to interpret the compressed residual codes.
Fields
preprocessing::quantize::bbq::helpers::resolve_dequant_factors
Derives dequant_delta from lower/upper_intervals and the layout’s code width, and
dequant_sum_delta from that delta and quantized_component_sums.
Parameters
Returns
void