← All questions
Retrieval & EmbeddingsHard· Product Quantization· Computational Complexity

Why use a product codebook (multiple small codebooks) i...

A single codebook with 2^32 centroids is theoretically more expressive but practically impossible due to the massive training data and memory required for centroids. Product Quantization (PQ) breaks the space into smaller subspaces, which is far more efficient. The trade-off is that PQ assumes boundaries are axis-parallel in the subspace decomposition. Techniques like Optimized Product Quantization (OPQ) can mitigate this by rotating the space to better align with the axes.

Code playground (Python)