Graph
Product Quantization

📦Product Quantization

NEW

Also known as: PQ

A compression technique that splits vectors into subspaces and quantizes each with separate codebooks, enabling fast approximate distance computation and memory reduction.

DESCRIPTION

Product Quantization (PQ) divides a d-dimensional vector into m sub-vectors and learns a small codebook per subspace. Each sub-vector is encoded by its nearest codeword, producing compact codes. During search, asymmetric distance computation approximates distances using precomputed lookup tables, enabling fast scanning of large datasets entirely in memory. PQ is often combined with IVF to form IVF-PQ for scalable vector search. Variants like OPQ rotate the space to reduce quantization error. PQ offers strong memory savings and speed with controllable recall tradeoffs.

ALTERNATIVE DEFINITIONS

Wikipedia

Product quantization is a vector quantization method that decomposes the vector space into a Cartesian product of low-dimensional subspaces and quantizes each subspace separately.

Concise definition highlighting subspace decomposition and independent quantization.

Source

INRIA

We propose a product quantization of the feature space that decomposes the space into a Cartesian product of low dimensional subspaces and quantizes each subspace separately.

Original paper text establishing the PQ approach for nearest neighbor search.

Source

FAISS

Product quantization encodes vectors by splitting them into subvectors and replacing each by the index of its nearest centroid from a sub-quantizer codebook.

Focuses on encoding mechanics and sub-quantizer codebooks within FAISS.

Source

Additive Quantization Inverted File Index Approximate Nearest Neighbor Search FAISS Subspace Decomposition Residual Quantization Codebook Asymmetric Distance Computation

COMPETING TERMS

Scalar Quantization Vector Quantization Optimized Product Quantization

RELATIONS

KNOWLEDGE AREAS

AI Data Storage & Operations Mathematics Data Engineering

TARGET AUDIENCE

Data Engineer AI Engineer MLOps Engineer Data Scientist Cloud Architect

EXTERNAL SOURCES

  • Wikipedia - Product quantization
  • FAISS - PQ overview in FAISS wiki
  • Milvus - Vector index docs including IVF-PQ
  • INRIA - Original PQ paper manuscript

TOP QUESTIONS

It compresses vectors to fit large datasets in memory and enables fast approximate distance computation via lookup tables.

Category: Benefit

How do I choose the number of subspaces in Product Quantization?

Tune the number of subspaces and codebook sizes based on target recall, memory budget, and empirical validation.

Category: Requirements

What is Asymmetric Distance Computation in Product Quantization?

It computes distances between a full-precision query and compressed database codes using precomputed tables to approximate exact distances efficiently.

Category: Explanation

Can Product Quantization be combined with IVF?

Yes, IVF-PQ first narrows candidate lists then scans compressed codes for speed and memory efficiency.

Category: Compatibility

What are common mistakes with Product Quantization?

Using too aggressive compression that harms recall, or misaligned subspace splits causing high quantization error.

Category: Mistakes

How does Optimized Product Quantization differ from Product Quantization?

OPQ learns a rotation to better align variance across subspaces, reducing reconstruction error versus naive splits.

Category: Comparison

Does Product Quantization support dynamic updates?

Yes, codes can be appended; significant distribution shifts may require codebook retraining for best accuracy.

Category: Operations

What metrics evaluate Product Quantization quality?

Recall@k, latency, memory footprint, and quantization error are standard metrics to assess PQ configurations.

Category: Testing

Is Product Quantization suitable for cosine similarity?

Yes, but data normalization and metric-consistent training of codebooks improve performance.

Category: Requirements