Skip to main content

Module rabitq

Module rabitq 

Source
Expand description

RerankCodec wrapper for RaBitQ 1-bit quantization.

RaBitQ is a training-based codec: train() runs centroid calibration and stores a randomised WHT rotation. Until training is complete, encode and prepare_query return RerankError::NotTrained.

Distance is computed by inlining the asymmetric Hamming-based formula from RaBitQCodec::exact_asymmetric_distance:

approx_l2 = q_norm² + v_norm² − 2 · q_norm · v_norm · (1 − 2·hamming/dim)

The prepared form is PreparedQuery::Bytes with the layout: [0..4] query_norm as f32 little-endian [4..] rotated_signs bytes (length = dim.div_ceil(8))

Structs§

RaBitQRerank
Object-safe RerankCodec wrapper around RaBitQCodec.

Constants§

DEFAULT_ROTATION_SEED
Default rotation seed used when the caller does not specify one.