Product Quantization (PQ) is a lossy compression method for high-dimensional vectors that splits the original vector into M equal sub-vectors. Each sub-vector is independently quantized by mapping it to the nearest centroid in a pre-computed codebook, replacing the original floating-point values with compact integer codes. This process reduces storage from D × 32 bits to M × log₂(K) bits, where K is the number of centroids per subspace.
Glossary
Product Quantization (PQ)

What is Product Quantization (PQ)?
Product Quantization (PQ) is a vector compression technique that decomposes the original high-dimensional space into a Cartesian product of lower-dimensional subspaces and quantizes each independently, dramatically reducing memory footprint for approximate nearest neighbor search.
During similarity search, the query vector is similarly decomposed, and distances are computed using pre-calculated lookup tables that store the distances between the query sub-vectors and each subspace centroid. This asymmetric distance computation avoids reconstructing the original vectors, enabling efficient approximate distance calculations. FAISS and ScaNN implement optimized PQ indexes, making billion-scale vector search feasible on commodity hardware.
Key Characteristics of Product Quantization
Product Quantization (PQ) is a lossy compression technique that decomposes high-dimensional vectors into orthogonal subspaces and quantizes each independently, enabling massive memory reduction for approximate nearest neighbor search.
Subspace Decomposition
The original D-dimensional vector is split into M disjoint subvectors of dimension D/M. Each subvector is quantized independently using its own codebook of k centroids. This transforms the vector into a compact code of M integers, reducing storage from D×32 bits to M×log₂(k) bits. A typical configuration decomposes a 768-dimensional embedding into 96 subvectors of 8 dimensions each.
Codebook Learning via K-Means
Each subspace's codebook is trained independently using k-means clustering on the subvectors extracted from a representative training set. The centroids minimize the quantization error within each subspace. After training, any new vector is encoded by finding the nearest centroid in each subspace and storing its index. The full vector is approximated by concatenating the corresponding centroids.
Asymmetric Distance Computation (ADC)
During search, PQ uses Asymmetric Distance Computation to avoid reconstructing database vectors. The query vector is split into subvectors, and the distance from each query subvector to every centroid in the corresponding codebook is precomputed into a lookup table. The approximate distance to any database vector is then computed by summing M table lookups, achieving orders-of-magnitude speedup over exact distance calculation.
Memory Footprint Reduction
PQ achieves compression ratios of 8× to 16× compared to full-precision float32 vectors. For 1 billion 128-dimensional vectors, raw storage requires 512 GB. With PQ using M=16 subspaces and k=256 centroids, storage drops to 16 GB—a 32× reduction. This enables billion-scale vector indexes to reside entirely in RAM on a single commodity server.
Optimized Product Quantization (OPQ)
Standard PQ assumes subspace independence, which may not hold for real data distributions. OPQ applies an orthogonal rotation matrix to the vector space before decomposition, decorrelating dimensions and balancing variance across subspaces. This rotation is learned jointly with the codebooks to minimize overall quantization distortion, typically improving recall by 5-15% at equivalent bitrates.
Inverted File with PQ (IVFPQ)
For billion-scale search, PQ is combined with an Inverted File (IVF) index. The IVF partitions the vector space into Voronoi cells using coarse quantization. A query probes only the nearest cells, and PQ compresses the vectors within each cell. This two-level quantization—coarse for pruning, fine for compression—enables sub-millisecond latency on billion-vector datasets while using minimal memory.
Product Quantization vs. Other Compression Techniques
A technical comparison of Product Quantization against scalar quantization and dimensionality reduction for compressing dense vector embeddings in high-scale semantic search systems.
| Feature | Product Quantization | Scalar Quantization | Dimensionality Reduction |
|---|---|---|---|
Compression mechanism | Subspace decomposition and codebook clustering | Reducing bit-width per dimension | Projecting to lower-dimensional space |
Memory reduction factor | 8-32x | 2-4x | 2-10x |
Preserves original dimensionality | |||
Distance computation method | Asymmetric distance via lookup tables | Integer arithmetic | Full recomputation in reduced space |
Training required | |||
Recall@10 on SIFT-1M (approx.) | 95-98% | 99-100% | 85-92% |
Search latency impact | Minimal with lookup tables | Negligible | Reduced due to fewer dimensions |
Suitable for binary embeddings |
Frequently Asked Questions
Clear, technical answers to the most common questions about Product Quantization (PQ), its mechanisms, and its role in high-performance vector search.
Product Quantization (PQ) is a vector compression technique that decomposes the original high-dimensional vector space into a Cartesian product of lower-dimensional subspaces and quantizes each subspace independently. The process works by first splitting a D-dimensional vector into M distinct sub-vectors of dimension D/M. A k-means clustering algorithm is then run independently on each subspace to generate a codebook of centroids. The original vector is compressed by replacing each sub-vector with the ID of its nearest centroid, reducing storage from D floating-point numbers to M integer codes. During search, distances are computed using asymmetric distance computation (ADC), where the query vector is compared against the stored codes via pre-computed lookup tables, avoiding full vector reconstruction. This enables billion-scale similarity search in memory-constrained environments.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Product Quantization is a core technique in the vector compression landscape. Understanding these related concepts is essential for building memory-efficient, high-performance retrieval systems.
Scalar Quantization (SQ)
The foundational compression technique that maps 32-bit floating-point vector components to lower-precision integers (e.g., int8). Unlike PQ, SQ operates on individual dimensions independently.
- Mechanism: Reduces each dimension from 4 bytes to 1 byte.
- Compression Ratio: Typically 4x memory reduction.
- Trade-off: Minimal accuracy loss for a 75% memory footprint reduction.
- Use Case: Often a first-pass optimization before applying more aggressive techniques like PQ.
Vector Quantization (VQ)
A precursor to PQ that maps entire high-dimensional vectors to a finite set of centroids in a codebook. The original vector is replaced by the ID of its nearest centroid.
- Limitation: The codebook size grows exponentially with dimension, making it impractical for modern embeddings.
- PQ Innovation: PQ solves this by decomposing the vector into independent sub-vectors and quantizing each separately.
- Analogy: VQ compresses an entire image; PQ compresses smaller patches of the image independently.
Locality-Sensitive Hashing (LSH)
A hashing-based ANN technique that uses random projection planes to partition the vector space. Similar vectors have a high probability of colliding in the same hash bucket.
- Contrast with PQ: LSH is a partitioning strategy for search, while PQ is a compression strategy for storage.
- Synergy: LSH can be used to find candidate neighborhoods, and PQ-compressed vectors can be used for fine-grained distance calculations within those buckets.
- Weakness: LSH often requires more memory for hash tables compared to graph-based indices.
Inverted File Index (IVF)
A partitioning method that clusters the dataset into Voronoi cells using k-means. A query only searches the nearest cells, drastically reducing the search scope.
- IVF-PQ Synergy: The IVFADC index combines IVF for non-exhaustive search with PQ for compressing the residual vectors within each cell.
- Workflow: The query is assigned to the nearest coarse centroid; then, PQ-encoded distances are computed only against vectors in that cell.
- Parameter Tuning: The
nprobeparameter controls how many cells to search, balancing speed and recall.
Optimized Product Quantization (OPQ)
An enhancement to vanilla PQ that applies an orthogonal rotation matrix to the vector space before subspace decomposition. This rotation minimizes quantization distortion.
- Problem Solved: Standard PQ assumes subspace dimensions are statistically independent, which is rarely true.
- Mechanism: OPQ learns a rotation that balances the variance across subspaces, making quantization more efficient.
- Performance: OPQ consistently achieves higher recall@k than standard PQ for the same compression ratio, at the cost of a more expensive training phase.
RaBitQ (Randomized Binary Quantization)
A recent quantization method that projects vectors onto random basis vectors and binarizes the result, offering a compelling speed-accuracy trade-off against PQ.
- Mechanism: Uses a random matrix to transform the vector, then applies a threshold to produce a binary code.
- Advantage over PQ: Distance computation uses extremely fast popcount CPU instructions.
- Accuracy: Empirically shown to outperform PQ in low-bitrate regimes (e.g., compressing to 1-bit per dimension) on standard ANN benchmarks.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us