Embeddings & Vector Search · Level 3 of 5
Cosine Similarity
The dot product of nonzero vectors divided by the product of their lengths.
It measures directional alignment and ignores overall magnitude.
Example
Two normalized text vectors receive a high similarity score.
Listen to the definition and example
Audio transcript
Cosine Similarity. The dot product of nonzero vectors divided by the product of their lengths. It measures directional alignment and ignores overall magnitude. For example: Two normalized text vectors receive a high similarity score.
Explore this concept
A useful analogy
Comparing which way two arrows point, regardless of their lengths.
Why it matters
This helps you understand why a retrieval system finds or misses related information.
Technical detail
cos(a,b) = (a·b)/(||a||₂ ||b||₂), defined for nonzero vectors. Unit-normalized vectors reduce this to a dot product.
Common misconception
Cosine similarity is undefined for zero vectors and is not always between zero and one.
Start with
Related concepts
Quick recall question
Try answering before looking back at the definition.