Cosine Similarity
The cosine of the angle between two vectors, measuring agreement in direction while ignoring length entirely.
Cosine similarity divides the dot product by both magnitudes, , which lands the result in no matter how long either vector is. One means identical direction, zero means orthogonal, negative one means opposite.
It is the default for comparing embeddings because it measures the thing you care about. Two documents about the same topic should score highly whether one is a paragraph and the other is a chapter, and length-sensitive measures do not deliver that.
Two practical notes. If your vectors are already normalised to unit length, the plain dot product is the cosine, so nothing extra needs computing — that equivalence is what vector databases build on. And for normalised vectors, cosine similarity and Euclidean distance rank identically, since ; they are the same ordering expressed two ways.