Product Quantisation: Compressing Vectors Without Wrecking Recall
How product quantisation splits vectors into subvectors and compresses each with a codebook, cutting memory 8-64x while preserving search quality.
Published on • November 22, 2026
AI Assistant

Introduction
A billion float32 vectors at 768 dimensions is 3 TB of raw data — before index overhead. Product quantisation (PQ) shrinks each vector to a tiny code (often 8–64 bytes) while keeping similarity search surprisingly accurate. It is one of the most important techniques for large-scale vector search.
The Core Idea
PQ comes from the vector-quantisation family (Jégou et al., built on classic vector quantisation methods): instead of storing each vector, learn to approximate it.
- Split the d-dimensional vector into
msubvectors ofd/mdimensions each. - Cluster each subspace independently with k-means into
kcentroids (typicallyk = 256, i.e., 8 bits per centroid). - Each subvector is replaced by the index of its nearest centroid (a codeword).
- The full vector becomes
mbytes — one per subvector.
Example: 768-dim float32 = 3072 bytes → split into m=96 subvectors of 8 dims → 96 bytes with k=256. 32× compression.
Why It Works (and Where It Hurts)
PQ exploits the fact that similarity can be estimated from partial distances: the distance between two original vectors ≈ the sum of distances between their subvector codewords. The database stores only codebooks + codes, so scans operate on bytes instead of floats.
The trade-off is quantisation error: two different subvectors may map to the same centroid, making them indistinguishable. Errors accumulate across subvectors, so recall drops — usually recoverable with the right companions:
- Shortlist then rescore (PQ + flat): use PQ codes to find a candidate set cheaply, then rescore candidates with the original float vectors. This is the standard recipe — compression for the scan, accuracy for the ranking.
- More subvectors / bigger codebooks → less error, more memory.
- OPQ (optimised PQ) — rotate the vectors before splitting so energy spreads evenly across subvectors, reducing error.
PQ in the ANN Landscape
PQ is a building block, not a standalone index:
- IVF-PQ — PQ codes inside IVF postings lists; the classic billion-scale FAISS index
- ScaNN and others — different quantisation layouts with anisotropic loss
- HNSW over PQ codes — graph search on compressed data (memory drops, recall dips)
ANN-Benchmarks’ recall-vs-latency plots consistently show PQ methods trading a few recall points for order-of-magnitude memory savings — often the difference that fits a deployment budget.
When to Use PQ
- Corpus too large for float vectors in memory (roughly > 100M vectors)
- Latency is bandwidth-bound — smaller data streams faster
- You can afford recall ~0.90–0.97 with a rescore stage to recover precision
- Skip it when the corpus already fits comfortably in RAM; HNSW on raw vectors is simpler and more accurate
Conclusion
Product quantisation says: don’t store the vector, store a smart approximation of it. By factorising the space into independent subspaces and quantising each, PQ cuts memory 8–64× while keeping recall within reach of a rescore pass. It remains the standard tool for billion-vector search.
References
- Wikipedia: Vector quantization (covers product quantisation; the original Product quantization article no longer exists)
- ANN-Benchmarks