What is Cosine Similarity?
AI EngineeringLast updated:
A metric that measures the angle between two vectors to determine how semantically similar they are, ranging from -1 to 1.
Cosine similarity computes the cosine of the angle between two embedding vectors, ignoring magnitude. A value of 1 means identical direction (maximum similarity), 0 means orthogonal (unrelated), and -1 means opposite. It is the default similarity metric in most vector databases.