All Questions
Vector Search hard

Your recommendation embeddings come from a two-tower model trained with an unnormalized dot-product loss, and item vector norms correlate with item popularity. The ANN index was created with cosine similarity because it was the default. Offline eval looks great, but production rankings favor obscure items. What is the correct fix?

  1. A Leave the index alone; cosine and dot product produce the same ranking, so the gap must be serving-side feature skew.
  2. B Rebuild the index with inner product (MIPS) so scoring matches training; cosine discards the norm signal the model learned.
  3. C Switch the index to L2 distance, which on unnormalized vectors yields the same ordering as the dot product used in training.
  4. D L2-normalize all vectors at ingest and keep cosine, so scores land in a bounded range and line up with the training objective.

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

Get the app

Related questions