Skip to content

Dot Product

A mathematical operation that multiplies corresponding vector elements and sums the results, used as a similarity metric sensitive to both direction and magnitude.

The dot product is a basic mathematical operation that multiplies two vectors element by element and sums the results, yielding a single number. In vector search it serves as a similarity score: a larger dot product means the two vectors are more aligned, both in direction and in magnitude.

Unlike cosine similarity, the dot product is sensitive to vector length. A longer vector tends to produce higher dot products across the board, which matters because some embedding models are trained to encode relevance partly in magnitude. OpenAI’s embedding models, for instance, are designed to be compared with the dot product, so using it directly preserves information that normalising away would discard.

There is a neat relationship worth remembering: when vectors are normalised to unit length, the dot product equals cosine similarity. So databases often normalise vectors and use the dot product as a fast way to compute cosine similarity. The related problem of finding the vector with the highest dot product to a query is called maximum inner product search, or MIPS.