unit vector
A vector scaled to length one, so comparisons depend only on its direction.
In more detail
Many embedding models return unit vectors. Then the dot product, cosine similarity and Euclidean distance all rank neighbours identically, so use the cheapest measure the model's documentation recommends.
Related terms
- dot product — The sum of the products of two vectors' matching values, a similarity score that grows with both alignment and length.
- cosine similarity — A similarity score between two vectors from the angle between them, from 1 for the same direction to -1 for opposite, ignoring their lengths.
Taught in
- What An Embedding Is — AI Engineering: LLM Apps, RAG & Agents
- How RAG Works And When To Use It — AI Engineering: LLM Apps, RAG & Agents
References
- Hugging Face: sentence-transformers/all-MiniLM-L6-v2 model card
- Python documentation: math.sumprod, math.dist, math.hypot