Cosine similarity measures the angle between two vectors. It divides their dot product by the product of their lengths, producing a high score when the vectors point in similar directions.
It is common because direction often captures semantic information while vector magnitude may be unrelated to relevance. If all vectors are normalized to length one, cosine similarity and dot product produce the same ranking and can be computed efficiently.
Use the metric recommended for the embedding model. Some models are trained for dot product or Euclidean distance, and changing the metric can hurt quality. A high cosine score is not a universal proof of relevance, so select thresholds with labeled data.
Rewriting in plainer words…
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.