when will METRIC_INNER_PRODUCT be fully implemented on GpuIndexIVFPQ?
Hello! Our projects requires to store more than 100Millions vectors (256D) on GPU, so we plan to use GpuIndexIVFPQ in order to compress the data, but METRIC_INNER_PRODUCT is not implented in GpuIndexIVFPQ which is a must for our projects. So could you please tell us when will METRIC_INNER_PRODUCT be fully implemented on GpuIndexIVFPQ?
thank you very much
Hi
Implementing this is currently not high on our priority list.
You may be interested in http://ulrichpaquet.com/Papers/SpeedUp.pdf section 3 that transforms inner product computations into L2 distance computations.
METRIC_INNER_PRODUCT is not implented in IndexIVFFlat? I set nlist = 100, nprobe = 10 in IndexIVFFlat, but not get the correct result..
Hi Please open a new issue with a complete bug report.
@mdouze assuming vectors are normalized before indexing/training/search, wouldn't (2-distances**2)/2 convert the METRIC_L2 distances (returned by the search function) to cosine similarities (inner product metric)?
My maths are a bit rusty so I'm possibly wrong 🤓
cosine similarity = cos(C) where C is the angle between vectors a and b
We know a = 1 and b = 1 since the vectors are normalized.
c is the distance between vectors a and b.
cos(C) = (a^2 + b^2 - c^2) / (2ab)
= (1+1-distance^2) / (2*1*1)
= (2-distance^2) / 2
Yes for normalized vectors.
@mdouze thanks. I just noticed that the distances returned by IVFPQ are already squared so it would be (2-distance) / 2