All Questions
Vector Search medium

Your embedding model was trained with cosine similarity but outputs unnormalized vectors. A teammate configures the index with inner product because it is cheaper to compute. Retrieval quality drops, and long documents with large-magnitude vectors dominate the results. What fixes this?

  1. A Inner product is approximate in HNSW while cosine is exact; switch to flat search to restore exact cosine scoring.
  2. B Cosine and inner product always rank identically, so the drop comes from HNSW tuning; raise efSearch to restore recall.
  3. C Vector magnitudes inflate inner-product scores; L2-normalize at write and query time, then inner product equals cosine.
  4. D L2 distance on the raw vectors produces the same ranking as cosine for any input, so switch the metric to L2 instead.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions