advanced practice · coding problem

PQ codebook footprint

1536-d vector, m=48 subspaces, 256 centroids per subspace, 1 byte code/subspace. Bytes per vector vs raw float32?

The mechanism

PQ splits each vector into m sub-vectors and replaces each with the id of its nearest centroid in a per-sub-space codebook. With 8-bit codes that is one byte per sub-vector: a 1536-d float32 vector (6 KB) becomes roughly 48-192 bytes depending on m — a 30-100x cut, paid for with approximate distances.

Study Product Quantization

Expected evidence

48 bytes vs 6144 bytes (~128× compression).

Try this drill in the practice workspace →

Hints when you need them
  • Each subspace stores an index 0–255.
  • Distance is approximate.

Watch for these mistakes

  • Using PQ without IVF and losing the speedup
  • Too-aggressive compression that destroys recall

Check the sources

Browse all practice briefs