Skip to main content

Module codebook

Module codebook 

Source
Expand description

Precomputed Lloyd-Max optimal scalar quantizer codebooks.

For high-dimensional vectors (d ≥ 64), after random rotation each coordinate follows a Beta(d/2, d/2) distribution that closely approximates N(0, 1/d). The codebooks partition [-1, 1] into 2^b buckets minimizing MSE.

These are computed offline by solving the continuous 1-D k-means problem (Eq. 4 in the TurboQuant paper) using the Max-Lloyd algorithm.

Structs§

Codebook
A scalar quantizer codebook for a given bit-width.