Cosine Similarity
Definition
Cosine similarity measures the angle between two vectors and thus their directional similarity.
It is the normalized dot product value and ranges between -1 and 1 for general vectors. For many embeddings, positive values are often interpreted as higher semantic similarity.
Simply explained
Like comparing whether two arrows point in the same direction – regardless of their length.
Why it matters in practice
Relevant for embeddings, semantic search, clustering, and recommendations.
Example from business
A document search ranks embeddings by cosine similarity to the query.
Limits and pitfalls
- Confusing similarity with semantic equivalence; setting thresholds without evaluation; mixing different embedding models.
Origin & history
The cosine measure originates from vector geometry and has long been used in information retrieval and text analysis.
Use in mid-sized companies
- Possible application in SMEs: Calibrating semantic similarity for retrieval or duplicates with real test cases.
Frequently asked questions
Does Cosine Similarity consider vector length?
Due to normalization, largely no. Is a high value automatically relevant? No.
Sources
- cosine_similarity · scikit-learn, cosine_similarity
Sources checked on 10.10.2026.
Editorially reviewed on: