ModelRefs / Cosine Similarity — AI Glossary

Cosine Similarity — AI Glossary

A measure of the angle between two vectors, used to score relevance between query and document embeddings in vector search.

Overview

Cosine similarity = dot(a,b)/(|a||b|), ranging from -1 to 1. For normalized embeddings (unit vectors) it equals dot product, enabling efficient GPU computation. Most vector databases use cosine or dot product as the default distance metric for ANN search. Correlated with but not equivalent to semantic similarity—quality depends on the embedding model.

Reference details

Topicrag
Last reviewed2026-06-24

Commonly confused with

Measures the angle between two vectors and ignores their magnitude, which is what makes it the default for embedding search. On vectors already normalised to unit length it ranks identically to a dot product, so the two are often used interchangeably and that is fine — but only under normalisation, and Euclidean distance ranks differently in general. Check which one your index is configured for; mismatching it against the embedding model's training objective quietly degrades recall.

Continue your research

Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Cosine Similarity — AI Glossary.

Frequently asked questions

What is Cosine Similarity?

A measure of the angle between two vectors, used to score relevance between query and document embeddings in vector search.

What concepts are related to Cosine Similarity?

Closely related concepts include embedding, ann, dense retrieval.