Knowledge Maxxing
← Back to topic library
AI MaxxingIntermediate75 sec

Cosine similarity

Cosine similarity measures how closely two vectors point in the same direction, giving a score used to judge how similar two embeddings are in meaning.

Prerequisite: Embedding

What matters

It ignores vector length and focuses purely on direction, which makes it well suited to comparing embeddings where relative meaning matters more than raw magnitude.

Example

Two document embeddings pointing in nearly the same direction get a cosine similarity close to 1, showing the documents are semantically similar, even if their vector lengths differ.

Common misconception

A high cosine similarity does not always mean two documents are about the exact same topic; it means their embeddings are close by whatever pattern the model learned to encode.

Recall question

What aspect of two vectors does cosine similarity actually compare?

Keywords and related concepts

cosine similarityvector comparisonembeddingsembedding

Related topics

Embedding
AI MaxxingIntermediate
Semantic search
AI MaxxingBeginner