What is Cosine Similarity?
TL;DR
A method for measuring similarity by computing the angle between two vectors. Standard metric for comparing embeddings.
Cosine Similarity: Definition & Explanation
Cosine similarity measures the similarity between two vectors by computing the cosine of the angle between them. Values range from -1 to 1, where 1 indicates high similarity, 0 indicates no relationship, and -1 indicates opposite meaning. In AI, it is widely used to compute semantic similarity between text and image embeddings (vector representations). RAG systems calculate cosine similarity between query and document embeddings to find the most relevant information, while recommendation systems compute similarity between user preference vectors and item vectors. Its key characteristic is being a normalized metric independent of vector magnitude.