Dot product vs. cosine distance between embedding vectors

Shouldn’t the cosine similarity [cs(a,b)=np.dot(a,b)/(norm(a)*norm(b))] be used instead of np.dot? Otherwise, the length of the vectors will distort the measure.

Hi @fredm73 ,

I don’t recall seeing in the course using the dot product as a way to find proximity between two vectors.

Dot product will provide information about how much two vectors align but it does not provide the distance between them.

In summary, dot product can give you some information about the relationship between two vectors, but it’s not a direct measure of the distance between them.

To measure the distance between vectors, cosine similarity, which you mention, works very well. There are other methods, being Euclidian Distance.

Thanks for the quick response.

It is a small point: In the lecture Vectorstores and Embedding, 3:17 in, it is using np.dot to compare embeddings.
Perhaps it should be corrected if the lecture gets an update.

I must say these LLM short courses have been an eye-opener for me. Congrats to the creators and the community advisors (i.e. you )

Regards,