Vector compression is a family of techniques that lossily encode high-dimensional dense vectors into compact representations to drastically reduce storage requirements and accelerate approximate nearest neighbor search. The primary goal is to retain semantic fidelity while trading a controlled amount of accuracy for significant gains in memory efficiency and query throughput.
Glossary
Vector Compression

What is Vector Compression?
Vector compression reduces the memory footprint and computational cost of high-dimensional embeddings through quantization and dimensionality reduction, enabling billion-scale similarity search.
The dominant approaches include Product Quantization (PQ), which decomposes a vector into independent sub-vectors and quantizes each subspace separately, and Scalar Quantization (SQ), which maps floating-point values to lower-bit integers. These methods are essential for deploying large-scale dense passage retrieval systems where billion-entry embedding spaces must reside entirely in RAM for low-latency Maximum Inner Product Search (MIPS).
Core Vector Compression Techniques
Techniques that reduce the memory footprint of dense vectors to enable billion-scale similarity search without sacrificing recall.
Scalar Quantization (SQ)
Maps continuous floating-point vector values to a smaller set of discrete integers, typically converting 32-bit floats to 8-bit integers. This achieves a 4x memory reduction with minimal precision loss.
- Uniform quantization: divides the value range into equal intervals
- Non-uniform quantization: allocates more intervals to high-density regions
- Widely used as a first-pass compression before applying product quantization
- Supported natively in FAISS and most vector databases
Product Quantization (PQ)
Decomposes high-dimensional vectors into smaller sub-vectors and quantizes each independently using separate codebooks. A 768-dimensional vector might be split into 96 sub-vectors of 8 dimensions each.
- Each sub-vector is mapped to the nearest centroid in its codebook
- Distances are computed using pre-calculated lookup tables for speed
- Achieves compression ratios of 16x to 32x while maintaining reasonable recall
- The number of sub-vectors and codebook size control the accuracy-memory tradeoff
Inverted File with PQ (IVFPQ)
Combines coarse quantization for candidate pruning with product quantization for compressed storage. An inverted file index first partitions the vector space using k-means clustering, then applies PQ to residuals within each partition.
- Coarse quantizer narrows search to the nearest 1-10% of partitions
- PQ compresses the residual vectors after subtracting cluster centroids
- Enables sub-millisecond search over billion-scale datasets
- The dominant indexing strategy in production vector search systems
Optimized Product Quantization (OPQ)
Pre-processes vectors with a learned rotation matrix before applying product quantization. This rotation decorrelates dimensions and balances the variance across sub-vectors, making the subsequent PQ step significantly more accurate.
- Finds an optimal orthogonal transformation to minimize quantization distortion
- Particularly effective for high-dimensional embeddings with correlated dimensions
- Improves recall by 10-20% over standard PQ at the same compression rate
- The rotation matrix is learned once on a representative sample and applied to all vectors
Binary Quantization
The most aggressive compression technique, reducing each vector dimension to a single bit based on its sign relative to a threshold. A 768-dimensional float32 vector becomes just 96 bytes.
- Each dimension is encoded as 0 or 1, achieving 32x compression
- Distance computation reduces to fast Hamming distance or popcount operations
- Works surprisingly well for high-dimensional embeddings where sign carries significant information
- Often used as a rapid pre-filter before more precise re-ranking stages
Matryoshka Representation Learning
Trains embeddings so that the first few dimensions alone provide a coarse but useful representation, with additional dimensions adding progressively finer detail. Named after nested Russian dolls.
- A single embedding supports multiple granularities without re-encoding
- Truncating to 1/8th of dimensions retains 90%+ of full-dimensional accuracy
- Enables adaptive retrieval: fast coarse search followed by precise re-ranking
- Eliminates the need to store multiple copies of embeddings at different resolutions
Vector Compression Technique Comparison
A comparison of scalar quantization, product quantization, and binary quantization techniques for reducing the memory footprint of dense vectors in billion-scale similarity search.
| Feature | Scalar Quantization (SQ) | Product Quantization (PQ) | Binary Quantization (BQ) |
|---|---|---|---|
Compression Mechanism | Maps float32 values to int8 per dimension | Decomposes vector into sub-vectors, quantizes each independently via k-means codebooks | Converts each dimension to a single bit based on sign threshold |
Memory Reduction Ratio | 4x | 8x–32x | 32x |
Recall@10 Degradation | < 1% | 2%–5% | 5%–15% |
Supports Inner Product Search | |||
Requires Training Phase | |||
Search Speed | Fast (exact distance computation) | Fast (asymmetric distance computation via lookup tables) | Very fast (Hamming distance via POPCNT) |
Best Use Case | Moderate compression with minimal accuracy loss | Billion-scale indexes where memory is the primary constraint | Rapid candidate generation for multi-stage re-ranking pipelines |
Frequently Asked Questions
Clear, technical answers to the most common questions about reducing the memory footprint and computational cost of dense vector embeddings for billion-scale similarity search.
Vector compression is a set of techniques that reduce the memory footprint of dense vector embeddings by encoding them in a more compact representation, typically through quantization. It is necessary because raw 1024-dimensional float32 vectors consume 4 KB each; storing a billion such vectors requires 4 TB of RAM, which is economically prohibitive for real-time search. Compression enables these billion-scale indices to fit entirely in memory, dramatically lowering infrastructure costs while maintaining acceptable recall. The core trade-off is between memory savings and search precision, governed by the compression ratio and the distortion introduced by the encoding scheme.
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
Mastering vector compression requires understanding the indexing structures, quantization techniques, and similarity metrics that make billion-scale semantic search economically viable.
Product Quantization (PQ)
The foundational compression technique that decomposes high-dimensional vectors into smaller sub-vectors and quantizes each independently using distinct codebooks. Instead of storing a full 768-dimensional float32 vector (3 KB), PQ might split it into 96 sub-vectors of 8 dimensions each, quantizing each to a codebook index.
- Memory reduction: A 768-dim vector compressed from 3072 bytes to ~96 bytes (32x reduction)
- Asymmetric distance computation: Query vectors remain uncompressed while database vectors are quantized, preserving accuracy
- Trade-off: Compression ratio vs. recall quality controlled by the number of sub-vectors (M parameter)
Scalar Quantization (SQ)
A simpler compression method that maps continuous floating-point values to discrete integer bins. Unlike PQ, SQ operates on individual dimensions rather than sub-vectors.
- 8-bit quantization: Converts float32 values to int8, reducing memory by 4x with minimal accuracy loss
- 4-bit quantization: Further compression to int4 for aggressive memory savings
- Calibration: Requires computing per-dimension min/max ranges from a sample of the dataset to set quantization boundaries
- Often used as a first-stage compression before applying PQ for additional gains
Inverted File Index (IVF)
A partitioning strategy that clusters the vector space into Voronoi cells using k-means. At query time, only the nearest partitions are searched rather than the entire dataset.
- Coarse quantizer: The clustering step that assigns each vector to its nearest centroid
- nprobe parameter: Controls how many cells to search — higher values increase recall at the cost of speed
- IVF+PQ combination: The industry-standard approach where IVF provides the index structure and PQ compresses the vectors within each cell
- Enables sub-linear search time by pruning 90-99% of the dataset per query
Hierarchical Navigable Small World (HNSW)
A graph-based indexing algorithm that builds a multi-layered proximity graph where each layer contains increasingly dense connections. Search navigates from sparse upper layers to dense lower layers.
- No training phase: Unlike IVF, HNSW builds incrementally without a separate clustering step
- Logarithmic scaling: Search complexity scales as O(log N) with dataset size
- Memory overhead: Stores full-precision vectors plus graph edges, making compression essential for large-scale deployment
- Often paired with PQ or SQ to compress the stored vectors while preserving the graph structure for navigation
Cosine Similarity
The core similarity metric that measures the cosine of the angle between query and document vectors, ranging from -1 (opposite) to 1 (identical). Compression techniques must preserve the relative ordering of these similarity scores.
- Normalization invariant: Only cares about direction, not magnitude — vectors are typically L2-normalized before compression
- Inner product equivalence: For normalized vectors, cosine similarity equals the dot product, enabling efficient MIPS
- Quantization-aware training: Modern embedding models are trained to produce vectors that remain discriminative after compression
- Compression quality is measured by how well the ranked order of cosine similarities is preserved post-quantization

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