Get the latest tech news

Alternatives to cosine similarity


Cosine similarity is the recommended way to compare vectors, but what other distance functions are there? And are any of them better?

It's often the technical underpinning of RAG pipelines ( Retrieval Augmented Generation), for instance, where related content is "found" and injected into the context of a message passed to an LLM. The "combined" score is a simple average (mean) of the F-score, AP, and NDCG scores.As predicted by the theory, the cosine similarity, dot product, and Euclidean distance functions all produced identical results. TL;RD: For normalized vectors like those used by LLM embeddings, calculating the dot product is the optimal way to determine their similarity.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of alternatives

alternatives

Photo of Cosine Similarity

Cosine Similarity

Related news:

News photo

The Many Alternatives to Scrum – By Adam Ard

News photo

Redis users considering alternatives after licensing move

News photo

Majority of Redis users considering alternatives after less permissive licensing move