Skip to content
nonconvexcard

Product quantisation budget arithmetic

NumericalBeginner⏱ 30 minRAGproduct quantisationcompressionmemorycodebook

Problem

For d=768d = 768 float32 vectors, N=108N = 10^8 documents:

  1. Compute the raw storage.
  2. Compute the storage with product quantisation at m=16m = 16 subvectors and b=8b = 8 bits each, and the compression ratio.
  3. Compute the number of representable points and the codebook size.
  4. Estimate the cost of one asymmetric distance computation.

Compute the requested quantities and say what they mean. A number without an interpretation is not an answer.

Solution

Opening this before you have a real attempt on paper is the fastest way to feel like you understand something you cannot reproduce.

Related problems

All problems
SolvedProblemFieldTypeDifficultyTime
KV cache sizing with MHA and GQALLM OpsNumericalBeginner30 min
Recall composes multiplicativelyRAGNumericalBeginner15 min
When activations dominateFine-TuningNumericalBeginner30 min
When does attention dominate the MLP?Deep LearningNumericalBeginner30 min
Will this fine-tune fit?Fine-TuningNumericalBeginner30 min