Skip to content
Quantoros

What is quantization of embeddings and how does it reduce costs?

NLPLevel: IntermediateProduction Engineering

What is quantization of embeddings and how does it reduce costs?

Hints
  • What does closeness mean in this representation and metric?
  • Check normalization, exact versus approximate search and alignment with the training objective.

Answer

Scalar quantization: convert float32 (4 bytes/dim) → int8 (1 byte/dim). 4× compression, ~5% recall loss. Widely supported.

Binary quantization: convert to 1 bit/dim by sign(x). 32× compression, ~10–15% recall loss. Can recover quality by re-ranking binary-retrieved candidates with full float precision.

Product quantization (PQ): cluster sub-vectors into codebooks; represent each vector as indices into codebooks. 16–32× compression. Used in Faiss IVF-PQ.

Matryoshka dimension truncation: truncate OpenAI text-embedding-3-large from 3072 → 512 dimensions with modest quality loss. Same model, no quantization error.

Source and licence: JustInCache & contributors — Awesome AI Interviews · Apache-2.0

Related questions