Cosine Similaritymath

A measure of similarity between two vectors defined as their dot product divided by the product of their magnitudes — equivalently, the cosine of the angle between them.

Cosine similarity is the workhorse of embedding-based retrieval and clustering; it is insensitive to vector length, so it captures direction (semantics) over magnitude.

Where it appears

Descend

Historical evolution

Standard since latent semantic analysis (1990s); the default embedding distance.

Implementation details

sim(a,b) = (a.b)/(|a||b|); upstream keeps top-10 most similar per vector for clustering.

Sources

View in graph →